#include<iostream>
using namespace std;
int main(){
int hwk,hwq,hwh,hwt,hwo,hwp,hbk,hbq,hbh,hbo,hbt,hbp;
cin>>hwk>>hwq>>hwt>>hwh>>hwo>>hwp;
cout<<endl;
cin>>hbk>>hbq>>hbt>>hbh>>hbo>>hbp;
cout<<1-hwk<<" "<<1-hwq<<" "<<2-hwt<<" "<<2-hwh<<" "<<2-hwo<<" "<<8-hwp<<endl;
cout<<1-hbk<<" "<<1-hbq<<" "<<2-hbt<<" "<<2-hbh<<" "<<2-hbo<<" "<<8-hbp;
return 0;
}
