#include <iostream>
using namespace std;
int main(){
long long bcare,bcarici,boficeri,bkone,btopove,bpeshki,chcare,chcarici,chtopove,choficeri,chkone,chpeshki;
cin>>bcare>>bcarici>>btopove>>bkone>>boficeri>>bpeshki;
cin>>chcare>>chcarici>>chtopove>>chkone>>choficeri>>chpeshki;
cout<<1-bcare<<" "<<1-bcarici<<" "<<2-btopove<<" "<<2-bkone<<" "<<2-boficeri<<" "<<8-bpeshki<<endl;
cout<<1-chcare<<" "<<1-chcarici<<" "<<2-chtopove<<" "<<2-chkone<<" "<<2-choficeri<<" "<<8-chpeshki<<endl;
return 0;
}
