#include <iostream>
using namespace std;
int main ()
{
    int whitek, whiteq, whitet, whiteh, whiteo, whitep;
    cin>>whitek>>whiteq>>whitet>>whiteh>>whiteo>>whitep;
    int blackk, blackq, blackt, blackh, blacko, blackp;
    cin>>blackk>>blackq>>blackt>>blackh>>blacko>>blackp;
    int firstrow;
    int secondrow;
    if (whitek == 1 && whiteq == 1 && whitet == 2 && whiteh == 2 && whiteo == 2 && whitep == 2)
    {
        cout<<"0 0 0 0 0 0"<<endl;
    }
    if (blackk == 1 && blackq == 1 && blackt == 2 && blackh == 2 && blacko == 2 && blackp == 2)
    {
        cout<<"0 0 0 0 0 0";
    }
    return 0;
}
