#include<iostream>
using namespace std;

int main()
{
    int carb=0, caricab=0, konb=0, ofib=0, peshb=0, topb=0;
    int carc=0, caricac=0, konc=0, ofic=0, peshc=0, topc=0;
    cin>>carb>>caricab>>topb>>konb>>ofib>>peshb;
    cin>>carc>>caricac>>topc>>konc>>ofic>>peshc;
    if(carb>=1)
    {
        cout<<1-carb<<" ";
    }
    else
    {
        cout<<1-carc<<" ";
    }
    if(caricab>=1)
    {
        cout<<1-caricab<<" ";
    }
    else
    {
        cout<<1-caricab<<" ";
    }
    if(topb>=2)
    {
        cout<<2-topb<<" ";
    }
    else
    {
        cout<<2-topb<<" ";
    }
    if(konb>=2)
    {
        cout<<2-konb<<" ";
    }
    else
    {
        cout<<2-konb<<" ";
    }
    if(ofib>=2)
    {
        cout<<2-ofib<<" ";
    }
    else
    {
        cout<<2-ofib<<" ";
    }
    if(peshb>=8)
    {
        cout<<8-peshb<<" ";
    }
    else
    {
        cout<<8-peshb<<endl;
    }
    if(carc>=1)
    {
        cout<<1-carc<<" ";
    }
    else
    {
        cout<<1-carc<<" ";
    }
    if(caricac>=1)
    {
        cout<<1-caricac<<" ";
    }
    else
    {
        cout<<1-caricac<<" ";
    }
    if(topc>=2)
    {
        cout<<2-topc<<" ";
    }
    else
    {
        cout<<2-topc<<" ";
    }
    if(konc>=2)
    {
        cout<<2-konc<<" ";
    }
    else
    {
        cout<<2-konc<<" ";
    }
    if(ofic>=2)
    {
        cout<<2-ofic<<" ";
    }
    else
    {
        cout<<2-ofic<<" ";
    }
    if(peshc>=8)
    {
        cout<<8-peshc<<" ";
    }
    else
    {
        cout<<8-peshc<<" ";
    }

    return 0;
}
