#include <bits/stdc++.h>
using namespace std;
struct equipe {
  string nom;
  int pour;
  int pour2;
  int contre;
  int contre2;
  int play;
  int score;
};
int main() {
  equipe team[4];
  string nom1, nom2, ref = "BERLAND", test = "AERLAND";
  int i, combien = 0, numero, j, nous, eux, position;
  int score1, score2, pourbattre[4], diff, y;
  bool fini = true;
  for (i = 0; i < 5; i++) {
    cin >> nom1;
    cin >> nom2;
    scanf("%d:%d\n", &score1, &score2);
    numero = -1;
    for (j = 0; j < combien; j++) {
      if (!nom1.compare(team[j].nom)) numero = j;
    }
    if (numero == -1) {
      team[combien].nom = nom1;
      team[combien].pour = 0;
      team[combien].contre = 0;
      team[combien].play = 0;
      team[combien].score = 0;
      numero = combien;
      combien++;
    }
    team[numero].pour += score1;
    team[numero].contre += score2;
    team[numero].play += 1;
    if (score1 > score2)
      team[numero].score += 3;
    else if (score1 == score2)
      team[numero].score += 1;
    numero = -1;
    for (j = 0; j < combien; j++) {
      if (!nom2.compare(team[j].nom)) numero = j;
    }
    if (numero == -1) {
      team[combien].nom = nom2;
      team[combien].pour = 0;
      team[combien].contre = 0;
      team[combien].play = 0;
      team[combien].score = 0;
      numero = combien;
      combien++;
    }
    team[numero].pour += score2;
    team[numero].contre += score1;
    team[numero].play += 1;
    if (score1 < score2)
      team[numero].score += 3;
    else if (score1 == score2)
      team[numero].score += 1;
  }
  for (i = 0; i < 4; i++) {
    if (team[i].play == 2) {
      if (!ref.compare(team[i].nom)) {
        nous = i;
        team[i].score += 3;
      } else {
        eux = i;
      }
    }
  }
  position = 1;
  for (i = 0; i < 4; i++) {
    if (i != nous) {
      if (team[i].score > team[nous].score) position++;
    }
  }
  if (position >= 3)
    printf("IMPOSSIBLE\n");
  else {
    diff = 1;
    y = 0;
    while (fini) {
      for (i = 0; i < 4; i++) {
        team[i].pour2 = team[i].pour;
        team[i].contre2 = team[i].contre;
      }
      team[nous].contre2 += y;
      team[eux].pour2 += y;
      team[nous].pour2 += y + diff;
      team[eux].contre2 += y + diff;
      position = 1;
      for (j = 0; j < 4; j++) {
        if (j != nous) {
          if (team[j].score > team[nous].score)
            position++;
          else if (team[j].score == team[nous].score) {
            if (team[j].pour2 - team[j].contre2 >
                team[nous].pour2 - team[nous].contre2)
              position++;
            else if (team[j].pour2 - team[j].contre2 ==
                     team[nous].pour2 - team[nous].contre2) {
              if (team[j].pour2 > team[nous].pour2)
                position++;
              else if (team[j].pour2 == team[nous].pour2) {
                if ((team[j].nom).compare(team[nous].nom) < 0) position++;
              }
            }
          }
        }
      }
      if (position <= 2) {
        fini = false;
        printf("%d:%d\n", y + diff, y);
      } else {
        if (y == 50) {
          diff++;
          y = 0;
        } else {
          y++;
        }
      }
    }
  }
  return 0;
}
