#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, f;
  int p, q, r;
  cin >> a >> b >> c >> d >> e >> f;
  for (int i = 1; i <= 9; i++) {
    set<int> s;
    p = a - i;
    q = c - i;
    r = b - q;
    s.insert(i), s.insert(p), s.insert(q), s.insert(r);
    if (s.size() == 4 && (p <= 9 && p >= 1) && (q <= 9 && q >= 1) &&
        (r <= 9 && r >= 1)) {
      cout << i << " " << p << endl;
      cout << q << " " << r << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
