#include <bits/stdc++.h>
const bool debug = false;
using namespace std;
long long powmod(long long a, long long b, long long MOD) {
  long long res = 1;
  a %= MOD;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
void buginfo(const char* f, ...) {
  if (!debug) return;
  va_list al;
  va_start(al, f);
  vprintf(f, al);
  va_end(al);
}
int grade[4], goal[4], lost[4], cnt[4];
map<string, int> str2id;
map<int, string> id2str;
bool cmp(const int x, const int y) {
  if (grade[x] != grade[y]) return grade[x] < grade[y];
  if (goal[x] - lost[x] != goal[y] - lost[y])
    return goal[x] - lost[x] < goal[y] - lost[y];
  if (goal[x] != goal[y]) return goal[x] < goal[y];
  string s1 = id2str[x], s2 = id2str[y];
  return s1 > s2;
}
bool cmp2(pair<int, int> p1, pair<int, int> p2) {
  if (p1.first - p1.second != p2.first - p2.second)
    return p1.first - p1.second < p2.first - p2.second;
  return p1.second < p2.second;
}
int getid(string s1) {
  if (str2id.count(s1) > 0) return str2id[s1];
  int m = (int)str2id.size();
  str2id[s1] = m;
  return m;
}
bool check(int bx, int rival, int d1, int d2) {
  grade[bx] += 3;
  goal[bx] += d1;
  lost[rival] += d1;
  goal[rival] += d2;
  lost[bx] += d2;
  int sum = 0;
  for (int i = 0; i < 4; ++i)
    if (i != bx && cmp(i, bx)) ++sum;
  grade[bx] -= 3;
  goal[bx] -= d1;
  lost[rival] -= d1;
  goal[rival] -= d2;
  lost[bx] -= d2;
  return sum >= 2;
}
int main() {
  for (int i = 0; i < 5; ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    int d1, d2;
    scanf("%d:%d", &d1, &d2);
    int x = getid(s1), y = getid(s2);
    id2str[x] = s1, id2str[y] = s2;
    goal[x] += d1, goal[y] += d2;
    lost[y] += d1, lost[x] += d2;
    if (d1 > d2)
      grade[x] += 3;
    else if (d1 < d2)
      grade[y] += 3;
    else
      ++grade[x], ++grade[y];
    ++cnt[x], ++cnt[y];
  }
  int bx = str2id["BERLAND"];
  int rival = 0;
  for (int i = 0; i < 4; ++i)
    if (i != bx && cnt[i] < 3) {
      rival = i;
      break;
    }
  vector<pair<int, int> > vec;
  for (int i = 0; i < 100; ++i)
    for (int j = 0; j < i; ++j)
      if (check(bx, rival, i, j)) {
        vec.push_back(make_pair(i, j));
      }
  if (!vec.empty()) {
    sort((vec).begin(), (vec).end(), cmp2);
    pair<int, int> ans = vec.front();
    printf("%d:%d\n", ans.first, ans.second);
    return 0;
  }
  printf("IMPOSSIBLE\n");
  return 0;
}
