#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2, a, b, c, d;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  for (int i = 1; i < 10; i++) {
    a = i;
    b = r1 - i;
    if (c1 - a == d2 - b)
      c = c1 - a;
    else
      continue;
    if (a == b || b == c || a == c) continue;
    if (r2 - c == d1 - a && d1 - a == c2 - b) {
      d = r2 - c;
      if (!((d - a) && (d - b) && (d - c))) continue;
      cout << a << " " << b << endl << c << " " << d << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  return 0;
}
