#include <bits/stdc++.h>
using namespace std;
set<int> s;
set<int>::iterator itr;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  int tl = (d1 + c1 + r1 - (r2 + d2 + c2) / 2) / 3;
  s.insert(tl);
  s.insert(d1 - tl);
  s.insert(c1 - tl);
  s.insert(r1 - tl);
  if (s.size() != 4)
    cout << "-1";
  else {
    for (itr = s.begin(); itr != s.end(); itr++) {
      if (*itr < 1 || *itr > 9) {
        cout << "-1";
        exit(0);
      }
    }
    cout << tl << " " << r1 - tl << endl << c1 - tl << " " << d1 - tl;
  }
  return 0;
}
