#include <bits/stdc++.h>
using namespace std;
vector<string> team;
int point[4], goalScore[4], goalConcede[4], result[4][4], match[4];
int find(string s) {
  for (int i = 0; i < int(team.size()); i++)
    if (team[i] == s) return i;
  team.push_back(s);
  return int(team.size()) - 1;
}
bool cmp(int x, int y) {
  if (point[x] != point[y]) return point[x] > point[y];
  if (goalScore[x] - goalConcede[x] != goalScore[y] - goalConcede[y])
    return goalScore[x] - goalConcede[x] > goalScore[y] - goalConcede[y];
  if (goalScore[x] != goalScore[y]) return goalScore[x] > goalScore[y];
  return team[x] < team[y];
}
int ok(int a, int b, int x, int y) {
  goalScore[a] += x;
  goalScore[b] += y;
  goalConcede[a] += y;
  goalConcede[b] += x;
  result[a][b] = x;
  result[b][a] = y;
  vector<int> order;
  for (int i = 0; i < 4; i++) order.push_back(i);
  sort(order.begin(), order.end(), cmp);
  if (a == order[0] || a == order[1]) return 1;
  goalScore[a] -= x;
  goalScore[b] -= y;
  goalConcede[a] -= y;
  goalConcede[b] -= x;
  return 0;
}
int main() {
  for (int i = 0; i < 5; i++) {
    string A, B, score;
    cin >> A >> B >> score;
    int a = find(A), b = find(B), x = score[0] - '0', y = score[2] - '0';
    if (x > y)
      point[a] += 3;
    else if (x < y)
      point[b] += 3;
    else
      point[a]++, point[b]++;
    goalScore[a] += x;
    goalScore[b] += y;
    goalConcede[a] += y;
    goalConcede[b] += x;
    result[a][b] = x;
    result[b][a] = y;
    match[a]++;
    match[b]++;
  }
  int berland = find("BERLAND"), opponent;
  for (int i = 0; i < 4; i++)
    if (i != berland && match[i] < 3) opponent = i;
  point[berland] += 3;
  for (int dif = 1; dif <= 100; dif++)
    for (int y = 0; y <= 100; y++) {
      int x = y + dif;
      if (ok(berland, opponent, x, y)) {
        cout << x << ':' << y << endl;
        return 0;
      }
    }
  puts("IMPOSSIBLE");
}
