#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
struct Team {
  char name[25];
  int socre;
  int win;
  int lost;
  int num;
} team[4], tmp[4];
int NowTeamNum;
char BERLAND[] = "BERLAND";
void output(Team a[]) {
  cout << endl;
  for (int i = 0; i < 4; i++)
    printf("%s %d %d %d %d\n", a[i].name, a[i].socre, a[i].win, a[i].lost,
           a[i].num);
  cout << endl;
}
int cmp(Team a, Team b) {
  if (a.socre == b.socre) {
    if (a.win - a.lost == b.win - b.lost) {
      if (a.win == b.win) {
        return strcmp(a.name, b.name) < 0;
      }
      return a.win > b.win;
    }
    return a.win - a.lost > b.win - b.lost;
  }
  return a.socre > b.socre;
}
void work(char name[], int win, int lost, Team a[]) {
  int i;
  for (i = 0; i < NowTeamNum; i++) {
    if (!strcmp(a[i].name, name)) {
      a[i].win += win;
      a[i].lost += lost;
      a[i].num++;
      if (win > lost)
        a[i].socre += 3;
      else if (win == lost)
        a[i].socre += 1;
      else
        a[i].socre += 0;
      return;
    }
  }
  strcpy(a[i].name, name);
  a[i].win = win;
  a[i].lost = lost;
  a[i].num = 1;
  if (win > lost)
    a[i].socre = 3;
  else if (win == lost)
    a[i].socre = 1;
  else
    a[i].socre = 0;
  NowTeamNum++;
}
void input() {
  int i, j;
  char s1[25], s2[25], s3[25];
  int win, lost;
  NowTeamNum = 0;
  for (int j = 0; j < 5; j++) {
    scanf("%s%s%s", s1, s2, s3);
    for (win = 0, i = 0; '0' <= s3[i] && s3[i] <= '9'; i++)
      win = win * 10 + s3[i] - '0';
    for (lost = 0, ++i; '0' <= s3[i] && s3[i] <= '9'; i++)
      lost = lost * 10 + s3[i] - '0';
    work(s1, win, lost, team);
    work(s2, lost, win, team);
  }
}
void solve() {
  int X = 2 * N, Y = N, i, j, k;
  bool flag = 0;
  char name[25];
  for (i = 0; i < 4; i++)
    if (team[i].num == 2 && strcmp(team[i].name, BERLAND)) {
      strcpy(name, team[i].name);
      break;
    }
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++) {
      if (i <= j) continue;
      for (k = 0; k < 4; k++) tmp[k] = team[k];
      work(BERLAND, i, j, tmp);
      work(name, j, i, tmp);
      sort(tmp, tmp + 4, cmp);
      for (k = 0; k < 4; k++)
        if (!strcmp(BERLAND, tmp[k].name)) break;
      if (k < 2 && ((i - j < X - Y) || ((i - j == X - Y) && j < Y))) {
        X = i, Y = j;
        flag = 1;
      }
    }
  if (flag)
    printf("%d:%d\n", X, Y);
  else
    printf("IMPOSSIBLE\n");
}
int main() {
  input();
  solve();
  return 0;
}
