#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int a, b, x, y;
  for (int i = 1; i <= 10; i++) {
    a = i;
    b = r1 - a;
    x = c1 - a;
    y = c2 - b;
    if (a + b == r1 && x + y == r2 && a + y == d1 && b + x == d2 &&
        a + x == c1 && b + y == c2 && x != y && i <= 9 && a != b && a <= 9 &&
        b <= 9 && x <= 9 && y <= 9 && a != y && b != x) {
      cout << a << " " << b << endl;
      cout << x << " " << y << endl;
      break;
    }
  }
  if (a == 10) cout << -1 << endl;
  return 0;
}
