#include <bits/stdc++.h>
using namespace std;
string s1[10], s2[10], score[10];
map<string, int> mp;
string name[10];
int a[10][10];
bool better(int x, int y) {
  int n;
  int sx = 0, px = 0, mx = 0, sy = 0, py = 0, my = 0;
  for (n = 0; n < 4; n++)
    if (n != x) {
      if (a[x][n] > a[n][x])
        sx += 3;
      else if (a[x][n] == a[n][x])
        sx++;
      px += a[x][n];
      mx += a[n][x];
    }
  for (n = 0; n < 4; n++)
    if (n != y) {
      if (a[y][n] > a[n][y])
        sy += 3;
      else if (a[y][n] == a[n][y])
        sy++;
      py += a[y][n];
      my += a[n][y];
    }
  if (sx != sy) return (sx > sy);
  if (px - mx != py - my) return (px - mx > py - my);
  if (px != py) return (px > py);
  return (x < y);
}
bool check(int x, int y) {
  int n;
  int b = mp["BERLAND"];
  int c;
  int rank = 1;
  for (n = 0; n < 4; n++)
    if (n != b && a[b][n] == -1) c = n;
  a[b][c] = x;
  a[c][b] = y;
  for (n = 0; n < 4; n++)
    if (n != b && better(n, b)) rank++;
  a[b][c] = -1, a[c][b] = -1;
  return (rank <= 2);
}
int main() {
  int i, j;
  for (i = 0; i < 5; i++) {
    cin >> s1[i] >> s2[i] >> score[i];
  }
  for (i = 0; i < 5; i++) mp[s1[i]] = mp[s2[i]] = 0;
  i = 0;
  for (__typeof((mp).begin()) itr = (mp).begin(); itr != (mp).end(); itr++) {
    (itr->second) = i;
    name[i] = (itr->first);
    i++;
  }
  memset(a, -1, sizeof(a));
  for (i = 0; i < 5; i++) {
    int x = mp[s1[i]], y = mp[s2[i]];
    for (j = 0; j < score[i].size(); j++)
      if (score[i][j] == ':') score[i][j] = ' ';
    istringstream ss(score[i]);
    ss >> a[x][y] >> a[y][x];
  }
  for (int diff = 1; diff < 100; diff++) {
    for (int a = 0; a < 100; a++) {
      int b = a + diff;
      if (check(b, a)) {
        cout << b << ":" << a << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
