#include <bits/stdc++.h>
using namespace std;
vector<int> solve(int r1, int r2, int c1, int c2, int d1, int d2) {
  for (int a = 0; a <= 9; ++a)
    for (int b = 0; b <= 9; ++b)
      for (int c = 0; c <= 9; ++c)
        for (int d = 0; d <= 9; ++d)
          if (a + b == r1 and c + d == r2 and a + c == c1 and b + d == c2 and
              a + d == d1 and b + c == d2)
            return {a, b, c, d};
  return {};
}
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  auto res = solve(r1, r2, c1, c2, d1, d2);
  if (res.empty())
    cout << -1 << '\n';
  else {
    cout << res[0] << " " << res[1] << '\n';
    cout << res[2] << " " << res[3] << '\n';
  }
  return 0;
}
