#include <bits/stdc++.h>
using namespace std;
int r1, r2, c1, c2, d1, d2;
int a, b, c, d, flag = 0;
bool fun1() {
  if (a != b && a != c && a != d && b != c && b != d && c != d) return true;
  return false;
}
bool fun2() {
  if (a + b == r1 && a + c == c1 && a + d == d1 && c + d == r2 && c + b == d2 &&
      b + d == c2)
    return true;
  return false;
}
int main() {
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  for (a = 0; a <= 9; a++)
    for (b = 0; b <= 9; b++)
      for (c = 0; c <= 9; c++)
        for (d = 0; d <= 9; d++)
          if (fun1() && fun2()) {
            cout << a << " " << b << endl;
            cout << c << " " << d << endl;
            return 0;
          }
  cout << "-1" << endl;
  return 0;
}
