#include <bits/stdc++.h>
#pragma warning(disable : 4786)
using namespace std;
int p[10], g[10], mi[10];
int f[10], ans[10];
string str[12];
bool cmp(int a, int b) {
  if (p[a] == p[b]) {
    if ((g[a] - mi[a]) == (g[b] - mi[b])) {
      if (g[a] == g[b]) {
        return str[a] < str[b];
      }
      return g[a] > g[b];
    }
    return (g[a] - mi[a]) > (g[b] - mi[b]);
  }
  return p[a] > p[b];
}
int main() {
  string name1, name2;
  map<string, int> q;
  q["BERLAND"] = 1;
  str[1] = "BERLAND";
  int id = 2;
  for (int zz = 0; zz < 5; zz++) {
    cin >> name1;
    cin >> name2;
    if (q[name1] == 0) {
      q[name1] = id;
      str[id] = name1;
      id++;
    }
    if (q[name2] == 0) {
      q[name2] = id;
      str[id] = name2;
      id++;
    }
    int x = q[name1], y = q[name2];
    int a, b;
    f[x]++;
    f[y]++;
    scanf("%d:%d", &a, &b);
    g[x] += a;
    mi[x] += b;
    g[y] += b;
    mi[y] += a;
    if (a > b)
      p[x] += 3;
    else if (a < b)
      p[y] += 3;
    else {
      p[x]++;
      p[y]++;
    }
  }
  int i, k;
  for (i = 2; i < id; i++) {
    if (f[i] == 2) k = i;
  }
  int ansx = -1, ansy = -1;
  for (i = 0; i <= 100; i++) {
    for (int j = i + 1; j <= 100; j++) {
      f[k] += i;
      f[1] += j;
      p[1] += 3;
      g[1] += j;
      mi[1] += i;
      g[k] += i;
      mi[k] += j;
      int z;
      for (z = 0; z < 4; z++) ans[z] = z + 1;
      sort(ans, ans + 4, cmp);
      if (ans[0] == 1 || ans[1] == 1) {
        if (ansx == -1 || (ansx - ansy) > (j - i) ||
            (ansx - ansy) == (j - i) && i < ansy) {
          ansx = j;
          ansy = i;
        }
      }
      f[k] -= i;
      f[1] -= j;
      p[1] -= 3;
      g[1] -= j;
      mi[1] -= i;
      g[k] -= i;
      mi[k] -= j;
    }
  }
  if (ansx == -1)
    printf("IMPOSSIBLE\n");
  else
    printf("%d:%d\n", ansx, ansy);
  return 0;
}
