#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>
// using
using namespace std;
// typedef
typedef long long ll;
// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
// functions
int ceil(int a, int b) {
return (a + b - 1) / b;
}
int round(int a, int b) {
return (a + b / 2) / b;
}
int gcd(int a, int b) {
return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool amin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
int b[2][3] = {}, c[3][2] = {};
const int INF = 1 << 28;
int m[3][3] = {};
int dfs(int t) {
if (t == 9) {
int s = 0;
REP(i, 2) {
REP(j, 3) {
s += b[i][j] * (m[i][j] == m[i + 1][j] ? 1 : -1);
}
}
REP(i, 3) {
REP(j, 2) {
s += c[i][j] * (m[i][j] == m[i][j + 1] ? 1 : -1);
}
}
return -s;
}
int res = -INF;
REP(i, 3) {
REP(j, 3) {
if (m[i][j] == 0) {
m[i][j] = t % 2 + 1;
amax(res, -dfs(t + 1));
m[i][j] = 0;
}
}
}
return res;
}
// main
int main() {
int sum = 0;
REP(i, 2) {
REP(j, 3) {
cin >> b[i][j];
sum += b[i][j];
}
}
REP(i, 3) {
REP(j, 2) {
cin >> c[i][j];
sum += c[i][j];
}
}
int res = (sum + dfs(0)) / 2;
cout << res << endl;
cout << sum - res << endl;
return 0;
}