#include <bits/stdc++.h>
const int inf = ~0U >> 1;
using namespace std;
char berland[8] = "BERLAND";
struct ball {
  char name[21];
  int score, Get, Diff;
  bool operator<(const ball &o) const {
    if (score != o.score) return score > o.score;
    if (Diff != o.Diff) return Diff > o.Diff;
    if (Get != o.Get) return Get > o.Get;
    for (int i = 0; i < min(strlen(name), strlen(o.name)); i++)
      if (o.name[i] != name[i]) return name[i] < o.name[i];
    return strlen(name) < strlen(o.name);
  }
} a[5], Tmp[5];
bool equal(char *a, char *b) {
  if (strlen(a) != strlen(b)) return false;
  for (int i = 0; i < strlen(a); i++)
    if (a[i] != b[i]) return false;
  return true;
}
int C[5][100];
int cnt;
int LookUp(char *A) {
  for (int i = 0; i < cnt; i++)
    if (equal(A, a[i + 1].name)) return i + 1;
  return 0;
}
void Do(int no, int x, int y) {
  if (x > y)
    a[no].score += 3;
  else if (x == y)
    a[no].score += 1;
  a[no].Get += x;
  a[no].Diff += (x - y);
}
bool vis[100][100];
int main() {
  int ber;
  char a1[21], a2[21], t;
  int x1, x2;
  for (int i = 0; i < 5; i++) {
    cin >> a1 >> a2 >> x1 >> t >> x2;
    if (LookUp(a1))
      Do(LookUp(a1), x1, x2);
    else {
      memcpy(a[++cnt].name, a1, sizeof a1);
      Do(cnt, x1, x2);
    }
    if (LookUp(a2))
      Do(LookUp(a2), x2, x1);
    else {
      memcpy(a[++cnt].name, a2, sizeof a2);
      Do(cnt, x2, x1);
    }
    vis[LookUp(a1)][LookUp(a2)] = true;
    vis[LookUp(a2)][LookUp(a1)] = true;
  }
  int tx = LookUp(berland), ty;
  for (ty = 1; ty <= 4; ty++)
    if (tx != ty && !vis[tx][ty]) break;
  char ttx[21], tty[21];
  memcpy(ttx, a[tx].name, sizeof ttx);
  memcpy(tty, a[ty].name, sizeof tty);
  sort(a + 1, a + 5);
  int x, y;
  for (x = 1; x <= 4; x++)
    if (equal(ttx, a[x].name)) break;
  for (y = 1; y <= 4; y++)
    if (equal(tty, a[y].name)) break;
  if (a[x].score + 3 < a[2].score) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  int ansx, ansy, jk = 0, er = 0, sub = inf;
  bool chan = false;
  for (int sx = 0; sx <= 100; sx++)
    for (int sy = 0; sy <= sx; sy++) {
      Do(x, sx, sy);
      Do(y, sy, sx);
      sort(a + 1, a + 5);
      tx = x;
      ty = y;
      for (x = 1; x <= 4; x++)
        if (equal(ttx, a[x].name)) break;
      for (y = 1; y <= 4; y++)
        if (equal(tty, a[y].name)) break;
      if (sx > sy && x <= 2 && (sx - sy < sub || sx - sy == sub && sy < ansy)) {
        jk = er = 1;
        ansx = sx;
        ansy = sy;
        sub = sx - sy;
        chan = true;
      }
      if (sx > sy)
        a[x].score -= 3;
      else if (sx == sy)
        a[x].score -= 1;
      a[x].Get -= sx;
      a[x].Diff -= (sx - sy);
      if (sx < sy)
        a[y].score -= 3;
      else if (sx == sy)
        a[y].score -= 1;
      a[y].Get -= sy;
      a[y].Diff -= (sy - sx);
      sort(a + 1, a + 5);
      x = tx;
      y = ty;
    }
  if (chan && jk && er)
    printf("%d:%d\n", ansx, ansy);
  else
    cout << "IMPOSSIBLE\n";
}
