#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-7;
string other;
map<string, int> C;
map<pair<string, string>, pair<int, int> > M;
map<string, int> P, W, L;
bool cmp(string a, string b) {
  if (P[a] != P[b]) return P[a] > P[b];
  if (W[a] - L[a] != W[b] - L[b]) return W[a] - L[a] > W[b] - L[b];
  if (W[a] != W[b]) return W[a] > W[b];
  return a < b;
}
void calc(map<pair<string, string>, pair<int, int> > T, int x, int y) {
  T[make_pair("BERLAND", other)] = make_pair(x, y);
  P.clear();
  W.clear();
  L.clear();
  for (typeof(T.begin()) k = T.begin(); k != T.end(); ++k) {
    if (k->second.first > k->second.second) P[k->first.first] += 3;
    if (k->second.first < k->second.second) P[k->first.second] += 3;
    if (k->second.first == k->second.second) {
      ++P[k->first.first];
      ++P[k->first.second];
    }
    W[k->first.first] += k->second.first;
    L[k->first.first] += k->second.second;
    W[k->first.second] += k->second.second;
    L[k->first.second] += k->second.first;
  }
  vector<string> R;
  for (typeof(P.begin()) k = P.begin(); k != P.end(); ++k)
    R.push_back(k->first);
  sort(R.begin(), R.end(), cmp);
  if (R[0] == "BERLAND" || R[1] == "BERLAND") {
    cout << x << ":" << y << "\n";
    exit(0);
  }
}
int main() {
  for (int i = 0; i < (5); ++i) {
    string n1, n2;
    int g1, g2;
    cin >> n1 >> n2 >> g1;
    getchar();
    cin >> g2;
    M[make_pair(n1, n2)] = make_pair(g1, g2);
    ++C[n1];
    ++C[n2];
  }
  for (typeof(C.begin()) k = C.begin(); k != C.end(); ++k)
    if (k->second == 2 && k->first != "BERLAND") other = k->first;
  for (int d = 1; d <= 27; ++d)
    for (int y = 0; y <= 27; ++y) calc(M, y + d, y);
  cout << "IMPOSSIBLE\n";
  return 0;
}
