#include <bits/stdc++.h>
using namespace std;
string s1, s2, doi[10];
map<string, int> m;
int x, y, sl, diem[10], thang[10], thua[10], tran[10], t, k;
char kl;
int tim(string s) {
  if (m[s]) return m[s];
  m[s] = ++sl;
  doi[sl] = s;
  return sl;
}
bool cmp(int x, int y) {
  if (diem[x] != diem[y]) return diem[x] > diem[y];
  if (thang[x] - thua[x] != thang[y] - thua[y])
    return thang[x] - thua[x] > thang[y] - thua[y];
  if (thang[x] != thang[y]) return thang[x] > thang[y];
  return doi[x] < doi[y];
}
bool kt() {
  int p[10];
  for (int i = 0; i <= 5; i++) p[i] = i + 1;
  sort(p, p + 6, cmp);
  return p[0] == k || p[1] == k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  for (int i = 0; i <= 4; i++) {
    cin >> s1 >> s2 >> x >> kl >> y;
    int t1 = tim(s1), t2 = tim(s2);
    if (x > y) diem[t1] += 3;
    if (x < y) diem[t2] += 3;
    if (x == y) diem[t1]++, diem[t2]++;
    thang[t1] += x;
    thua[t1] += y;
    thang[t2] += y;
    thua[t2] += x;
    tran[t1]++, tran[t2]++;
  }
  k = m["BERLAND"];
  for (int i = 1; i <= 6; i++)
    if (i != k && tran[i] == 2) t = i;
  diem[k] += 3;
  for (int x = 1; x < 200; x++)
    for (int i = 0; i < 200; i++) {
      thang[k] += i + x;
      thua[k] += i;
      thang[t] += i;
      thua[t] += i + x;
      if (kt()) {
        cout << i + x << ":" << i;
        return 0;
      }
      thang[k] -= i + x;
      thua[k] -= i;
      thang[t] -= i;
      thua[t] -= i + x;
    }
  cout << "IMPOSSIBLE";
  return 0;
}
