#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:16777216")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
const int inf = 2000000000;
const long long linf = 5000000000000000000;
const long double LDINF = 2e18;
template <typename T>
void print(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cout << a[i] << ' ';
  cout << '\n';
}
template <typename T>
void print(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << ' ';
    cout << '\n';
  }
}
template <typename T>
void input(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(deque<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
template <typename T>
void input(vector<vector<T>>& a) {
  for (int i = 0; i < a.size(); i++)
    for (int j = 0; j < a[i].size(); j++) cin >> a[i][j];
}
long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
map<string, int> perehod;
int ber_pos, another_pos;
struct team {
  string name;
  int goal = 0, win = 0, amount = 0;
};
vector<team> teams;
bool cmp(team& a, team& b) {
  if (a.win != b.win) return a.win > b.win;
  if (a.goal != b.goal) return a.goal > b.goal;
  if (a.amount != b.amount) return a.amount > b.amount;
  return a.name < b.name;
}
bool check(int plus1, int plus2, int i, int j) {
  vector<team> mem = teams;
  mem[ber_pos].goal += plus1;
  mem[ber_pos].amount += i;
  mem[another_pos].amount += j;
  mem[ber_pos].win += 3;
  mem[another_pos].goal += plus2;
  sort((mem).begin(), (mem).end(), cmp);
  if (mem[0].name == "BERLAND" || mem[1].name == "BERLAND") return true;
  return false;
}
void solve() {
  map<string, int> cnt;
  string team1, team2;
  map<string, int> win, goal, amount;
  win["BERLAND"] = 0;
  for (int i = 0; i < 5; i++) {
    cin >> team1 >> team2;
    cnt[team1]++;
    cnt[team2]++;
    win[team1] = win[team1];
    win[team2] = win[team2];
    char ch;
    long long score1, score2;
    cin >> score1 >> ch >> score2;
    amount[team1] += score1;
    amount[team2] += score2;
    if (score1 == score2) {
      win[team1]++;
      win[team2]++;
    }
    if (score1 > score2) {
      win[team1] += 3;
    }
    if (score2 > score1) {
      win[team2] += 3;
    }
    goal[team1] += score1 - score2;
    goal[team2] += score2 - score1;
  }
  for (auto elem : win) {
    team kek;
    kek.name = elem.first;
    kek.win = elem.second;
    kek.goal = goal[kek.name];
    kek.amount = amount[kek.name];
    teams.push_back(kek);
  }
  sort((teams).begin(), (teams).end(), cmp);
  long long dif = inf, y = inf;
  for (int i = 0; i < teams.size(); i++) {
    perehod[teams[i].name] = i;
    if (teams[i].name == "BERLAND")
      ber_pos = i;
    else if (cnt[teams[i].name] == 2)
      another_pos = i;
  }
  int ans1, ans2;
  for (int i = 1; i <= 100; i++) {
    for (int j = 0; j < i; j++) {
      int plus = i - j;
      if (!check(plus, -plus, i, j)) continue;
      if (plus < dif) {
        ans1 = i, ans2 = j;
        dif = plus;
        y = j;
      } else if (plus == dif) {
        if (j < y) {
          ans1 = i, ans2 = j;
          y = j;
        }
      }
    }
  }
  if (dif == inf) {
    cout << "IMPOSSIBLE";
    return;
  }
  cout << ans1 << ':' << ans2;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tst = 1;
  while (tst--) solve();
}
