#include <bits/stdc++.h>
using namespace std;
struct team {
  int p, a, b;
  string s;
};
map<string, int> h;
string name[10];
int n;
int ma[10][10], cnt[10];
vector<team> v;
bool cmp(const team &a, const team &b) {
  if (a.p != b.p) return a.p > b.p;
  if (a.a - a.b != b.a - b.b) return a.a - a.b > b.a - b.b;
  if (a.a != b.a) return a.a > b.a;
  return a.s < b.s;
}
bool isok() {
  v.clear();
  for (int i = 1; i <= n; i++) {
    team t;
    t.p = t.a = t.b = 0;
    t.s = name[i];
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      t.a += ma[i][j];
      t.b += ma[j][i];
      if (ma[i][j] > ma[j][i])
        t.p += 3;
      else if (ma[i][j] == ma[j][i])
        t.p += 1;
    }
    v.push_back(t);
  }
  sort(v.begin(), v.end(), cmp);
  if (v[0].s == "BERLAND" || v[1].s == "BERLAND") return true;
  return false;
}
int main() {
  memset(ma, -1, sizeof(ma));
  for (int i = 0; i < 5; i++) {
    string a, b;
    int x, y, c, d;
    cin >> a >> b;
    scanf("%d:%d", &c, &d);
    if (h[a] == 0) h[a] = ++n;
    x = h[a];
    if (h[b] == 0) h[b] = ++n;
    y = h[b];
    name[x] = a;
    name[y] = b;
    ma[x][y] = c;
    ma[y][x] = d;
    cnt[x]++;
    cnt[y]++;
  }
  int a = h["BERLAND"], b;
  for (int i = 1; i <= n; i++)
    if (i != a && cnt[i] == 2) b = i;
  bool flag = 0;
  for (int d = 1; !flag && d < 100; d++)
    for (int i = d; !flag && i < 100; i++) {
      ma[a][b] = i, ma[b][a] = i - d;
      if (isok()) flag = 1;
    }
  if (flag)
    printf("%d:%d\n", ma[a][b], ma[b][a]);
  else
    puts("IMPOSSIBLE");
}
