#include <bits/stdc++.h>
using namespace std;
int main() {
  long r1, r2, c1, c2, d1, d2, t = 0;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  for (int i = 1; i <= r1; i++) {
    for (int j = 1; j <= r2; j++) {
      for (int k = 1; k <= c1; k++) {
        for (int l = 1; l <= c2; l++) {
          if (i != j and i != k and i != l) {
            if (i + j == r1 and k + l == r2 and i + l == d1 and j + k == d2 and
                i + k == c1 and j + l == c2 and i < 10 and j < 10 and k < 10 and
                l < 10) {
              cout << i << " " << j << endl;
              cout << k << " " << l << endl;
              t = 1;
              break;
            }
          }
        }
        if (t) break;
      }
      if (t) break;
    }
    if (t) break;
  }
  if (t == 0) cout << -1 << endl;
  return 0;
}
