#include <iostream>
using namespace std;

int main() {

    int bk, bq, bt, bh, bo, bp, wk, wq, wt, wh, wo, wp;
    cin >> wk >> wq >> wt >> wh >> wo >> wp >> bk >> bq >> bt >> bh >> bo >> bp;

    bk = 1 - bk;
    bq = 1 - bq;
    bt = 2 - bt;
    bh = 2 - bh;
    bo = 2 - bo;
    bp = 8 - bp;
    wk = 1 - wk;
    wq = 1 - wq;
    wt = 2 - wt;
    wh = 2 - wh;
    wo = 2 - wo;
    wp = 8 - wp;

    cout << wk << ' ' << wq << ' ' << wt << ' ' << wh << ' ' << wo << ' ' << wp << '\n' << bk << ' ' << bq << ' ' << bt << ' ' << bh << ' ' << bo << ' ' << bp;


    return 0;

}
