#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int x1, x2, x3, x4;
  for (int i = 1; i <= 9; i++) {
    x1 = i;
    x2 = r1 - x1;
    x3 = d2 - x2;
    x4 = d1 - x1;
    if (x1 + x2 == r1 && x1 + x3 == c1 && x3 + x4 == r2 && x2 + x4 == c2 &&
        x1 + x4 == d1 && x2 + x3 == d2) {
      if (x1 != x2 && x1 != x3 && x1 != x4 && x2 != x3 && x2 != x4 &&
          x3 != x4) {
        cout << x1 << " " << x2 << endl;
        cout << x3 << " " << x4 << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
