#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, int> points, count, goals, miss;
  int x, y;
  char a[25], b[25];
  for (int i = 0; i < 5; i++) {
    scanf("%s%s%d:%d", a, b, &x, &y);
    count[a]++;
    count[b]++;
    if (x > y) points[a] += 3;
    if (x < y) points[b] += 3;
    if (x == y) {
      points[a]++;
      points[b]++;
    }
    goals[a] += x;
    miss[a] += y;
    goals[b] += y;
    miss[b] += x;
  }
  string at;
  vector<string> teams;
  for (auto &s : count) {
    teams.push_back(s.first);
    if (s.second == 2 && s.first != "BERLAND") {
      at = s.first;
    }
  }
  for (int i = 1; i < 100; i++) {
    for (int k = 0; k < 100; k++) {
      int j = i + k;
      goals["BERLAND"] += j;
      miss["BERLAND"] += k;
      goals[at] += k;
      miss[at] += j;
      points["BERLAND"] += 3;
      vector<tuple<int, int, int, string> > u;
      for (auto &s : teams) {
        u.push_back(make_tuple(-points[s], -goals[s] + miss[s], -goals[s], s));
      }
      sort(u.begin(), u.end());
      if (get<3>(u[0]) == "BERLAND" || get<3>(u[1]) == "BERLAND") {
        printf("%d:%d", j, k);
        return 0;
      }
      points["BERLAND"] -= 3;
      goals["BERLAND"] -= j;
      miss["BERLAND"] -= k;
      goals[at] -= k;
      miss[at] -= j;
    }
  }
  printf("IMPOSSIBLE");
}
