#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int Days[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int read() {
  int ans = 0;
  bool f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ch = getchar();
  return f ? ans : -ans;
}
map<string, int> tot, jinqiu, shuqiu, cnt;
vector<string> team;
bool cmp(string a, string b) {
  if (tot[a] > tot[b]) return 1;
  if (tot[a] < tot[b]) return 0;
  if (jinqiu[a] - shuqiu[a] > jinqiu[b] - shuqiu[b]) return 1;
  if (jinqiu[a] - shuqiu[a] < jinqiu[b] - shuqiu[b]) return 0;
  if (jinqiu[a] > jinqiu[b]) return 1;
  if (jinqiu[a] < jinqiu[b]) return 0;
  return (a < b);
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 5; i++) {
    char a[30], b[30];
    int x, y;
    scanf("%s %s %d:%d", a, b, &x, &y);
    cnt[a]++, cnt[b]++;
    if (x > y) tot[a] += 3;
    if (x == y) tot[a]++, tot[b]++;
    if (x < y) tot[b] += 3;
    jinqiu[a] += x;
    jinqiu[b] += y;
    shuqiu[a] += y;
    shuqiu[b] += x;
  }
  string enemy;
  for (map<string, int>::iterator it = cnt.begin(); it != cnt.end(); ++it) {
    team.push_back((it->first));
    if ((it->second) == 2 && (it->first) != "BERLAND") enemy = (it->first);
  }
  for (int i = 1; i < 100; i++)
    for (int j = 0; j < 100; j++) {
      int p = i + j;
      jinqiu["BERLAND"] += p;
      shuqiu["BERLAND"] += j;
      tot["BERLAND"] += 3;
      jinqiu[enemy] += j;
      shuqiu[enemy] += p;
      sort(team.begin(), team.end(), cmp);
      if (team[0] == "BERLAND" || team[1] == "BERLAND") {
        printf("%d:%d", p, j);
        return 0;
      }
      jinqiu["BERLAND"] -= p;
      shuqiu["BERLAND"] -= j;
      jinqiu[enemy] -= j;
      shuqiu[enemy] -= p;
      tot["BERLAND"] -= 3;
    }
  printf("IMPOSSIBLE");
  return 0;
}
