#include<iostream>
using namespace std;
int main()
{
    int wa, wb, wc, wd, we, wf, ba, bb, bc, bd, be, bf, rwa, rwb, rwc, rwd, rwe, rwf, rba, rbb, rbc, rbd, rbe, rbf;
    cin>>wa>>wb>>wc>>wd>>we>>wf;
    cin>>ba>>bb>>bc>>bd>>be>>bf;
    rwa = 1-wa;
    rwb = 1-wb;
    rwc = 2-wc;
    rwd = 2-wd;
    rwe = 2-we;
    rwf = 8-wf;
    rba = 1-ba;
    rbb = 1-bb;
    rbc = 2-bc;
    rbd = 2-bd;
    rbe = 2-be;
    rbf = 8-bf;
    cout<<rwa<<" "<<rwb<<" "<<rwc<<" "<<rwd<<" "<<rwe<<" "<<rwf<<endl;
    cout<<rba<<" "<<rbb<<" "<<rbc<<" "<<rbd<<" "<<rbe<<" "<<rbf;
    return 0;
}
