#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  float x[4];
  int gems[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  x[0] = (r1 - c2 + d1) / 2;
  x[1] = (c2 + r1 - d1) / 2;
  x[2] = (r2 - c2 + d2) / 2;
  x[3] = (c2 - d2 + r2) / 2;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 9; j++) {
      if (x[i] == gems[j]) {
        gems[j] = -1;
        break;
      }
    }
  }
  int counter = 0;
  for (int i = 0; i < 9; i++)
    if (gems[i] == -1) counter++;
  if (counter == 4) {
    cout << x[0] << " " << x[1] << endl << x[2] << " " << x[3];
  } else
    cout << -1;
}
