#include <bits/stdc++.h>
using namespace std;
int n, point[10], dif[10], score[109];
int game[10], opp;
string s[10];
map<string, int> mp;
bool bigger(int x, int y) {
  if (point[x] > point[y]) return 1;
  if (point[x] == point[y]) {
    if (dif[x] > dif[y]) return 1;
    if (dif[x] == dif[y]) {
      if (score[x] > score[y]) return 1;
      if (score[x] == score[y]) return s[x] < s[y];
    }
  }
  return 0;
}
int main() {
  mp["BERLAND"] = 2;
  s[2] = "BERLAND";
  int cnt = 0;
  for (long long i = 1; i <= 5; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    if (!mp[s1]) cnt += 1 + (cnt == 1), mp[s1] = cnt, s[cnt] = s1;
    if (!mp[s2]) cnt += 1 + (cnt == 1), mp[s2] = cnt, s[cnt] = s2;
    int u, v;
    scanf("%d:%d", &u, &v);
    if (u > v)
      point[mp[s1]] += 3;
    else if (u < v)
      point[mp[s2]] += 3;
    else
      point[mp[s1]]++, point[mp[s2]]++;
    dif[mp[s1]] += u - v, dif[mp[s2]] += v - u;
    score[mp[s1]] += u, score[mp[s2]] += v;
    game[mp[s1]]++, game[mp[s2]]++;
  }
  for (long long i = 1; i <= 4; i++)
    if (game[i] < 3 && i != 2) opp = i;
  point[2] += 3;
  int big_ = 0;
  for (long long i = 1; i <= 4; i++)
    if (point[i] > point[2]) big_++;
  if (big_ >= 2) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  int ans = 0;
  while (1) {
    dif[2]++, score[2]++;
    dif[opp]--;
    ans++;
    for (long long i = 0; i <= 1000; i++) {
      score[2] += i, score[opp] += i;
      int now = 0;
      for (long long i = 1; i <= 4; i++)
        if (bigger(i, 2)) now++;
      if (now <= 1) {
        cout << ans + i << ':' << i << endl;
        return 0;
      }
      score[2] -= i, score[opp] -= i;
    }
  }
  return 0;
}
