#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, y, sum, a, b, c = 0, i, r1, r2, c1, c2, d1, d2, x1, x2, y1,
                                 y2;
  char x[100001];
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  x2 = (-r1 + d2 + c1) / 2;
  x1 = c1 - x2;
  y1 = r1 - x1;
  y2 = c2 - y1;
  if ((x1 > 0 && 10 > x1 && x2 > 0 && x2 < 10 && y1 > 0 && 10 > y1 && y2 > 0 &&
       y2 < 10) &&
      (x1 != y1 && x2 != y2 && x2 != y1 && x1 != y2)) {
    cout << x1 << " " << y1 << endl;
    cout << x2 << " " << y2 << endl;
  } else {
    cout << "-1" << endl;
  }
  x1 = 0, y1 = 0, x2 = 0, y2 = 0;
}
