#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-8;
const int INF = (1 << 30) - 1;
struct team {
  string name;
  int points;
  int zabit;
  int prop;
  int played;
};
bool operator<(team a, team b) {
  if (a.points != b.points) return a.points > b.points;
  if (a.zabit - a.prop != b.zabit - b.prop)
    return a.zabit - a.prop > b.zabit - b.prop;
  if (a.zabit != b.zabit) return a.zabit > b.zabit;
  return a.name < b.name;
}
int str2int(string s) {
  int res;
  sscanf(s.c_str(), "%d", &res);
  return res;
}
int n, tc, ans1, ans2;
team t[4], tt[4];
int getps(string name) {
  for (int i = 0; i < tc; ++i) {
    if (t[i].name == name) return i;
  }
  t[tc].name = name;
  ++tc;
  return tc - 1;
}
void play(team* t, int t1, int t2, int a, int b) {
  if (a > b) {
    t[t1].points += 3;
  }
  if (a < b) {
    t[t2].points += 3;
  }
  if (a == b) {
    t[t1].points++;
    t[t2].points++;
  }
  t[t1].zabit += a;
  t[t1].prop += b;
  t[t2].zabit += b;
  t[t2].prop += a;
  t[t1].played++;
  t[t2].played++;
}
void update(int p1, int p2) {
  if (ans1 < 0) {
    ans1 = p1;
    ans2 = p2;
    return;
  }
  if (p1 - p2 < ans1 - ans2) {
    ans1 = p1;
    ans2 = p2;
    return;
  }
  if (p1 - p2 > ans1 - ans2) return;
  if (p2 < ans2) {
    ans1 = p1;
    ans2 = p2;
  }
}
bool ok() {
  sort(tt, tt + 4);
  if (tt[0].name == "BERLAND" || tt[1].name == "BERLAND") return true;
  return false;
}
int main() {
  for (int i = 0; i < 5; ++i) {
    string a, b, c;
    cin >> a >> b >> c;
    int p1, p2;
    p1 = str2int(c.substr(0, c.find(":")));
    c = c.substr(c.find(":") + 1, c.size() - c.find(":") - 1);
    p2 = str2int(c);
    play(t, getps(a), getps(b), p1, p2);
  }
  int ber = getps("BERLAND");
  int opp = 0;
  while (opp == ber || t[opp].played == 3) ++opp;
  ans1 = ans2 = -1;
  for (int pts1 = 1; pts1 < 500; ++pts1) {
    for (int pts2 = 0; pts2 < pts1; ++pts2) {
      for (int i = 0; i < 4; ++i) tt[i] = t[i];
      play(tt, ber, opp, pts1, pts2);
      if (ok()) update(pts1, pts2);
    }
  }
  if (ans1 >= 0)
    cout << ans1 << ":" << ans2;
  else
    cout << "IMPOSSIBLE";
  return 0;
};
