#include <bits/stdc++.h>
using namespace std;
int main() {
  int flog = 0;
  int r1, r2, c1, c2, d1, d2, a, b, c, d, e, f, g, h;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  for (a = 1; a < 10; a++)
    for (b = 1; b < 10; b++)
      for (c = 1; c < 10; c++)
        for (d = 1; d < 10; d++) {
          if (a + b == r1 && a + c == c1 && a + d == d1 && b + d == c2 &&
              b + c == d2 && c + d == r2) {
            if (a == b && b == c && c == d) {
              flog = 0;
            } else {
              flog = 1;
              e = a;
              f = b;
              g = c;
              h = d;
            }
          }
        }
  if (flog == 1) {
    cout << e << " " << f << endl;
    cout << g << " " << h;
  } else
    cout << "-1";
  return 0;
}
