#include <bits/stdc++.h>
using namespace std;
const string BL("BERLAND");
map<string, int> M;
string N[8];
int B;
int score[8];
int goal[8];
int miss[8];
int match[8];
int ss[4];
inline int cmpf(int a, int b) {
  if (score[a] != score[b]) return score[a] > score[b];
  int da = goal[a] - miss[a];
  int db = goal[b] - miss[b];
  if (da != db) return da > db;
  if (goal[a] != goal[b]) return goal[a] > goal[b];
  return N[a] < N[b];
}
int main() {
  int i;
  int n = 0;
  for (i = 0; i < 5; ++i) {
    char n1[(32)];
    char n2[(32)];
    int s1;
    int s2;
    scanf("%s %s %d:%d", n1, n2, &s1, &s2);
    string N1(n1);
    string N2(n2);
    int a = M[N1];
    if (a == 0) {
      a = ++n;
      M[N1] = a;
      N[a] = N1;
      if (N1 == BL) B = a;
    }
    int b = M[N2];
    if (b == 0) {
      b = ++n;
      M[N2] = b;
      N[b] = N2;
      if (N2 == BL) B = b;
    }
    if (s1 > s2)
      score[a] += 3;
    else if (s1 < s2)
      score[b] += 3;
    else {
      ++score[a];
      ++score[b];
    }
    goal[a] += s1;
    miss[a] += s2;
    goal[b] += s2;
    miss[b] += s1;
    ++match[a];
    ++match[b];
  }
  int A;
  for (i = 1; i <= 4; ++i) {
    if (match[i] == 2 && i != B) A = i;
  }
  int solx = 1000;
  int soly = 0;
  ss[0] = 1;
  ss[1] = 2;
  ss[2] = 3;
  ss[3] = 4;
  score[B] += 3;
  for (int x = 1; x <= 100; ++x) {
    for (int y = 0; y < x; ++y) {
      goal[B] += x;
      miss[B] += y;
      goal[A] += y;
      miss[A] += x;
      sort(ss, ss + 4, cmpf);
      if (ss[0] == B || ss[1] == B) {
        if (solx - soly > x - y || (solx - soly == x - y && soly > y)) {
          solx = x;
          soly = y;
        }
      }
      goal[B] -= x;
      miss[B] -= y;
      goal[A] -= y;
      miss[A] -= x;
    }
  }
  if (solx == 1000)
    printf("IMPOSSIBLE\n");
  else
    printf("%d:%d\n", solx, soly);
  return 0;
}
