#include <bits/stdc++.h>
using namespace std;
int n, k;
string A[6][3];
int B[6][4], p[4][3];
string name[4], s;
bool C[4][4];
bool foo() {
  int i, j;
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 3; j++) p[i][j] = 0;
    for (j = 0; j < 6; j++) {
      if (B[j][0] == i && B[j][2] > B[j][3]) p[i][0] += 3;
      if (B[j][1] == i && B[j][2] < B[j][3]) p[i][0] += 3;
      if (B[j][0] == i && B[j][2] == B[j][3]) p[i][0] += 1;
      if (B[j][1] == i && B[j][2] == B[j][3]) p[i][0] += 1;
      if (B[j][0] == i) {
        p[i][1] += B[j][2];
        p[i][2] += B[j][3];
      }
      if (B[j][1] == i) {
        p[i][1] += B[j][3];
        p[i][2] += B[j][2];
      }
    }
  }
  for (i = 0; i < 4; i++) {
    C[i][i] = false;
    for (j = 0; j < 4; j++)
      if (i != j) {
        if (p[i][0] != p[j][0])
          C[i][j] = (p[i][0] > p[j][0]);
        else {
          if ((p[i][1] - p[i][2]) != (p[j][1] - p[j][2]))
            C[i][j] = ((p[i][1] - p[i][2]) > (p[j][1] - p[j][2]));
          else {
            if (p[i][1] != p[j][1])
              C[i][j] = (p[i][1] > p[j][1]);
            else
              C[i][j] = (name[i] < name[j]);
          }
        }
      }
  }
  if (C[0][1] && C[0][2]) return true;
  if (C[0][1] && C[0][3]) return true;
  if (C[0][2] && C[0][3]) return true;
  return false;
}
int main() {
  int i, j;
  for (i = 0; i < 5; i++)
    for (j = 0; j < 3; j++) cin >> A[i][j];
  k = 0;
  name[0] = "BERLAND";
  name[1] = "";
  name[2] = "";
  name[3] = "";
  for (i = 0; i < 5; i++)
    for (j = 0; j < 2; j++)
      if (name[0] != A[i][j] && name[1] != A[i][j] && name[2] != A[i][j] &&
          name[3] != A[i][j]) {
        k++;
        name[k] = A[i][j];
      }
  for (i = 0; i < 5; i++) {
    j = 0;
    while (name[j] != A[i][0]) j++;
    B[i][0] = j;
    j = 0;
    while (name[j] != A[i][1]) j++;
    B[i][1] = j;
    B[i][2] = (int)((char)A[i][2][0] - '0');
    B[i][3] = (int)((char)A[i][2][2] - '0');
  }
  for (i = 1; i < 4; i++) {
    k = 0;
    for (j = 0; j < 5; j++)
      if (name[i] == A[j][0] || name[i] == A[j][1]) k++;
    if (k == 2) break;
  }
  B[5][0] = 0;
  B[5][1] = i;
  for (int d = 1; d <= 50; d++) {
    for (int y = 0; y <= 50; y++) {
      B[5][2] = y + d;
      B[5][3] = y;
      if (foo()) {
        cout << y + d << ":" << y << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}
