#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int locks[4] = {0, 0, 0, 0};
  int r1sum = locks[0] + locks[1];
  int r2sum = locks[2] + locks[3];
  int c1sum = locks[0] + locks[2];
  int c2sum = locks[1] + locks[3];
  int d1sum = locks[0] + locks[3];
  int d2sum = locks[1] + locks[2];
  for (int i = 1; i <= 9; ++i) {
    for (int j = 1; j <= r1 - i; ++j) {
      for (int k = 1; k <= c1 - i; ++k) {
        int h = d1 - i;
        if (i + j == r1 && k + h == r2 && i + k == c1 && j + h == c2 &&
            i + h == d1 && j + k == d2 && i != j && k != h && i != h &&
            j != k && h < 10) {
          cout << i << " " << j << endl << k << " " << h << endl;
          return 0;
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}
