#include <bits/stdc++.h>
using namespace std;
int main() {
  int c1, c2, r1, r2, d1, d2, x1, x2, y1, y2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int ans = 0;
  for (int i = 1; i < 10; i++) {
    x1 = i;
    x2 = c1 - x1;
    y1 = r1 - x1;
    y2 = c2 - y1;
    if (((x1 + y2) == d1) && ((y1 + x2) == d2) && ((x2 + y2) == r2) &&
        ((x1 + x2) == c1) && ((x1 + y1) == r1) && ((y1 + y2) == c2)) {
      if ((x1 != x2) && (x1 != y1) && (x1 != y2) && (x2 != y1) && (x2 != y2) &&
          (y1 != y2)) {
        ans = 1;
        break;
      }
    }
  }
  if (ans == 0)
    cout << "-1" << endl;
  else
    printf("%d %d\n%d %d\n", x1, y1, x2, y2);
  return 0;
}
