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