#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
map<string, int> mm;
string val[10] = {};
int get(string &s) {
  if (mm.count(s)) return mm[s];
  int cc = int((mm).size());
  val[cc] = s;
  mm[s] = cc;
  return cc;
}
int sc[10][10] = {};
int a[10] = {};
int nscore[10] = {};
int nzab[10] = {};
int nprop[10] = {};
bool cmp(int i1, int i2) {
  if (nscore[i1] != nscore[i2]) return nscore[i1] > nscore[i2];
  if (nzab[i1] - nprop[i1] != nzab[i2] - nprop[i2])
    return nzab[i1] - nprop[i1] > nzab[i2] - nprop[i2];
  if (nzab[i1] != nzab[i2]) return nzab[i1] > nzab[i2];
  return val[i1] < val[i2];
}
void calc() {
  memset(nscore, 0, sizeof(nscore));
  memset(nzab, 0, sizeof(nzab));
  memset(nprop, 0, sizeof(nprop));
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 4; ++j) {
      if (i == j) continue;
      nzab[i] += sc[i][j];
      nprop[i] += sc[j][i];
      if (sc[i][j] > sc[j][i])
        nscore[i] += 3;
      else if (sc[i][j] == sc[j][i])
        nscore[i] += 1;
    }
  }
}
bool good() {
  calc();
  for (int i = 0; i < 4; ++i) a[i] = i;
  sort(a, a + 4, cmp);
  return a[0] == 0 || a[1] == 0;
}
int main() {
  mm["BERLAND"] = 0;
  val[0] = "BERLAND";
  memset(sc, -1, sizeof(sc));
  for (int i = 0; i < 5; ++i) {
    string s1, s2;
    cin >> s1 >> s2;
    int p1 = get(s1);
    int p2 = get(s2);
    int c1, c2;
    scanf("%d:%d", &c1, &c2);
    sc[p1][p2] = c1;
    sc[p2][p1] = c2;
  }
  const int MAX = 510;
  int opp = 1;
  while (sc[0][opp] != -1) ++opp;
  int bestX = -1;
  int bestY = -1;
  for (int first = 0; first < MAX; ++first)
    for (int second = 0; second < first; ++second) {
      sc[0][opp] = first;
      sc[opp][0] = second;
      if (good()) {
        if (bestX == -1 || first - second < bestX - bestY ||
            first - second == bestX - bestY && second < bestY) {
          bestX = first;
          bestY = second;
        }
      }
    }
  if (bestX == -1)
    printf("IMPOSSIBLE\n");
  else
    printf("%d:%d\n", bestX, bestY);
  return 0;
}
