#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2;
  int x = 0, y = 0, z = 0, g = 0;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int miny = min(r1, min(c1, d1));
  for (int i = 0; i < miny; ++i) {
    if (r1 > i) {
      y = r1 - i;
    }
    if (c1 > i) {
      g = c1 - i;
    }
    if (d1 > i) {
      z = d1 - i;
    }
    if (g + z == r2 && y + z == c2 && y + g == d2) {
      x = i;
      if (x == y || x == z || z == y || z == g || y == g || x == g || x > 9 ||
          y > 9 || z > 9 || g > 9)
        return puts("-1"), 0;
      cout << i << " " << y << endl;
      cout << g << " " << z << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
