#include <bits/stdc++.h>
using namespace std;
const double esp = 1e-8;
const int maxn = 1007;
char name[200][200];
int m;
struct node {
  int p, in, out, id;
} a[200];
bool operator<(const node &a, const node &b) {
  if (a.p != b.p)
    return a.p > b.p;
  else if (a.in - a.out != b.in - b.out)
    return (a.in - a.out) > (b.in - b.out);
  else if (a.in != b.in)
    return a.in > b.in;
  else
    return strcmp(name[a.id], name[b.id]) < 0;
}
int find(char *s) {
  for (int i = 1; i <= m; i++)
    if (strcmp(s, name[i]) == 0) return i;
  m++;
  strcpy(name[m], s);
  return m;
}
int v[6] = {0};
int main() {
  char s1[200], s2[200];
  int d1, d2;
  m = 0;
  memset(a, 0, sizeof(a));
  memset(v, 0, sizeof(v));
  for (int t = 1; t <= 5; t++) {
    scanf("%s %s %d:%d", s1, s2, &d1, &d2);
    int h1 = find(s1);
    int h2 = find(s2);
    if (d1 > d2) {
      a[h1].p += 3;
    } else if (d1 == d2) {
      a[h1].p++;
      a[h2].p++;
    } else
      a[h2].p += 3;
    a[h1].in += d1;
    a[h1].out += d2;
    a[h2].in += d2;
    a[h2].out += d1;
    v[h1]++;
    v[h2]++;
    a[h1].id = h1;
    a[h2].id = h2;
  }
  int s = find("BERLAND"), t;
  for (int i = 1; i <= 4; i++)
    if (v[i] < 3 && s != i) t = i;
  node oldh = a[s], oldw = a[t];
  {
    int ans1 = -1, ans2 = -1;
    for (int i = 1; i <= 100; i++)
      for (int j = i; j <= 100; j++) {
        node h = oldh;
        h.p += 3;
        h.in += j;
        h.out += j - i;
        node w = oldw;
        w.in += j - i;
        w.out += j;
        ans1 = j;
        ans2 = j - i;
        int ok = 0;
        for (int i = 1; i <= 4; i++)
          if (a[i] < h && i != s && i != t)
            ok++;
          else if (i == t)
            if (w < h) ok++;
        if (ok < 2) goto end;
      }
  end:;
    if (ans1 == 100 || ans1 == -1)
      printf("IMPOSSIBLE\n");
    else
      printf("%d:%d\n", ans1, ans2);
  }
  return 0;
}
