#include<iostream>
using namespace std;
int main()
{
    int bqlcar,bqlacarica,belitopove,belioficeri,belipeshki,belikone;
    int cherencar,chernacarica,chernitopove,chernioficeri,chernipeshki,chernikone;
    cin>>bqlcar>>bqlacarica>>belitopove>>belikone>>belioficeri>>belipeshki;
    cin>>cherencar>>chernacarica>>chernitopove>>chernikone>>chernioficeri>>chernipeshki;
    if(bqlcar>=1)
    {
        cout<<1-bqlcar<<" ";
    }
    else
    {
        cout<<1-bqlcar<<" ";
    }
    if(bqlacarica>=1)
    {
        cout<<1-bqlacarica<<" ";
    }
    else
    {
        cout<<1-bqlacarica<<" ";
    }
    if(belitopove>=2)
    {
        cout<<2-belitopove<<" ";
    }
    else
    {
        cout<<2-belitopove<<" ";
    }
    if(belikone>=2)
    {
        cout<<2-belikone<<" ";
    }
    else
    {
        cout<<2-belikone<<" ";
    }
    if(belioficeri>=2)
    {
        cout<<2-belioficeri<<" " ;
    }
    else
    {
        cout<<2-belioficeri<<" ";
    }
    if(belipeshki>=8)
    {
        cout<<8-belipeshki<<" ";
    }
    else
    {
        cout<<8-belipeshki<<endl;
    }
    if(cherencar>=1)
    {
        cout<<1-cherencar<<" ";
    }
    else
    {
        cout<<1-cherencar<<" ";
    }
    if(chernacarica>=1)
    {
        cout<<1-chernacarica<<" ";
    }
    else
    {
        cout<<1-chernacarica<<" ";
    }
    if(chernitopove>=2)
    {
        cout<<2-chernitopove<<" ";
    }
    else
    {
        cout<<2-chernitopove<<" ";
    }
    if(chernikone>=2)
    {
        cout<<2-chernikone<<" ";
    }
    else
    {
        cout<<2-chernikone<<" ";
    }
    if(chernioficeri>=2)
    {
        cout<<2-chernioficeri<<" ";
    }
    else
    {
        cout<<2-chernioficeri<<" ";
    }
    if(chernipeshki>=8)
    {
        cout<<8-chernipeshki<<" ";
    }
    else
    {
        cout<<8-chernipeshki<<" ";
    }
    return 0;
}
