#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, int> puncte, cnt, goluri, rateu;
  int x, y;
  char c1[25], c2[25];
  for (int i = 0; i < 5; i++) {
    scanf("%s%s%d:%d", c1, c2, &x, &y);
    cnt[c1]++;
    cnt[c2]++;
    if (x > y) {
      puncte[c1] += 3;
    }
    if (x < y) {
      puncte[c2] += 3;
    }
    if (x == y) {
      puncte[c1]++;
      puncte[c2]++;
    }
    goluri[c1] += x;
    rateu[c1] += y;
    goluri[c2] += y;
    rateu[c2] += x;
  }
  string czn;
  vector<string> echipe;
  for (auto &s : cnt) {
    echipe.push_back(s.first);
    if (s.second == 2 && s.first != "BERLAND") {
      czn = s.first;
    }
  }
  for (int i = 1; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      int k = i + j;
      goluri["BERLAND"] += k;
      rateu["BERLAND"] += j;
      goluri[czn] += j;
      rateu[czn] += k;
      puncte["BERLAND"] += 3;
      vector<tuple<int, int, int, string>> w;
      for (auto &s : echipe) {
        w.push_back(
            make_tuple(-puncte[s], -goluri[s] + rateu[s], -goluri[s], s));
      }
      sort(w.begin(), w.end());
      if (get<3>(w[0]) == "BERLAND" || get<3>(w[1]) == "BERLAND") {
        printf("%d:%d", k, j);
        return 0;
      }
      puncte["BERLAND"] -= 3;
      goluri["BERLAND"] -= k;
      rateu["BERLAND"] -= j;
      goluri[czn] -= j;
      rateu[czn] -= k;
    }
  }
  printf("IMPOSSIBLE");
  return 0;
}
