#include <iostream>
using namespace std;
int main ()
{
    int b_king,b_queen,b_topove,b_kone,b_oficeri,b_peshki;
    int ch_king,ch_queen,ch_topove,ch_kone,ch_oficeri,ch_peshki;
    cin>>b_king>>b_queen>>b_topove>>b_kone>>b_oficeri>>b_peshki;
    cin>>ch_king>>ch_queen>>ch_topove>>ch_kone>>ch_oficeri>>ch_peshki;


    if (b_king==1) cout<<0<<' ';

        if (b_king==0) cout<<1<<' ';

    if (b_king>1) cout<<"-"<<b_king-1<<' ';





    if (b_queen==1) cout<<0<<' ';
    else
    {
        if (b_queen==0) cout<<1<<' ';
    }
    if (b_queen>1) cout<<"-"<<b_queen-1<<' ';


    if (b_topove==1) cout<<1<<' ';

        if (b_topove==0) cout<<2<<' ';

      if (b_topove==2)  cout<<0<<' ';
    if (b_topove>2) cout<<"-"<<b_topove-2<<' ';


    if (b_kone==1) cout<<1<<' ';

        if (b_kone==0) cout<<2<<' ';

      if (b_kone==2)  cout<<0<<' ';
    if (b_kone>2) cout<<"-"<<b_kone-2<<' ';


    if (b_oficeri==1) cout<<1<<' ';

        if (b_oficeri==0) cout<<2<<' ';

      if (b_oficeri==2)  cout<<0<<' ';
    if (b_oficeri>2) cout<<"-"<<b_oficeri-2<<' ';


    if (b_peshki==1) cout<<7<<endl;

        if (b_peshki==0) cout<<8<<endl;

      if (b_peshki==2)  cout<<6<<endl;

      if (b_peshki==3)  cout<<5<<endl;

      if (b_peshki==4)  cout<<4<<endl;

      if (b_peshki==5)  cout<<3<<endl;

      if (b_peshki==6)  cout<<2<<endl;

      if (b_peshki==7)  cout<<1<<endl;

      if (b_peshki==8)  cout<<0<<endl;

    if (b_peshki>8) cout<<"-"<<b_peshki-8<<endl;







    if (ch_king==1) cout<<0<<' ';

        if (ch_king==0) cout<<1<<' ';
    if (ch_king>1) cout<<"-"<<ch_king-1<<' ';



    if (ch_queen==1) cout<<0<<' ';
    if (ch_queen==0) cout<<1<<' ';
    if (ch_queen>1) cout<<"-"<<ch_queen-1<<' ';


    if (ch_topove==1) cout<<1<<' ';

        if (ch_topove==0) cout<<2<<' ';

      if (ch_topove==2)  cout<<0<<' ';
   if (ch_topove>2) cout<<"-"<<ch_topove-2<<' ';


    if (ch_kone==1) cout<<1<<' ';

        if (ch_kone==0) cout<<2<<' ';

      if (ch_kone==2)  cout<<0<<' ';
    if (ch_kone>2) cout<<"-"<<ch_kone-2<<' ';


    if (ch_oficeri==1) cout<<1<<' ';

        if (ch_oficeri==0) cout<<2<<' ';

      if (ch_oficeri==2)  cout<<0<<' ';
    if (ch_oficeri>2) cout<<"-"<<ch_oficeri-2<<' ';


    if (ch_peshki==1) cout<<7<<endl;

        if (ch_peshki==0) cout<<8<<endl;

      if (ch_peshki==2)  cout<<6<<endl;

      if (ch_peshki==3)  cout<<5<<endl;

      if (ch_peshki==4)  cout<<4<<endl;

      if (ch_peshki==5)  cout<<3<<endl;

      if (ch_peshki==6)  cout<<2<<endl;

      if (ch_peshki==7)  cout<<1<<endl;

      if (ch_peshki==8)  cout<<0<<endl;
      if (ch_peshki>8) cout<<"-"<<ch_peshki-8<<endl;

    return 0;
}
