#include <bits/stdc++.h>
int main() {
  int a, b, c, d, s, f, i, j;
  int ara[100000][10];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 2; j++) {
      scanf("%d", &ara[i][j]);
    }
  }
  s = 0;
  for (i = 0; i < 3; i++) {
    s = s + ara[i][0];
  }
  f = ara[2][0] + ara[2][1];
  a = (s - f) / 2;
  b = ara[0][0] - a;
  c = ara[1][0] - a;
  d = ara[2][0] - a;
  if (a != b && b != c && c != d && a != d && a != c && b != d && a >= 0 &&
      a <= 9 && b >= 0 && b <= 9 && c >= 0 && c <= 9 && d >= 0 && d <= 9) {
    printf("%d %d\n", a, b);
    printf("%d %d", c, d);
  } else {
    printf("-1");
  }
  return 0;
}
