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