#include <bits/stdc++.h>
using namespace std;
int main() {
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2;
  cin >> c1 >> c2;
  cin >> d1 >> d2;
  int x1, x2, y1, y2;
  x1 = (r1 - c2 + d1) / 2;
  x2 = r1 - x1;
  y1 = c1 - x1;
  y2 = d1 - x1;
  if (x1 < 1 || x1 > 9 || x2 < 1 || x2 > 9 || y1 < 1 || y1 > 9 || y2 < 1 ||
      y2 > 9)
    cout << "-1";
  else
    cout << x1 << ' ' << x2 << '\n' << y1 << ' ' << y2;
}
