#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18 + 7;
const int N = 2e3 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-8;
struct Node {
  string name;
  int total, scored, missed;
  Node() {}
  Node(string _n, int _t, int _s, int _m) {
    name = _n, total = _t, scored = _s, missed = _m;
  }
  bool operator<(const Node &p) const {
    if (total != p.total) return total > p.total;
    if (scored - missed != p.scored - p.missed)
      return scored - missed > p.scored - p.missed;
    if (scored != p.scored) return scored > p.scored;
    return name < p.name;
  }
} a[4], b[4];
int cnt[4], goal1[5], goal2[5];
string team1[5], team2[5];
vector<string> S;
bool check() {
  sort(a, a + 4);
  return a[0].name == "BERLAND" || a[1].name == "BERLAND";
}
void gao(int id, int x, int y) {
  a[id].scored += x, a[id].missed += y;
  if (x > y)
    a[id].total += 3;
  else
    a[id].total += x == y;
}
void solve() {
  for (int i = (0); i < (4); ++i) b[i] = a[i];
  int x = -1, y = -1;
  int id1, id2;
  id1 = lower_bound(S.begin(), S.end(), "BERLAND") - S.begin();
  for (int i = (0); i < (4); ++i)
    if (cnt[i] == 2 && i != id1) {
      id2 = i;
      break;
    }
  for (int i = (1); i < (100); ++i)
    for (int j = (0); j < (i); ++j) {
      for (int k = (0); k < (4); ++k) a[k] = b[k];
      gao(id1, i, j), gao(id2, j, i);
      if (check()) {
        if (x == -1 || (x - y > i - j) || (x - y == i - j && y > j)) {
          x = i, y = j;
        }
      }
    }
  if (~x) {
    printf("%d:%d", x, y);
  } else {
    puts("IMPOSSIBLE");
  }
}
int main() {
  for (int i = (0); i < (5); ++i) {
    char ch;
    cin >> team1[i] >> team2[i] >> goal1[i] >> ch >> goal2[i];
    S.push_back(team1[i]), S.push_back(team2[i]);
  }
  sort(S.begin(), S.end());
  S.erase(unique(S.begin(), S.end()), S.end());
  for (int i = (0); i < (4); ++i) a[i] = Node(S[i], 0, 0, 0);
  for (int i = (0); i < (5); ++i) {
    int id1 = lower_bound(S.begin(), S.end(), team1[i]) - S.begin();
    int id2 = lower_bound(S.begin(), S.end(), team2[i]) - S.begin();
    ++cnt[id1], ++cnt[id2];
    gao(id1, goal1[i], goal2[i]), gao(id2, goal2[i], goal1[i]);
  }
  solve();
  return 0;
}
