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