#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int r1,r2,c1,c2,d1,d2;
    cin>>r1>>r2>>c1>>c2>>d1>>d2;
    int n=4;
    int a[n] = {(c1+r1-d2)/2 , (r1+d2-c1)/2 , (d2+c1-r1)/2 , (2*d1+d2-c1-r1)/2};
    set <double> s;     int x=0; 
    for(int i=0;i<4;i++)
    {
        if(a[i]>=0 && a[i]<=9)
        {
            s.insert(a[i]);
        }
        if(a[i]%1==0)
        {
            x++;
        }
    }
    if(s.size()==4 && x==4)
    {
        cout<<a[0]<<" "<<a[1]<<"\n"<<a[2]<<" "<<a[3]<<"\n";
    }
    else
    {
        cout<<"-1\n";
    }

    
    return 0;
}