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