#include <bits/stdc++.h>
using namespace std;
struct Team {
  string name;
  int p, x, y;
};
Team *t = new Team[4], *tt = new Team[4];
int bp = -1, ep = -1, cnt = 0, ts[4] = {0, 0, 0, 0};
int lbx, lby, lex, ley;
bool gr(const Team a, const Team b) {
  return a.p > b.p ||
         a.p == b.p && ((a.x - a.y) > (b.x - b.y) ||
                        (a.x - a.y) == (b.x - b.y) &&
                            (a.x > b.x || a.x == b.x && a.name < b.name));
}
int main() {
  for (int i = 0; i < 5; ++i) {
    string a, b;
    int x, y;
    bool aok = false, bok = false;
    cin >> a >> b;
    scanf(" %d:%d", &x, &y);
    for (int j = 0; j < 4; ++j)
      if (a == t[j].name) {
        ts[j]++;
        t[j].p += x > y ? 3 : x == y ? 1 : 0;
        t[j].x += x;
        t[j].y += y;
        aok = true;
      } else if (b == t[j].name) {
        ts[j]++;
        t[j].p += y > x ? 3 : x == y ? 1 : 0;
        t[j].x += y;
        t[j].y += x;
        bok = true;
      }
    if (!aok) {
      t[cnt++].name = a;
      if (a == "BERLAND") bp = cnt - 1;
      ts[cnt - 1] = 1;
      t[cnt - 1].p = x > y ? 3 : x == y ? 1 : 0;
      t[cnt - 1].x = x;
      t[cnt - 1].y = y;
    }
    if (!bok) {
      t[cnt++].name = b;
      if (b == "BERLAND") bp = cnt - 1;
      ts[cnt - 1] = 1;
      t[cnt - 1].p = y > x ? 3 : x == y ? 1 : 0;
      t[cnt - 1].x = y;
      t[cnt - 1].y = x;
    }
  }
  for (int i = 0; i < 4; ++i)
    if (ts[i] == 2 && i != bp) ep = i;
  t[bp].p += 3;
  for (int d = 1; d < 100; ++d)
    for (int y = 0; y < 100; ++y) {
      for (int i = 0; i < 4; ++i) tt[i] = t[i];
      tt[bp].x += d + y;
      tt[bp].y += y;
      tt[ep].x += y;
      tt[ep].y += d + y;
      sort(tt, tt + 4, gr);
      if (tt[0].name == "BERLAND" || tt[1].name == "BERLAND") {
        cout << d + y << ":" << y << endl;
        return 0;
      }
    }
  cout << "IMPOSSIBLE\n";
  return 0;
}
