#include <bits/stdc++.h>
using namespace std;
int x1, x2, x3, x4, m[7];
int main() {
  for (int i = 0; i <= 4; i = i + 2) {
    cin >> m[i] >> m[i + 1];
  }
  x1 = (m[0] + m[2] - m[5]) / 2;
  if (x1 < 0) {
    cout << -1;
  } else {
    x2 = m[0] - x1;
    x3 = m[5] - x2;
    x4 = m[1] - x3;
    if ((x1 == x2 == x3 == x4) || (x1 == x2) || (x1 == x3) || (x1 == x4) ||
        (x2 == x3) || (x2 == x4) || (x3 == x4)) {
      cout << -1;
    } else if ((x1 >= 10) || (x2 >= 10) || (x3 >= 10) || (x4 >= 10)) {
      cout << -1;
    } else if ((0 == x1) || (0 == x2) || (0 == x3) || (0 == x4)) {
      cout << -1;
    } else {
      cout << x1 << " " << x2 << endl;
      cout << x3 << " " << x4;
    }
  }
  return 0;
}
