#include <bits/stdc++.h>
struct Team {
  std::string name;
  int match;
  int score;
  int goalsFor;
  int goalsAgainst;
};
std::string vietnam = "BERLAND";
Team team[4];
void sort() {
  for (int i = 0; i < 3; ++i) {
    for (int j = i + 1; j < 4; ++j) {
      if ((team[i].score < team[j].score) ||
          (team[i].score == team[j].score &&
           team[i].goalsFor - team[i].goalsAgainst <
               team[j].goalsFor - team[j].goalsAgainst) ||
          (team[i].score == team[j].score &&
           team[i].goalsFor - team[i].goalsAgainst ==
               team[j].goalsFor - team[j].goalsAgainst &&
           team[i].goalsFor < team[j].goalsFor) ||
          (team[i].score == team[j].score &&
           team[i].goalsFor - team[i].goalsAgainst ==
               team[j].goalsFor - team[j].goalsAgainst &&
           team[i].goalsFor == team[j].goalsFor &&
           team[i].name.compare(team[j].name) > 0)) {
        Team tmp = team[i];
        team[i] = team[j];
        team[j] = tmp;
      }
    }
  }
}
int main() {
  for (int i = 0; i < 4; ++i) {
    team[i].match = 0;
    team[i].score = 0;
    team[i].goalsFor = 0;
    team[i].goalsAgainst = 0;
  }
  int numTeams = 0;
  for (int i = 0; i < 5; ++i) {
    std::string team1, team2, result;
    std::cin >> team1 >> team2 >> result;
    int m = result[0] - '0';
    int n = result[2] - '0';
    int iTeam1 = -1;
    for (int k = 0; k < numTeams; ++k) {
      if (team1.compare(team[k].name) == 0) {
        iTeam1 = k;
        break;
      }
    }
    if (iTeam1 < 0) {
      iTeam1 = numTeams;
      team[iTeam1].name = team1;
      ++numTeams;
    }
    if (m > n) {
      team[iTeam1].score += 3;
    } else if (m == n) {
      team[iTeam1].score += 1;
    }
    team[iTeam1].match += 1;
    team[iTeam1].goalsFor += m;
    team[iTeam1].goalsAgainst += n;
    int iTeam2 = -1;
    for (int k = 0; k < numTeams; ++k) {
      if (team2.compare(team[k].name) == 0) {
        iTeam2 = k;
        break;
      }
    }
    if (iTeam2 < 0) {
      iTeam2 = numTeams;
      team[iTeam2].name = team2;
      ++numTeams;
    }
    if (n > m) {
      team[iTeam2].score += 3;
    } else if (n == m) {
      team[iTeam2].score += 1;
    }
    team[iTeam2].match += 1;
    team[iTeam2].goalsFor += n;
    team[iTeam2].goalsAgainst += m;
  }
  std::string op;
  for (int i = 0; i < 4; ++i) {
    if (team[i].name.compare(vietnam) != 0 && team[i].match < 3) {
      op = team[i].name;
      break;
    }
  }
  for (int d = 1; d < 100; ++d) {
    for (int i = 0; i < 100 - d; ++i) {
      int m = i + d;
      int n = i;
      for (int j = 0; j < 4; ++j) {
        if (team[j].name.compare(vietnam) == 0) {
          team[j].score += 3;
          team[j].goalsFor += m;
          team[j].goalsAgainst += n;
        }
        if (team[j].name.compare(op) == 0) {
          team[j].goalsFor += n;
          team[j].goalsAgainst += m;
        }
      }
      sort();
      if (team[0].name.compare(vietnam) == 0 ||
          team[1].name.compare(vietnam) == 0) {
        std::cout << m << ":" << n << "\n";
        return 0;
      }
      for (int j = 0; j < 4; ++j) {
        if (team[j].name.compare(vietnam) == 0) {
          team[j].score -= 3;
          team[j].goalsFor -= m;
          team[j].goalsAgainst -= n;
        }
        if (team[j].name.compare(op) == 0) {
          team[j].goalsFor -= n;
          team[j].goalsAgainst -= m;
        }
      }
    }
  }
  std::cout << "IMPOSSIBLE\n";
  return 0;
}
