#include <bits/stdc++.h>
using namespace std;
struct st {
  string name = "null";
  int point = 0, scored = 0, missed = 0, played = 0;
} tem[4];
int index_of(string name) {
  for (int i = 0; i < 4; i++)
    if (name == tem[i].name) return i;
  for (int i = 0; i < 4; i++)
    if (tem[i].name == "null") {
      tem[i].name = name;
      return i;
    }
}
bool cmp(const st &a, const st &b) {
  if (a.point > b.point)
    return true;
  else if (a.point == b.point) {
    if ((a.scored - a.missed) > (b.scored - b.missed))
      return true;
    else if ((a.scored - a.missed) == (b.scored - b.missed)) {
      if (a.scored > b.scored)
        return true;
      else if (a.scored == b.scored)
        return a.name < b.name;
    }
  }
  return false;
}
void Print() {
  for (int i = 0; i < 4; i++) {
    cout << tem[i].name << " " << tem[i].point << " " << tem[i].scored << " "
         << tem[i].missed << endl;
  }
}
int getOp(int idb) {
  for (int i = 0; i < 4; i++) {
    if (i != idb && tem[i].played == 2) {
      return i;
    }
  }
}
int main() {
  int idx1, idx2, g1, g2, idb, idop;
  string nm1, nm2, ber = "BERLAND", op;
  for (int i = 0; i < 5; i++) {
    cin >> nm1 >> nm2;
    scanf("%d:%d", &g1, &g2);
    idx1 = index_of(nm1);
    idx2 = index_of(nm2);
    if (g1 > g2) tem[idx1].point += 3;
    if (g1 < g2) tem[idx2].point += 3;
    if (g1 == g2) tem[idx1].point++, tem[idx2].point++;
    tem[idx1].scored += g1;
    tem[idx2].scored += g2;
    tem[idx1].missed += g2;
    tem[idx2].missed += g1;
    tem[idx1].played++;
    tem[idx2].played++;
  }
  sort(tem, tem + 4, cmp);
  idb = index_of(ber);
  idop = getOp(idb);
  op = tem[idop].name;
  int X = -1, Y = -1;
  for (int x = 900; x >= 1; x--) {
    tem[idb].point += 3;
    tem[idb].scored += x;
    for (int y = 0; y < x; y++) {
      tem[idb].missed += y;
      tem[idop].scored += y;
      tem[idop].missed += x;
      sort(tem, tem + 4, cmp);
      if (tem[0].name == ber || tem[1].name == ber) {
        if (X == -1)
          X = x, Y = y;
        else if ((x - y) < (X - Y))
          X = x, Y = y;
        else if ((x - y) == (X - Y) && y < Y)
          X = x, Y = y;
      }
      idb = index_of(ber);
      idop = index_of(op);
      tem[idop].scored -= y;
      tem[idop].missed -= x;
      tem[idb].missed -= y;
    }
    idb = index_of(ber);
    tem[idb].point -= 3;
    tem[idb].scored -= x;
  }
  if (X == -1)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << X << ":" << Y << endl;
  return 0;
}
