#include <bits/stdc++.h>
using namespace std;
void printarray(int op[2][2]) {
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) cout << op[i][j] << " ";
    cout << "\n";
  }
}
int check(int op[2][2]) {
  int x = 0;
  if (op[0][0] != op[0][1] && op[0][0] != op[1][1] && op[0][0] != op[1][0] &&
      op[0][1] != op[1][0] && op[0][1] != op[1][1] && op[1][0] != op[1][1])
    x = 1;
  return x;
}
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int op[2][2];
  for (int i = 1; i <= 9; i++) {
    int f = 0;
    op[0][0] = i;
    op[0][1] = r1 - i;
    op[1][0] = c1 - i;
    op[1][1] = c2 - op[0][1];
    if (d1 == op[0][0] + op[1][1]) {
      if (d2 == op[0][1] + op[1][0] && check(op) == 1) {
        for (int k = 0; k < 2; k++) {
          for (int g = 0; g < 2; g++) {
            f = 0;
            if (op[k][g] < 10) f = 1;
            if (f == 0) {
              cout << "-1\n";
              exit(0);
            }
          }
        }
        printarray(op);
        exit(0);
      }
    }
  }
  cout << "-1\n";
}
