#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2, x1, x2, x3, x4;
  while (scanf("%d%d%d%d%d%d", &r1, &r2, &c1, &c2, &d1, &d2) != EOF) {
    int flag = 0;
    if ((r1 + r2) != (c1 + c2) || (r1 + r2) != (d1 + d2) ||
        (c1 + c2) != (d1 + d2)) {
      printf("-1\n");
      continue;
    }
    for (int x1 = 1; x1 < r1; x1++) {
      if (x1 > 9) {
        flag = 1;
        break;
      }
      x2 = r1 - x1;
      if (x2 > 9) continue;
      if (x1 == x2) continue;
      for (int x3 = 1; x3 < r2; x3++) {
        if (x3 > 9) break;
        x4 = r2 - x3;
        if (x4 > 9) continue;
        if (x3 == x4) continue;
        if (x1 == x3) continue;
        if (x1 + x4 == d1 && x1 + x3 == c1 && x2 + x4 == c2 && x2 + x3 == d2) {
          printf("%d %d\n%d %d\n", x1, x2, x3, x4);
          flag = 1;
          break;
        }
      }
      if (flag) break;
    }
    if (!flag) printf("-1\n");
  }
  return 0;
}
