#include <iostream>
using namespace std;

int main(){
    int Cm, Cj, T, P, O, K, brCm, brCj, brT, brP, brO, brK;
    int CmCH, CjCH, TCH, PCH, OCH, KCH, brCmCH, brCjCH, brTCH, brPCH, brOCH, brKCH;
    cin>>Cm>>Cj>>T>>K>>O>>P;
    cin>>CmCH>>CjCH>>TCH>>KCH>>OCH>>PCH;
    brCm = 1 - Cm;
    brCj = 1 - Cj;
    brT = 2 - T;
    brP = 8 - P;
    brO = 2 - O;
    brK = 2 - K;

    brCmCH = 1 - CmCH;
    brCjCH = 1 - CjCH;
    brTCH = 2 - TCH;
    brPCH = 8 - PCH;
    brOCH = 2 - OCH;
    brKCH = 2 - KCH;

    cout<<brCm<<" "<<brCj<<" "<<brT<<" "<<brK<<" "<<brO<<" "<<brP<<endl;
    cout<<brCmCH<<" "<<brCjCH<<" "<<brTCH<<" "<<brKCH<<" "<<brOCH<<" "<<brPCH<<endl;
    return 0;
}
