#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2, w, x, y, z;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  w = (2 * d1 - r2 - c2 + d2) / 2;
  x = (c2 - r2 + d2) / 2;
  y = (r2 - c2 + d2) / 2;
  z = (r2 + c2 - d2) / 2;
  if (w < 1 || w > 9 || x < 1 || x > 9 || y < 1 || y > 9 || z < 1 || z > 9 ||
      (w == x && x == y && y == z))
    cout << "-1";
  else {
    cout << w << " " << x << "\n";
    cout << y << " " << z << "\n";
  }
  return 0;
}
