#include <bits/stdc++.h>
using namespace std;
struct Info {
  string name;
  int score, goals, fails;
  Info(string s) {
    name = s;
    score = goals = fails = 0;
  }
  Info() {
    name = "";
    score = goals = fails = 0;
  }
};
map<string, Info> q;
vector<Info> teams;
bool operator<(Info a, Info b) {
  return (a.score < b.score ||
          (a.score == b.score && a.goals - a.fails < b.goals - b.fails) ||
          (a.score == b.score && a.goals - a.fails == b.goals - b.fails &&
           a.goals < b.goals) ||
          (a.score == b.score && a.goals - a.fails == b.goals - b.fails &&
           a.goals == b.goals && a.name > b.name));
}
int main() {
  vector<string> temp1;
  for (int i = 0; i < 5; ++i) {
    string team1, team2;
    int s1, s2;
    cin >> team1 >> team2 >> s1;
    getchar();
    cin >> s2;
    if (q.count(team1) == 0) q.insert(make_pair(team1, Info(team1)));
    if (q.count(team2) == 0) q.insert(make_pair(team2, Info(team2)));
    if (s1 > s2) q[team1].score += 3;
    if (s1 == s2) {
      q[team1].score += 1;
      q[team2].score += 1;
    }
    if (s2 > s1) q[team2].score += 3;
    q[team1].goals += s1;
    q[team1].fails += s2;
    q[team2].fails += s1;
    q[team2].goals += s2;
    if (team1 == "BERLAND") temp1.push_back(team2);
    if (team2 == "BERLAND") temp1.push_back(team1);
  }
  string other;
  for (map<string, Info>::iterator it = q.begin(); it != q.end(); ++it) {
    teams.push_back(it->second);
    bool found = false;
    for (int i = 0; i < 2; ++i)
      if (temp1[i] == it->first) found = true;
    if (!found && it->first != "BERLAND") other = it->first;
  }
  int idx1, idx2;
  for (int i = 0; i < 4; ++i) {
    if (teams[i].name == "BERLAND") idx1 = i;
    if (teams[i].name == other) idx2 = i;
  }
  vector<Info> temp(4);
  teams[idx1].score += 3;
  pair<int, int> res = make_pair(1E9, 1E8);
  for (int x = 1; x <= 100; ++x)
    for (int y = 0; y < x; ++y) {
      for (int i = 0; i < 4; ++i) {
        temp[i].score = teams[i].score;
        temp[i].goals = teams[i].goals;
        temp[i].fails = teams[i].fails;
        temp[i].name = teams[i].name;
      }
      temp[idx1].goals += x;
      temp[idx1].fails += y;
      temp[idx2].fails += x;
      temp[idx2].goals += y;
      sort(temp.begin(), temp.end());
      if (temp[2].name == "BERLAND" || temp[3].name == "BERLAND")
        if ((x - y < res.first - res.second) ||
            (x - y == res.first - res.second && y < res.second))
          res = make_pair(x, y);
    }
  if (res.first > 1E8)
    cout << "IMPOSSIBLE";
  else
    cout << res.first << ':' << res.second;
}
