#include <bits/stdc++.h>
using namespace std;
namespace Work {
char name[6][30];
struct Team {
  int soc, goal, miss, matches, id;
  Team() { soc = goal = miss = matches = id = 0; }
  int cmp(const Team& a) const {
    if (a.soc != soc) return a.soc - soc;
    if (a.goal - a.miss != goal - miss)
      return (a.goal - a.miss) - (goal - miss);
    if (a.goal != goal) return a.goal - goal;
    return strcmp(name[id], name[a.id]);
  }
  bool operator<(const Team& a) const { return cmp(a) < 0; }
  bool operator>(const Team& a) const { return cmp(a) > 0; }
  bool operator<=(const Team& a) const { return cmp(a) <= 0; }
  bool operator>=(const Team& a) const { return cmp(a) >= 0; }
  bool operator==(const Team& a) const { return cmp(a) == 0; }
} t[6], tt[6];
int nname = 0;
int getid(const char* str) {
  for (int i = 0; i < nname; i++)
    if (strcmp(name[i], str) == 0) return i;
  strcpy(name[nname], str);
  nname++;
  return nname - 1;
}
void solve(FILE* fin, FILE* fout) {
  for (int i = 0; i < 5; i++) {
    char t1[30], t2[30], buf[10];
    fscanf(fin, "%s %s %s", t1, t2, buf);
    int s1 = buf[0] - '0';
    int s2 = buf[2] - '0';
    int id1 = getid(t1);
    int id2 = getid(t2);
    if (s1 == s2) {
      t[id1].soc++;
      t[id2].soc++;
    } else if (s1 < s2) {
      t[id2].soc += 3;
    } else
      t[id1].soc += 3;
    t[id1].matches++;
    t[id2].matches++;
    t[id1].goal += s1;
    t[id1].miss += s2;
    t[id2].goal += s2;
    t[id2].miss += s1;
  }
  for (int i = 0; i < 6; i++) t[i].id = i;
  int berland = getid("BERLAND");
  int opp;
  for (int i = 0; i < 6; i++)
    if (i != berland && t[i].matches == 2) opp = i;
  for (int dt = 1; dt <= 2000; dt++)
    for (int y = 0; y <= 2000; y++) {
      int x = y + dt;
      for (int i = 0; i < 6; i++) tt[i] = t[i];
      tt[berland].goal += x;
      tt[berland].miss += y;
      tt[berland].soc += 3;
      tt[opp].goal += y;
      tt[opp].miss += x;
      tt[opp].soc += 0;
      sort(tt, tt + 6);
      if (tt[0].id == berland || tt[1].id == berland) {
        fprintf(fout, "%d:%d", x, y);
        return;
      }
    }
  fprintf(fout, "IMPOSSIBLE");
  return;
}
}  // namespace Work
int main() {
  Work::solve(stdin, stdout);
  return 0;
}
