#include <bits/stdc++.h>
using namespace std;
int main() {
  int c1, c2, r1, r2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int a, b, x, y;
  a = (r1 - c2 + d1) / 2;
  b = (r1 - c1 + d2) / 2;
  x = (r2 - c2 + d2) / 2;
  y = (r2 - c1 + d1) / 2;
  if (a != b && a != x && a != y && b != x && b != y && x != y && a < 10 &&
      b < 10 && x < 10 && y < 10) {
    cout << a << " " << b << endl;
    cout << x << " " << y;
  } else
    cout << "-1";
}
