#include <bits/stdc++.h>
using namespace std;
struct team {
  char name[25];
  int points, goals, missed, playedGames;
};
team v[6];
bool compare(const team &one, const team &two) {
  if (one.points != two.points) return one.points > two.points;
  if (one.goals - one.missed != two.goals - two.missed)
    return one.goals - one.missed > two.goals - two.missed;
  if (one.goals != two.goals) return one.goals > two.goals;
  return strcmp(one.name, two.name) < 0 ? true : false;
}
int main() {
  char first[25], second[25];
  int s_first, s_second;
  int teams = 0;
  for (int i = 0; i < 5; ++i) {
    scanf("%s %s %d:%d", first, second, &s_first, &s_second);
    int k;
    for (k = 0; k < teams; ++k)
      if (!strcmp(v[k].name, first)) break;
    if (k < teams) {
      v[k].goals += s_first, v[k].missed += s_second, ++v[k].playedGames;
    } else {
      strcpy(v[teams].name, first);
      v[teams].goals = s_first;
      v[teams].missed = s_second;
      v[teams++].playedGames = 1;
    }
    if (s_first > s_second)
      v[k].points += 3;
    else if (s_first == s_second)
      v[k].points += 1;
    for (k = 0; k < teams; ++k)
      if (!strcmp(v[k].name, second)) break;
    if (k < teams)
      v[k].goals += s_second, v[k].missed += s_first, ++v[k].playedGames;
    else {
      strcpy(v[teams].name, second);
      v[teams].goals = s_second;
      v[teams].missed = s_first;
      v[teams++].playedGames = 1;
    }
    if (s_first < s_second)
      v[k].points += 3;
    else if (s_first == s_second)
      v[k].points += 1;
  }
  sort(v, v + teams, compare);
  int berland, opponent;
  for (int i = 0; i < teams; ++i) {
    if (!strcmp(v[i].name, "BERLAND"))
      berland = i;
    else if (v[i].playedGames == 2)
      opponent = i;
  }
  if (v[1].points - v[berland].points > 3)
    printf("IMPOSSIBLE\n");
  else {
    int x;
    int y;
    v[berland].points += 3;
    int berGoals = v[berland].goals;
    int berMiss = v[berland].missed;
    int oppGoals = v[opponent].goals;
    int oppMiss = v[opponent].missed;
    int mindiff = 2000000000;
    int miny = 2000000000;
    int minx;
    for (x = 0; x < 100; x++)
      for (y = 0; y < x; y++) {
        for (int i = 0; i < teams; ++i) {
          if (!strcmp(v[i].name, "BERLAND"))
            berland = i;
          else if (v[i].playedGames == 2)
            opponent = i;
        }
        v[berland].goals = berGoals + x;
        v[berland].missed = berMiss + y;
        v[opponent].goals = oppGoals + y;
        v[opponent].missed = oppMiss + x;
        sort(v, v + teams, compare);
        for (int i = 0; i < teams; ++i) {
          if (!strcmp(v[i].name, "BERLAND"))
            berland = i;
          else if (v[i].playedGames == 2)
            opponent = i;
        }
        if (berland <= 1) {
          if (x - y < mindiff || (x - y == mindiff && y < miny)) {
            mindiff = x - y;
            minx = x;
            miny = y;
          }
        }
      }
    printf("%d:%d\n", minx, miny);
  }
  return (0);
}
