#include <iostream>

using namespace std;

int main()
{
long long bcar,bcarica,bkon,boficer,btop,bpeshka;
long long chcar,chcarica,chkon,choficer,chtop,chpeshka;
cin>>bcar>>bcarica>>bkon>>boficer>>btop>>bpeshka;
cin>>chcar>>chcarica>>chkon>>choficer>>chtop>>chpeshka;

if (bcar!=1)
{
 if(bcar>1)
 {
     cout<<bcar-1<<" ";
 }
 else
 {
cout<<1<<" ";
 }
}
else
{
cout<<0<<" ";
}





if (bcarica!=1)
{
 if(bcarica>1)
 {
     cout<<bcarica-1<<" ";
 }
 else
 {
cout<<1<<" ";
 }
}
else
{
cout<<0<<" ";
}





if (bkon!=2)
{
 if(bkon>2)
 {
     cout<<bkon-2<<" ";
 }
 else
 {
cout<<2-bkon<<" ";
 }
}
else
{
cout<<0<<" ";
}



if (boficer!=2)
{
 if(boficer>2)
 {
     cout<<boficer-2<<" ";
 }
 else
 {
cout<<2-boficer<<" ";
 }
}
else
{
cout<<0<<" ";
}



if (btop!=2)
{
 if(btop>2)
 {
     cout<<btop-2<<" ";
 }
 else
 {
cout<<2-btop<<" ";
 }
}
else
{
cout<<0<<" ";
}




if (bpeshka!=8)
{
 if(bpeshka>8)
 {
     cout<<bpeshka-8<<" "<<endl;
 }
 else
 {
cout<<8-bpeshka<<" "<<endl;
 }
}
else
{
cout<<0<<" "<<endl;
}



if (chcar!=1)
{
 if(chcar>1)
 {
     cout<<chcar-1<<" ";
 }
 else
 {
cout<<1<<" ";
 }
}
else
{
cout<<0<<" ";
}





if (chcarica!=1)
{
 if(chcarica>1)
 {
     cout<<chcarica-1<<" ";
 }
 else
 {
cout<<1<<" ";
 }
}
else
{
cout<<0<<" ";
}





if (chkon!=2)
{
 if(chkon>2)
 {
     cout<<chkon-2<<" ";
 }
 else
 {
cout<<2-chkon<<" ";
 }
}
else
{
cout<<0<<" ";
}



if (choficer!=2)
{
 if(choficer>2)
 {
     cout<<choficer-2<<" ";
 }
 else
 {
cout<<2-choficer<<" ";
 }
}
else
{
cout<<0<<" ";
}



if (chtop!=2)
{
 if(chtop>2)
 {
     cout<<chtop-2<<" ";
 }
 else
 {
cout<<2-chtop<<" ";
 }
}
else
{
cout<<0<<" ";
}




if (chpeshka!=8)
{
 if(chpeshka>8)
 {
     cout<<chpeshka-8<<" ";
 }
 else
 {
cout<<8-chpeshka<<" ";
 }
}
else
{
cout<<0<<" ";
}
return 0;
}
