#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
string teams[10];
int sz = 0;
int score[10];
int br;
int nm[10];
int b2;
int gl[10], pr[10];
int Find(string name) {
  for (int i = 0; i < 10; i++)
    if (!strcmp(teams[i].c_str(), name.c_str())) return i;
  return sz++;
}
void Add(string a, string b, int aa, int bb) {
  if (!strcmp(a.c_str(), "BERLAND")) {
    br = Find(a);
    teams[br] = a;
  }
  if (!strcmp(b.c_str(), "BERLAND")) {
    br = Find(b);
    teams[br] = b;
  }
  int p1, p2;
  p1 = Find(a);
  p2 = Find(b);
  if (aa > bb) {
    score[p1] += 3;
  }
  if (aa < bb) {
    score[p2] += 3;
  }
  if (aa == bb) {
    score[p1]++;
    score[p2]++;
  }
  teams[p1] = a;
  teams[p2] = b;
  nm[p1]++;
  nm[p2]++;
  gl[p1] += aa;
  pr[p1] += bb;
  gl[p2] += bb;
  pr[p2] += aa;
}
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first > b.first) return true;
  if (a.first < b.first) return false;
  int p1, p2;
  p1 = a.second;
  p2 = b.second;
  if (gl[p1] - pr[p1] > gl[p2] - pr[p2]) return true;
  if (gl[p1] - pr[p1] < gl[p2] - pr[p2]) return false;
  if (gl[p1] > gl[p2]) return true;
  if (gl[p1] < gl[p2]) return false;
  return teams[a.second] < teams[b.second];
}
bool Good(int a, int b) {
  gl[br] += a;
  pr[br] += b;
  gl[b2] += b;
  pr[b2] += a;
  if (a > b) {
    score[br] += 3;
  }
  if (a < b) score[b2] += 3;
  if (a == b) {
    score[br]++;
    score[b2]++;
  }
  pair<int, int> sc[10];
  for (int i = 0; i < 4; i++) {
    sc[i].first = score[i];
    sc[i].second = i;
  }
  sort(sc, sc + 4, comp);
  if (a > b) {
    score[br] -= 3;
  }
  if (a < b) score[b2] -= 3;
  if (a == b) {
    score[br]--;
    score[b2]--;
  }
  gl[br] -= a;
  pr[br] -= b;
  gl[b2] -= b;
  pr[b2] -= a;
  if (sc[0].second == br || sc[1].second == br)
    return true;
  else
    return false;
}
int main() {
  char c;
  string t1, t2;
  int tt1, tt2;
  cin >> t1;
  cin >> t2;
  scanf("%d:%d", &tt1, &tt2);
  Add(t1, t2, tt1, tt2);
  cin >> t1;
  cin >> t2;
  scanf("%d:%d", &tt1, &tt2);
  Add(t1, t2, tt1, tt2);
  cin >> t1;
  cin >> t2;
  scanf("%d:%d", &tt1, &tt2);
  Add(t1, t2, tt1, tt2);
  cin >> t1;
  cin >> t2;
  scanf("%d:%d", &tt1, &tt2);
  Add(t1, t2, tt1, tt2);
  cin >> t1;
  cin >> t2;
  scanf("%d:%d", &tt1, &tt2);
  Add(t1, t2, tt1, tt2);
  for (int i = 0; i < 6; i++) {
    if (nm[i] != 3 && i != br) {
      b2 = i;
      break;
    }
  }
  int rx, ry, r;
  r = -1;
  for (int i = 0; i < 1000; i++)
    for (int j = i + 1; j < 1000; j++) {
      if (Good(j, i)) {
        if (r == -1) {
          r = j - i;
          rx = j;
          ry = i;
        }
        if (r > j - i) {
          r = j - i;
          rx = j;
          ry = i;
        }
      }
    }
  if (r == -1)
    printf("IMPOSSIBLE");
  else
    printf("%d:%d", rx, ry);
  return 0;
}
