#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
int a[10][10];
int co;
inline bool better(int x, int y) {
  pair<int, int> x2, y2;
  int x3, y3;
  x3 = y3 = 0;
  x2.first = x2.second = y2.first = y2.second = 0;
  for (int i = 0; i < 4; i++) {
    if (i == x) continue;
    if (a[x][i] > a[i][x]) x2.first += 3;
    if (a[x][i] == a[i][x]) x2.first++;
    x2.second += a[x][i] - a[i][x];
    x3 += a[x][i];
  }
  for (int i = 0; i < 4; i++) {
    if (i == y) continue;
    if (a[y][i] > a[i][y]) y2.first += 3;
    if (a[y][i] == a[i][y]) y2.first++;
    y2.second += a[y][i] - a[i][y];
    y3 += a[y][i];
  }
  if (x2.first != y2.first) return x2.first > y2.first;
  if (x2.second != y2.second) return x2.second > y2.second;
  if (x3 != y3) return x3 > y3;
  return x < y;
}
inline bool check(int x, int y) {
  a[mp["BERLAND"]][co] = x;
  a[co][mp["BERLAND"]] = y;
  int rank = 0;
  for (int i = 0; i < 4; i++) {
    if (i == mp["BERLAND"]) continue;
    if (better(i, mp["BERLAND"])) rank++;
  }
  return rank <= 1;
}
int main() {
  bool first[10];
  memset(a, -1, sizeof(a));
  memset(first, false, sizeof(first));
  string second[10], t[10];
  int n[10], m[10];
  for (int i = 0; i < 5; i++) {
    cin >> second[i] >> t[i];
    scanf("%d:%d", &n[i], &m[i]);
  }
  for (int i = 0; i < 5; i++) mp[second[i]] = mp[t[i]] = 0;
  vector<string> v;
  for (__typeof(mp.begin()) it = mp.begin(); it != mp.end(); it++)
    v.push_back((it->first));
  sort(v.begin(), v.end());
  for (int i = 0; i < 4; i++) mp[v[i]] = i;
  for (int i = 0; i < 5; i++) {
    a[mp[second[i]]][mp[t[i]]] = n[i];
    a[mp[t[i]]][mp[second[i]]] = m[i];
    if (second[i] == "BERLAND") first[mp[t[i]]] = true;
    if (t[i] == "BERLAND") first[mp[second[i]]] = true;
  }
  for (int i = 0; i < 4; i++)
    if (!first[i] && i != mp["BERLAND"]) co = i;
  for (int i = 1; i <= 100; i++) {
    for (int j = 0; j <= 100; j++) {
      int lc = i + j;
      if (check(lc, j)) {
        printf("%d:%d", lc, j);
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE";
  return 0;
}
