#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n, l = 0, r = 0, r1, r2, c1, c2, d1, d2, a, b, c, d;
  cin >> r1 >> r2;
  cin >> c1 >> c2;
  cin >> d1 >> d2;
  a = (c1 + d1 - r2) / 2;
  b = r1 - a;
  c = c1 - a;
  d = d1 - a;
  if (a + b == r1 && c + d == r2 && a + c == c1 && b + d == c2 && a + d == d1 &&
      b + c == d2) {
    if (a > 9 || b > 9 || c > 9 || d > 9) {
      cout << -1;
      return 0;
    }
    if (a == b || a == c || a == d) {
      cout << -1;
      return 0;
    }
    if (b == c || b == d) {
      cout << -1;
      return 0;
    }
    if (c == d) {
      cout << -1;
      return 0;
    }
    cout << a << " " << b << endl;
    cout << c << " " << d << endl;
    return 0;
  }
  cout << -1;
  return 0;
}
