#include <bits/stdc++.h>
using namespace std;
map<string, int> ss;
string backss[4];
string games1[5][2];
int games[5][2];
int gamescores[5][2];
int main() {
  while (cin >> games1[0][0]) {
    for (int i = 0; i < 5; i++) {
      if (i) cin >> games1[i][0];
      char ch;
      cin >> games1[i][1] >> gamescores[i][0] >> ch >> gamescores[i][1];
      assert(ch == ':');
    }
    ss.clear();
    int n = 0;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 2; j++)
        if (!ss.count(games1[i][j]))
          ss[games1[i][j]] = n, backss[n] = games1[i][j], n++;
    assert(n == 4);
    if (ss["BERLAND"]) {
      swap(backss[0], backss[ss["BERLAND"]]);
      for (int i = 0; i < 4; i++) ss[backss[i]] = i;
    }
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 2; j++) games[i][j] = ss[games1[i][j]];
    int score[4] = {0, 0, 0, 0};
    int diff[4] = {0, 0, 0, 0};
    int goals[4] = {0, 0, 0, 0};
    int pos;
    {
      int cnt[4] = {0, 0, 0, 0};
      for (int i = 0; i < 5; i++)
        for (int j = 0; j < 2; j++) {
          diff[games[i][j]] += gamescores[i][j] - gamescores[i][!j];
          goals[games[i][j]] += gamescores[i][j];
          cnt[games[i][j]]++;
          if (gamescores[i][j] > gamescores[i][!j]) score[games[i][j]] += 3;
          if (gamescores[i][j] == gamescores[i][!j]) score[games[i][j]] += 1;
        }
      score[0] += 3;
      pos = 1;
      while (cnt[pos] == 3) pos++;
      assert(cnt[pos] == 2);
    }
    int cntimp = 0;
    for (int i = 1; i < 4; i++)
      if (score[i] > score[0]) cntimp++;
    if (cntimp >= 2) {
      printf("IMPOSSIBLE\n");
      continue;
    }
    int cnt = 4;
    bool alife[4] = {1, 1, 1, 1};
    for (int i = 1; i < 4; i++)
      if (score[i] < score[0]) alife[i] = 0, cnt--;
    for (int difn = 1;; difn++) {
      assert(difn < 1000);
      diff[0]++;
      goals[0]++;
      diff[pos]--;
      for (int i = 1; i < 4; i++)
        if (alife[i] && (score[i] == score[0]) && diff[i] < diff[0])
          alife[i] = 0, cnt--;
      if (cnt <= 2) {
        printf("%d:0\n", difn);
        break;
      }
      int maybe = 0;
      for (int i = 1; i < 4; i++)
        if (alife[i] && score[i] > score[0] ||
            (score[i] == score[0] && diff[i] > diff[0]))
          maybe++;
      if (alife[pos] && score[pos] == score[0] && diff[pos] == diff[0] &&
          goals[pos] == goals[0] && backss[0] > backss[pos])
        maybe++;
      if (maybe >= 2) continue;
      for (int gm = 0;; gm++, goals[0]++, goals[pos]++) {
        assert(gm < 1000);
        int cntlast = 0;
        for (int i = 1; i < 4; i++)
          if (alife[i] && (score[i] > score[0] || diff[i] > diff[0] ||
                           goals[i] > goals[0] ||
                           (goals[i] == goals[0] && backss[0] > backss[i])))
            cntlast++;
        if (cntlast >= 2) continue;
        printf("%d:%d\n", gm + difn, gm);
        break;
      }
      break;
    }
    break;
  }
  return 0;
}
