#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  int gamesPlayed;
  int points;
  int goalsPro;
  int goalsAgainst;
  team() {}
  team(string name) {
    this->name = name;
    points = 0;
    gamesPlayed = 0;
    goalsPro = 0;
    goalsAgainst = 0;
  }
  bool operator<(const team& b) const {
    if (points != b.points)
      return points > b.points;
    else if ((goalsPro - goalsAgainst) != (b.goalsPro - b.goalsAgainst)) {
      return (goalsPro - goalsAgainst) > (b.goalsPro - b.goalsAgainst);
    } else if (goalsPro != b.goalsPro) {
      return goalsPro > b.goalsPro;
    }
    return name < b.name;
  }
};
int main(void) {
  char t1[100], t2[100];
  int g1, g2;
  team teams[5];
  int N = 0;
  map<string, int> names;
  for (int i = 0; i < 5; i++) {
    scanf("%[A-Z-a-z] %[A-Za-z] %d:%d\n", t1, t2, &g1, &g2);
    int i1, i2;
    if (names.find(string(t1)) == names.end()) {
      names[string(t1)] = N;
      i1 = N;
      N++;
      teams[i1] = team(string(t1));
    } else
      i1 = names[string(t1)];
    if (names.find(string(t2)) == names.end()) {
      names[string(t2)] = N;
      i2 = N;
      N++;
      teams[i2] = team(string(t2));
    } else
      i2 = names[string(t2)];
    if (g1 > g2) {
      teams[i1].points += 3;
    } else if (g1 < g2) {
      teams[i2].points += 3;
    } else {
      teams[i1].points++;
      teams[i2].points++;
    }
    teams[i1].goalsPro += g1;
    teams[i1].goalsAgainst += g2;
    teams[i2].goalsPro += g2;
    teams[i2].goalsAgainst += g1;
    teams[i1].gamesPlayed++;
    teams[i2].gamesPlayed++;
  }
  int whosNext[2];
  int ix = 0;
  for (int i = 0; i < 4; i++)
    if (teams[i].gamesPlayed != 3) whosNext[ix++] = i;
  int minDiff = -1;
  int minx = -1, miny = -1;
  int i1 = whosNext[0];
  int i2 = whosNext[1];
  if (teams[i1].name != "BERLAND") swap(i1, i2);
  for (int X = 0; X <= 20; X++) {
    for (int Y = 0; Y < X; Y++) {
      int g1 = X, g2 = Y;
      teams[i1].points += 3;
      teams[i1].goalsPro += g1;
      teams[i1].goalsAgainst += g2;
      teams[i2].goalsPro += g2;
      teams[i2].goalsAgainst += g1;
      sort(teams, teams + 4);
      if (teams[0].name == "BERLAND" || teams[1].name == "BERLAND") {
        if (minDiff == -1) {
          minDiff = X - Y;
          minx = X;
          miny = Y;
        } else if (X - Y < minDiff) {
          minDiff = X - Y;
          minx = X;
          miny = Y;
        } else if (X - Y == minDiff) {
          if (Y < miny) {
            minDiff = X - Y;
            minx = X;
            miny = Y;
          }
        }
      }
      ix = 0;
      for (int i = 0; i < 4; i++)
        if (teams[i].gamesPlayed != 3) whosNext[ix++] = i;
      i1 = whosNext[0];
      i2 = whosNext[1];
      if (teams[i1].name != "BERLAND") swap(i1, i2);
      teams[i1].points -= 3;
      teams[i1].goalsPro -= g1;
      teams[i1].goalsAgainst -= g2;
      teams[i2].goalsPro -= g2;
      teams[i2].goalsAgainst -= g1;
      teams[i1].gamesPlayed--;
      teams[i2].gamesPlayed--;
    }
  }
  if (minDiff != -1)
    printf("%d:%d\n", minx, miny);
  else
    printf("IMPOSSIBLE\n");
  return 0;
}
