#include <bits/stdc++.h>
using namespace std;
const string ber = "BERLAND";
const string fail = "IMPOSSIBLE";
struct team {
  string name;
  int win, t, dif, val;
  team() { win = t = dif = val = 0; }
  bool operator<(const team& A) const {
    return val == A.val
               ? (dif == A.dif ? (win == A.win ? name < A.name : win > A.win)
                               : dif > A.dif)
               : val > A.val;
  }
} num[4], temp[4];
int n;
int find(const string& a) {
  for (int i = 0; i < n; i++)
    if (num[i].name == a) return i;
  num[n++].name = a;
  return n - 1;
}
int main() {
  n = 0;
  for (int i = 0; i < 5; i++) {
    string a, b;
    cin >> a >> b;
    int u = find(a), v = find(b);
    num[u].t++;
    num[v].t++;
    int sa, sb;
    scanf("%d:%d", &sa, &sb);
    num[u].win += sa;
    num[v].win += sb;
    if (sa == sb)
      num[u].val++, num[v].val++;
    else if (sa > sb)
      num[u].val += 3;
    else
      num[v].val += 3;
    num[u].dif += sa - sb;
    num[v].dif += sb - sa;
  }
  int x, y = find(ber);
  num[find(ber)].val += 3;
  for (int i = 0; i < 4; i++)
    if (num[i].t != 3 && num[i].name != ber) x = i;
  swap(x, y);
  for (int i = 0; i < n; i++) {
  }
  int mx = 1000, mv = 1000, _a = -1, _b = -1;
  for (int A = 1; A <= 100; A++)
    for (int B = 0; B < A; B++) {
      for (int i = 0; i < 4; i++) temp[i] = num[i];
      temp[x].win += A;
      temp[x].dif += A - B;
      temp[y].dif += B - A;
      sort(temp, temp + 4);
      if (A == 2 && B == 0) {
      }
      bool flag = 0;
      for (int i = 0; i < 4; i++)
        if (temp[i].name == ber && i < 2) flag = 1;
      if (flag && (mx == A - B ? mv > B : mx > A - B)) {
        mx = A - B;
        mv = B;
        _a = A;
        _b = B;
      }
    }
  if (_a == -1)
    cout << fail << endl;
  else
    cout << _a << ":" << _b << endl;
}
