#include <bits/stdc++.h>
using namespace std;
const char T[25] = "BERLAND";
bool g[10][10];
struct team {
  char name[25];
  int point;
  int diff;
  int score;
  int miss;
} a[10];
int tot;
int cmp(struct team x, struct team y) {
  if (x.point == y.point) {
    if (x.diff == y.diff) {
      if (x.score == y.score) return strcmp(x.name, y.name) < 0;
      return x.score > y.score;
    }
    return x.diff > y.diff;
  }
  return x.point > y.point;
}
int search_team(char *str) {
  for (int i = 0; i < tot; i++)
    if (!strcmp(str, a[i].name)) return i;
  strcpy(a[tot].name, str);
  return tot++;
}
void fun(int pa, int pb) {
  if (a[1].point - a[pa].point > 3) {
    printf("IMPOSSIBLE\n");
    return;
  }
  if (a[1].point - a[pa].point < 3) {
    printf("1:0\n");
    return;
  }
  int D = a[1].diff - a[pa].diff;
  if (D <= 0) {
    printf("1:0\n");
    return;
  }
  int k, d, p, q;
  struct team b[10];
  for (d = (D + 1) / 2;; d++)
    for (p = d;; p++) {
      q = p - d;
      for (k = 0; k < 4; k++) b[k] = a[k];
      b[pa].diff += d;
      b[pa].score += p;
      b[pa].miss += q;
      b[pa].point += 3;
      b[pb].diff -= d;
      b[pb].score += q;
      b[pb].miss += p;
      sort(b, b + 4, cmp);
      for (k = 0; k < 4; k++)
        if (!strcmp(b[k].name, T)) break;
      if (k <= 1) {
        printf("%d:%d\n", p, q);
        return;
      }
      if (b[k].diff < b[1].diff) break;
    }
}
void solve() {
  int x, y;
  char temp[25], teama[25], teamb[25];
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (i != j && !g[i][j]) {
        x = i;
        y = j;
        break;
      }
  strcpy(teama, a[x].name);
  strcpy(teamb, a[y].name);
  if (!strcmp(teamb, T)) {
    strcpy(temp, teama);
    strcpy(teama, teamb);
    strcpy(teamb, temp);
  }
  sort(a, a + 4, cmp);
  int pa = search_team(teama);
  int pb = search_team(teamb);
  if (pa <= 1) {
    printf("1:0\n");
    return;
  }
  fun(pa, pb);
}
int main() {
  tot = 0;
  memset(a, 0, sizeof(a));
  memset(g, false, sizeof(g));
  for (int i = 1; i <= 5; i++) {
    char s1[25], s2[25];
    int p, q;
    scanf("%s%s%d:%d", s1, s2, &p, &q);
    int x = search_team(s1);
    a[x].score += p;
    a[x].miss += q;
    a[x].diff = a[x].score - a[x].miss;
    int y = search_team(s2);
    a[y].score += q;
    a[y].miss += p;
    a[y].diff = a[y].score - a[y].miss;
    if (p > q)
      a[x].point += 3;
    else if (p == q) {
      a[x].point += 1;
      a[y].point += 1;
    } else
      a[y].point += 3;
    g[x][y] = g[y][x] = true;
  }
  solve();
  return 0;
}
