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