#include <bits/stdc++.h>
using namespace std;
string tostring(long long n) {
  ostringstream ss;
  ss << n;
  return ss.str();
}
long long tonumber(string str) {
  stringstream ss;
  ss << str;
  long long n;
  ss >> n;
  return n;
}
int main() {
  ios_base::sync_with_stdio(false);
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int c = (c1 - d1 + r2) / 2;
  int a = c1 - c;
  int d = d1 - a;
  int b = r1 - a;
  if (a < 0 || b < 0 || c < 0 || d < 0 || a == b || c == d || a > 9 || b > 9 ||
      c > 9 || d > 9 || a == c || b == d)
    cout << -1 << endl;
  else {
    cout << a << " " << b << endl;
    cout << c << " " << d << endl;
  }
}
