#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <fstream>
#include <list>
#include <set>
#include <climits>
#include <map>
#include <stack>
#include <queue>
#include <complex>
#include <cmath>
#include <sstream>
#include <deque>
#include <utility>
#include <bitset>

using namespace std;
using namespace __gnu_cxx;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REV(i,a,b) for(int i=(a);i>=(b);i--)
#define mp make_pair
#define pb push_back
#define oo 1e9
#define eps 1e-9
#define PI 3.14159265358979323846264338327950
#define MAX 2001
#define sz(v) (int)v.size()
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define iter(it,s) for(it=s.begin();it!=s.end();it++)
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define mem(s,v) memset(s,v,sizeof(s))
#define ppc(x) __builtin_popcount((x))

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> pi;
typedef vector<pi> vpi;

int dx[] = { 0, 0, 1, -1 };
int dy[] = { 1, -1, 0, 0 };

int main() {
	int r1, r2, c1, c2, d1, d2;
	while (cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2) {
		FOR(i , 0 , 10) {
			FOR(j , 0 , 10) {
				FOR(k , 0 , 10) {
					FOR(h , 0 , 10) {
						if (i + j == r1 && k + h == r2 && i + k == c1 && j + h
								== c2 && i + h == d1 && j + k == d2 && i != j
								&& i != k && i != h && j != k && j != h && k
								!= h) {
							cout << i << " " << j << endl;
							cout << k << " " << h << endl;
							goto e;
						}
					}
				}
			}
		}
		cout << -1 << endl;
		e: ;
	}
	return 0;
}
