#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647, maxN = 5, maxL = 1000;
int N;
char Team[maxN][maxL];
struct Score {
  int A, W, L;
} P[maxN];
bool v[maxN][maxN];
int num[maxN], R[maxN];
void setIO(string name) {
  string in = name + ".in";
  string out = name + ".out";
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
}
int strlen(char c[]) {
  for (int i = 0; i < maxL; ++i)
    if (c[i] == 0) return i;
}
int Find(char c[]) {
  int l = strlen(c);
  for (int i = 0; i < N; ++i) {
    bool flag = l == strlen(Team[i]);
    for (int j = 0; j < l; ++j)
      if (Team[i][j] != c[j]) {
        flag = false;
        break;
      }
    if (flag) return i;
  }
  for (int i = 0; i < l; ++i) Team[N][i] = c[i];
  Team[N][l] = 0;
  ++N;
  return N - 1;
}
bool small(char c1[], char c2[]) {
  int l1 = strlen(c1), l2 = strlen(c2);
  for (int i = 0; i < (l1 < l2 ? l1 : l2); ++i) {
    if (c1[i] > c2[i]) return false;
    if (c1[i] < c2[i]) return true;
  }
  if (l1 > l2) return false;
  if (l1 < l2) return true;
}
bool cmp(int a, int b) { return (small(Team[a], Team[b])); }
bool cmp2(int a, int b) {
  if (P[a].A > P[b].A) return true;
  if (P[a].A == P[b].A && P[a].W - P[a].L > P[b].W - P[b].L) return true;
  if (P[a].A == P[b].A && P[a].W - P[a].L == P[b].W - P[b].L && P[a].W > P[b].W)
    return true;
  if (P[a].A == P[b].A && P[a].W - P[a].L == P[b].W - P[b].L &&
      P[a].W == P[b].W && R[a] < R[b])
    return true;
  return false;
}
int main() {
  char t[] = "BERLAND";
  N = 0;
  Find(t);
  int X, Y, a, b;
  memset(v, false, sizeof(v));
  for (int i = 0; i < 5; ++i) {
    char c1[maxL], c2[maxL];
    scanf("%s %s %d:%d\n", c1, c2, &X, &Y);
    a = Find(c1), b = Find(c2);
    if (X < Y) {
      swap(a, b);
      swap(X, Y);
    }
    v[a][b] = v[b][a] = true;
    P[a].W += X, P[a].L += Y, P[b].W += Y, P[b].L += X;
    if (X == Y)
      ++P[a].A, ++P[b].A;
    else
      P[a].A += 3;
  }
  for (int i = 1; i <= 3; ++i)
    if (!v[0][i]) {
      X = 0, Y = i;
      break;
    }
  for (int i = 0; i < 4; ++i) num[i] = i;
  sort(num, num + 4, cmp);
  for (int i = 0; i < 4; ++i) R[num[i]] = i;
  P[0].A += 3;
  int ansX = 1000, ansY = 0;
  for (int x = 0; x < 100; ++x)
    for (int y = 0; y < x; ++y) {
      P[X].W += x, P[X].L += y, P[Y].W += y, P[Y].L += x;
      for (int i = 0; i < 4; ++i) num[i] = i;
      sort(num, num + 4, cmp2);
      P[X].W -= x, P[X].L -= y, P[Y].W -= y, P[Y].L -= x;
      if ((num[0] == 0 || num[1] == 0) &&
          (x - y < ansX - ansY || x - y == ansX - ansY && y < ansY)) {
        ansX = x, ansY = y;
      }
    }
  if (ansX == 1000)
    printf("IMPOSSIBLE\n");
  else
    printf("%d:%d\n", ansX, ansY);
  return 0;
}
