#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  int c, p, g1, g2;
};
team t[10];
int c = 0;
bool comp(team t1, team t2) {
  if (t1.p > t2.p) return true;
  if (t1.p < t2.p) return false;
  if (t1.g1 - t1.g2 > t2.g1 - t2.g2) return true;
  if (t1.g1 - t1.g2 < t2.g1 - t2.g2) return false;
  if (t1.g1 > t2.g1) return true;
  if (t1.g1 < t2.g1) return false;
  if (t1.name < t2.name) return true;
  ;
  return false;
}
int find(string name) {
  for (int i = 0; i < c; i++)
    if (name == t[i].name) return i;
  t[c].name = name;
  t[c].c = t[c].p = t[c].g1 = t[c++].g2 = 0;
  return c - 1;
}
int main() {
  for (int i = 0; i < 5; i++) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    int g1 = s3[0] - '0', g2 = s3[2] - '0', t1 = find(s1), t2 = find(s2);
    t[t1].g1 += g1;
    t[t1].g2 += g2;
    t[t2].g1 += g2;
    t[t2].g2 += g1;
    t[t1].c++;
    t[t2].c++;
    if (g1 == g2) {
      t[t1].p++;
      t[t2].p++;
    } else if (g1 > g2)
      t[t1].p += 3;
    else
      t[t2].p += 3;
  }
  string name2;
  for (int i = 0; i < 4; i++)
    if (t[i].c == 2 && t[i].name != "BERLAND") name2 = t[i].name;
  t[find("BERLAND")].p += 3;
  int ans1 = -1, ans2;
  for (int i = 1; i <= 100; i++)
    for (int j = i - 1; j >= 0; j--) {
      team nt[10];
      for (int k = 0; k < 4; k++) nt[k] = t[k];
      int nt1 = find("BERLAND"), nt2 = find(name2);
      t[nt1].g1 += i;
      t[nt1].g2 += j;
      t[nt2].g1 += j;
      t[nt2].g2 += i;
      sort(t, t + 4, &comp);
      if (find("BERLAND") < 2)
        if (ans1 == -1 || i - j < ans1 - ans2 ||
            (i - j == ans1 - ans2 && j < ans2)) {
          ans1 = i;
          ans2 = j;
        }
      for (int k = 0; k < 4; k++) t[k] = nt[k];
    }
  if (ans1 == -1)
    cout << "IMPOSSIBLE";
  else
    cout << ans1 << ":" << ans2;
}
