#include <iostream>
using namespace std;
int main () {
    int bc, bq, bt, bk, bo, bp, chc, chq, cht, chk, cho, chp;
    cin >> bc >> bq >> bt >> bk >> bo >> bp;
    cin >> chc >> chq >> cht >> chk >> cho >> chp;
    cout << 1 - bc << " " << 1 - bq << " " << 2 - bt << " " << 2 - bk << " " << 2 - bo << " " << 8 - bp << endl;
    cout << 1 - chc << " " << 1 - chq << " " << 2 - cht << " " << 2 - chk << " " << 2 - cho << " " << 8 - chp << endl;
    return 0;
}
