#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  int score, goaldiffs, totalgoals;
  team() {
    name = "";
    score = 0;
    goaldiffs = 0;
    totalgoals = 0;
  }
  bool operator<(const team& other) const {
    if (score < other.score)
      return true;
    else if (score == other.score) {
      if (goaldiffs < other.goaldiffs)
        return true;
      else if (goaldiffs == other.goaldiffs) {
        if (totalgoals < other.totalgoals)
          return true;
        else if (totalgoals == other.totalgoals) {
          if (name > other.name)
            return true;
          else
            return false;
        } else
          return false;
      } else
        return false;
    } else
      return false;
  }
} teams[4];
struct solution {
  int x, y;
  solution(int a, int b) {
    x = a;
    y = b;
  }
  bool operator<(const solution& other) const {
    if (x - y < other.x - other.y)
      return true;
    else if (x - y == other.x - other.y)
      return (y < other.y);
    else
      return false;
  }
};
string missing;
map<string, pair<int, int> > M;
map<string, int> points;
map<string, int> cnt;
vector<solution> Ans;
inline bool won(int i, int j) {
  int cnt = 0;
  for (map<string, pair<int, int> >::iterator it = M.begin(); it != M.end();
       it++) {
    string name = (*it).first;
    int goalx = (*it).second.first, goaly = (*it).second.second;
    if (name == "BERLAND") {
      goalx += i;
      goaly += j;
    } else if (name == missing) {
      goaly += i;
      goalx += j;
    }
    teams[cnt].score = points[name];
    teams[cnt].name = name;
    teams[cnt].goaldiffs = goalx - goaly;
    teams[cnt].totalgoals = goalx;
    cnt++;
  }
  sort(teams, teams + 4);
  if (teams[2].name == "BERLAND" || teams[3].name == "BERLAND")
    return true;
  else
    return false;
}
int main() {
  cin.sync_with_stdio(0);
  for (int i = 0; i < 5; i++) {
    string name1, name2, score;
    cin >> name1 >> name2 >> score;
    cnt[name1]++;
    cnt[name2]++;
    int scores_first = score[0] - '0', scores_second = score[2] - '0';
    pair<int, int> pii = M[name1];
    pii.first += scores_first;
    pii.second += scores_second;
    M[name1] = pii;
    pii = M[name2];
    pii.first += scores_second;
    pii.second += scores_first;
    M[name2] = pii;
    if (scores_first > scores_second)
      points[name1] += 3;
    else if (scores_second > scores_first)
      points[name2] += 3;
    else if (scores_first == scores_second) {
      points[name1]++;
      points[name2]++;
    }
  }
  for (map<string, int>::iterator it = cnt.begin(); it != cnt.end(); it++)
    if ((*it).second == 2 && (*it).first != "BERLAND") missing = (*it).first;
  points["BERLAND"] += 3;
  Ans.reserve(5000);
  for (int i = 1; i <= 1000; i++)
    for (int j = i - 1; j >= 0; j--)
      if (won(i, j)) Ans.push_back(solution(i, j));
  if (Ans.empty())
    cout << "IMPOSSIBLE" << endl;
  else {
    sort(Ans.begin(), Ans.end());
    cout << Ans[0].x << ":" << Ans[0].y << endl;
  }
  return 0;
}
