#include <bits/stdc++.h>
using namespace std;
typedef struct {
  char name[30];
  int score;
  int bescored;
  int point;
  int matches;
  int id;
} team;
int findTeamId(team* T, char* s) {
  for (int i = 0; i < 4; i++) {
    if (strcmp(T[i].name, s) == 0) {
      return i;
    }
  }
  return -1;
}
int findTeamById(team* T, int id) {
  for (int i = 0; i < 4; i++) {
    if (T[i].id == id) return i;
  }
  return -1;
}
int mycompare(const void* b, const void* a) {
  team* ta = (team*)a;
  team* tb = (team*)b;
  if (ta->point > tb->point)
    return 1;
  else if (ta->point < tb->point)
    return -1;
  else {
    if (ta->score - ta->bescored > tb->score - tb->bescored)
      return 1;
    else if (ta->score - ta->bescored < tb->score - tb->bescored)
      return -1;
    else {
      if (ta->score > tb->score)
        return 1;
      else if (ta->score < tb->score)
        return -1;
      else {
        return strcmp(tb->name, ta->name);
      }
    }
  }
}
int main() {
  team T[4];
  int cn = 0;
  char s[30];
  int n = 0;
  char ch;
  for (int i = 0; i < 4; i++)
    T[i].score = T[i].bescored = T[i].point = T[i].matches = 0;
  for (int i = 0; i < 5; i++) {
    ch = '!';
    n = 0;
    while (ch != ' ') {
      ch = getchar();
      if (ch != ' ') s[n++] = ch;
    }
    s[n] = 0;
    int tid1 = findTeamId(T, s);
    if (tid1 == -1) {
      tid1 = cn;
      strcpy(T[cn].name, s);
      T[cn].id = tid1;
      cn++;
    }
    ch = '!';
    n = 0;
    while (ch != ' ') {
      ch = getchar();
      if (ch != ' ') s[n++] = ch;
    }
    s[n] = 0;
    int tid2 = findTeamId(T, s);
    if (tid2 == -1) {
      tid2 = cn;
      strcpy(T[cn].name, s);
      T[cn].id = tid2;
      cn++;
    }
    int score1 = getchar() - '0';
    getchar();
    int score2 = getchar() - '0';
    getchar();
    T[tid1].score += score1;
    T[tid1].bescored += score2;
    T[tid2].score += score2;
    T[tid2].bescored += score1;
    if (score1 > score2) {
      T[tid1].point += 3;
    } else if (score1 < score2) {
      T[tid2].point += 3;
    } else {
      T[tid1].point += 1;
      T[tid2].point += 1;
    }
    T[tid1].matches++;
    T[tid2].matches++;
  }
  char BERLAND[8] = "BERLAND";
  int tid = findTeamId(T, BERLAND);
  int berlandId = tid;
  int otherId = 0;
  for (int i = 0; i < 4; i++) {
    if (T[i].matches == 2 && T[i].id != berlandId) {
      otherId = i;
      break;
    }
  }
  int S = -1, BS = -1;
  int m = 999999;
  int my = 999999;
  for (int s = 1; s < 60; s++) {
    for (int bs = 0; bs < s; bs++) {
      int tid1 = findTeamById(T, berlandId);
      int tid2 = findTeamById(T, otherId);
      T[tid1].score += s;
      T[tid1].bescored += bs;
      T[tid2].score += bs;
      T[tid2].bescored += s;
      T[tid1].point += 3;
      qsort(T, 4, sizeof(team), mycompare);
      tid1 = findTeamById(T, berlandId);
      tid2 = findTeamById(T, otherId);
      if (tid1 <= 1) {
        if (s - bs < m) {
          m = s - bs;
          S = s;
          BS = bs;
          my = bs;
        } else if (s - bs == m) {
          if (bs < my) {
            S = s;
            BS = bs;
            my = bs;
          }
        }
      }
      T[tid1].score -= s;
      T[tid1].bescored -= bs;
      T[tid2].score -= bs;
      T[tid2].bescored -= s;
      T[tid1].point -= 3;
    }
  }
  if (S == -1) {
    printf("IMPOSSIBLE\n");
  } else {
    printf("%d:%d\n", S, BS);
  }
}
