#include <bits/stdc++.h>
using namespace std;
map<string, int> matchs;
map<string, pair<int, pair<int, int> > > pts;
map<string, map<string, pair<int, int> > > res;
string avv;
bool check(int a, int b) {
  pts["BERLAND"].second.first += a, pts["BERLAND"].second.second += b,
      pts[avv].second.first += b, pts[avv].second.second += a;
  bool chng = true;
  map<string, pair<int, pair<int, int> > >::iterator it, it2, best;
  it2 = pts.begin();
  for (it = pts.begin(), it++; it != pts.end(); it++) {
    if (it->second.first > it2->second.first)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second >
                 it2->second.second.first - it2->second.second.second)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second ==
                 it2->second.second.first - it2->second.second.second &&
             it->second.second.first > it2->second.second.first)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second ==
                 it2->second.second.first - it2->second.second.second &&
             it->second.second.first == it2->second.second.first &&
             it->first < it2->first)
      it2 = it;
  }
  best = it2;
  it2 = it = pts.begin();
  if (it2 == best) it2++, it++;
  for (it = pts.begin(), it++; it != pts.end(); it++) {
    if (it == best) continue;
    if (it->second.first > it2->second.first)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second >
                 it2->second.second.first - it2->second.second.second)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second ==
                 it2->second.second.first - it2->second.second.second &&
             it->second.second.first > it2->second.second.first)
      it2 = it;
    else if (it->second.first == it2->second.first &&
             it->second.second.first - it->second.second.second ==
                 it2->second.second.first - it2->second.second.second &&
             it->second.second.first == it2->second.second.first &&
             it->first < it2->first)
      it2 = it;
  }
  if (best->first == "BERLAND" || it2->first == "BERLAND") return true;
  pts["BERLAND"].second.first -= a, pts["BERLAND"].second.second -= b,
      pts[avv].second.first -= b, pts[avv].second.second -= a;
  return false;
}
int main() {
  string a, b, c;
  for (int i = 0; i < 5; i++) {
    cin >> a >> b >> c;
    matchs[a] = matchs[b] = 0;
    pts[a] = make_pair(0, make_pair(0, 0));
    pts[b] = make_pair(0, make_pair(0, 0));
    res[a][b] = make_pair(c[0] - '0', c[2] - '0');
  }
  for (map<string, map<string, pair<int, int> > >::iterator it = res.begin();
       it != res.end(); it++)
    for (map<string, pair<int, int> >::iterator it2 = it->second.begin();
         it2 != it->second.end(); it2++) {
      matchs[it->first]++, matchs[it2->first]++;
      pts[it->first].second.first += it2->second.first,
          pts[it->first].second.second += it2->second.second;
      pts[it2->first].second.first += it2->second.second,
          pts[it2->first].second.second += it2->second.first;
      if (it2->second.first > it2->second.second) {
        pts[it->first].first += 3;
      } else if (it2->second.first < it2->second.second) {
        pts[it2->first].first += 3;
      } else {
        pts[it2->first].first++;
        pts[it->first].first++;
      }
    }
  for (map<string, int>::iterator it = matchs.begin(); it != matchs.end(); it++)
    if (it->first != "BERLAND" && it->second == 2) avv = it->first;
  bool ok = false;
  pts["BERLAND"].first += 3;
  for (int i = 1; i < 29; i++) {
    for (int j = i; j < 29; j++)
      if (check(j, j - i)) {
        cout << j << ":" << j - i << endl;
        ok = true;
        break;
      }
    if (ok) break;
  }
  if (!ok) cout << "IMPOSSIBLE" << endl;
  return 0;
}
