#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2, a[4];
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  a[3] = (d1 + c2 - r1) / 2;
  a[0] = d1 - a[3];
  a[1] = c2 - a[3];
  a[2] = r2 - a[3];
  if ((a[0] + a[1]) != r1 && (a[2] + a[3]) != r2 && a[1] + a[3] != c2 &&
      a[0] + a[1] != d1) {
    cout << "-1";
    return 0;
  }
  for (int i = 0; i < 4; i++) {
    if (a[i] < 1 || a[i] > 9) {
      cout << "-1";
      return 0;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = (i + 1); j < 4; j++) {
      if (a[i] == a[j]) {
        cout << "-1";
        return 0;
      }
    }
  }
  cout << a[0] << " " << a[1] << endl;
  cout << a[2] << " " << a[3] << endl;
}
