#include<bits\stdc++.h>
//#include<boost\lexical_cast.hpp>

#define vec_itr_str_b std::vector<std::string>::iterator itrb
#define vec_itr_str_e std::vector<std::string>::iterator itre
#define vec_itr_int_b std::vector<int>::iterator itrb
#define vec_itr_int_e std::vector<int>::iterator itre
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define mp make_pair
#define pb .push_back
#define all(n) (n).begin(),(n).end()
#define bit(k,i) (((i)>>k)&1)
#define AZ(a) ((char)(a)>='A' && (char)(a)<='Z')
#define NumofDigits(n)  ((int)log10(n)+1)
#define endl '\n'
#define newline std::cout << endl
#define ll long long int 

ll pw(ll b, ll p) { if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }

bool isPrime(int n)
{
	if (n <= 1)
		return false;
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;
	return true;
}

int main() {
	int r1, r2, c1, c2, d1, d2;
	int m1, m2, n1, n2;
	std::cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
	m2 = (d2 + c2 - r2) / 2;
	int arr[4];
	arr[0] = r1 - m2;
	arr[1] = m2;
	arr[2] = d2 - m2;
	arr[3] = c2 - m2;
	int arr2[9] = { 1,2,3,4,5,6,7,8,9 };
	int c = 0;
	for (int i = 0; i < 4; i++) {
		for(int k=0;k<9;k++){
			if (arr[i] == arr2[k]&&arr[i]>0) {
				arr2[k] = 0;
				c = 0;
				break;
			}
			else c = 1;

		}
	}
	if (c == 1)std::cout << -1;
	else { 
		for (int i = 0; i < 4; i++) {
			if (i == 1)std::cout << arr[i] << endl;
			else std::cout << arr[i] << " ";
		} 
	}
	std::cout << endl;
}

