#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r1, r2, c1, c2, d1, d2, a, b, c, d;
  cin >> r1 >> r2;
  cin >> c1 >> c2;
  cin >> d1 >> d2;
  a = r1 + d1 - c2;
  b = r1 - a / 2;
  c = c1 - a / 2;
  d = d1 - a / 2;
  if ((a <= 0 || (a / 2) > 9) || (b <= 0 || b > 9) || (c <= 0 || c > 9) ||
      (d <= 0 || d > 9)) {
    cout << -1;
    return 0;
  }
  if (a % 2 == 0) {
    a /= 2;
    if (a == b || a == c || a == d || b == c || b == d || c == d) {
      cout << -1;
      return 0;
    }
    cout << a << " " << b << "\n";
    cout << c << " " << d << "\n";
  } else
    cout << -1;
  return 0;
}
