#include <bits/stdc++.h>
using namespace std;
int a[2][2];
int main() {
  int inp[3][2];
  for (int i = 0; i < 3; i++) {
    cin >> inp[i][0] >> inp[i][1];
    for (int j = 0; j < i; j++)
      if (inp[j][0] == inp[i][0] || inp[j][0] == inp[i][1] ||
          inp[j][1] == inp[i][0] || inp[j][1] == inp[i][1]) {
        cout << "-1";
        return 0;
      }
  }
  for (int i = 1; i < 10; i++) {
    a[0][0] = i;
    if (inp[0][0] == 2 * i || inp[1][0] == 2 * i || inp[2][0] == 2 * i)
      continue;
    a[0][1] = inp[0][0] - i;
    a[1][0] = inp[1][0] - i;
    a[1][1] = inp[2][0] - i;
    if (inp[0][1] == a[1][0] + a[1][1] && inp[1][1] == a[0][1] + a[1][1] &&
        inp[2][1] == a[0][1] + a[1][0]) {
      cout << a[0][0] << " " << a[0][1] << "\n" << a[1][0] << " " << a[1][1];
      return 0;
    }
  }
  cout << "-1";
  return 0;
}
