#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int r1, r2, c1, c2, d1, d2, a, b, c, d;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  a = (r1 - (d2 - c1)) / 2;
  b = r1 - a;
  c = d2 - b;
  d = c2 - b;
  if (a > 0 && b > 0 && c > 0 && d > 0 && a < 10 && b < 10 && c < 10 &&
      d < 10 && a != b && a != c && a != d && b != c && b != c && b != d &&
      c != d)
    cout << a << " " << b << endl << c << " " << d << endl;
  else if (a + b == r1 && c + d == r2 && a + c == c1 && b + d == c2 &&
           a + d == d1 && b + c == d2)
    cout << a << " " << b << endl << c << " " << d << endl;
  else
    cout << -1 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  solve();
  return 0;
}
