#include<bits/stdc++.h>
#include<tr1/unordered_map>
using namespace std;
#define ll long long
#define f first
#define s second
#define fi(i,s,e,inc) for(auto i=s; i<e; i+=inc)
#define fie(i,s,e,inc) for(auto i=s; i<=e; i+=inc)
#define umap tr1::unordered_map
#define nl cout<<"\n";
#define vt vector
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    ll r1,r2,c1,c2,d1,d2;
    cin>>r1>>r2>>c1>>c2>>d1>>d2;
    ll u,v,x,y;
    bool z=false;
    fie(u,1,9,1){
        fie(v,1,9,1){
            fie(x,1,9,1){
                fie(y,1,9,1){
                    if(u!=v&&u!=x&&u!=y&&v!=x&&u!=y&&x!=y){
                        if(d1==u+y&&r1==u+v&&c1==u+x&&d2==v+x&&c2==v+y&&r2==x+y){
                            cout<<u<<" "<<v<<"\n"<<x<<" "<<y<<"\n";
                            z=true;
                        }
                    }
                }
            }
        }
    }
    if(!z) cout<<-1<<"\n";
    return 0;
}
