#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long INF = 1e18;
const long long NEG_INF = -1 * (1e18);
using namespace std;
bool prime(int n) {
  if (n < 2) return false;
  for (int x = 2; x * x <= n; x++) {
    if (n % x == 0) return false;
  }
  return true;
}
vector<int> getFactors(int n) {
  vector<int> f;
  for (int x = 2; x * x <= n; x++) {
    while (n % x == 0) {
      f.push_back(x);
      n /= x;
    }
  }
  if (n > 1) f.push_back(n);
  return f;
}
void solve() {
  long long r1, r2, c1, c2, d1, d2;
  cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2;
  long long a = (c1 + d1 - r2) / 2;
  long long b = (c2 + d2 - r2) / 2;
  long long x = (c1 + d2 - r1) / 2;
  long long y = (c2 + d1 - r1) / 2;
  if (!((0 < a && a <= 9) && (0 < b && b <= 9) && (0 < x && x <= 9) &&
        (0 < y && y <= 9))) {
    cout << "-1\n";
    return;
  }
  if (a == b || b == x || x == y || a == x || a == y || b == x) {
    cout << "-1\n";
    return;
  }
  cout << a << " " << b << "\n" << x << " " << y << "\n";
}
int main() {
  long long TC = 1;
  for (long long tt = 1; tt <= (long long)(TC); ++tt) {
    solve();
  }
  return 0;
}
