#include <bits/stdc++.h>
using namespace std;
struct foot {
  string name;
  int goal;
  int lost;
  int och;
};
bool ok[7][7];
foot a[7];
foot b[7];
foot d[7];
foot tem1, tem2;
int coun;
bool better(foot x, foot y) {
  if (x.och > y.och) return true;
  if (x.och == y.och) {
    if (x.goal - x.lost > y.goal - y.lost) return true;
    if (x.goal - x.lost == y.goal - y.lost) {
      if (x.goal > y.goal) return true;
      if (x.goal == y.goal) {
        if (x.name < y.name) return true;
      }
    }
  }
  return false;
}
void mergesort(foot *a, foot *b, int n) {
  int i, i0, i1, iRight, iEnd, width, j;
  for (width = 1; width < n; width *= 2)
    for (i = 0; i < n; i += width * 2) {
      i0 = i;
      i1 = iRight = min(i + width, n);
      iEnd = min(i + width * 2, n);
      for (j = i; j < iEnd; j++)
        if (i0 < iRight && (i1 == iEnd || better(a[i0], a[i1])))
          b[j] = a[i0++];
        else
          b[j] = a[i1++];
      for (j = i; j < iEnd; j++) a[j] = b[j];
    }
}
int main() {
  int i, j;
  string x, y;
  int goal1, goal2;
  int ind1, ind2;
  for (i = 0; i < 5; i++) {
    cin >> x >> y;
    scanf("%d:%d", &goal1, &goal2);
    for (j = 0; j < coun; j++)
      if (x == a[j].name) {
        ind1 = j;
        break;
      }
    if (j == coun) {
      ind1 = coun;
      coun++;
      a[ind1].name = x;
    }
    if (goal1 > goal2) a[ind1].och += 3;
    if (goal1 == goal2) a[ind1].och += 1;
    a[ind1].goal += goal1;
    a[ind1].lost += goal2;
    for (j = 0; j < coun; j++)
      if (y == a[j].name) {
        ind2 = j;
        break;
      }
    if (j == coun) {
      ind2 = coun;
      coun++;
      a[ind2].name = y;
    }
    if (goal2 > goal1) a[ind2].och += 3;
    if (goal1 == goal2) a[ind2].och += 1;
    a[ind2].goal += goal2;
    a[ind2].lost += goal1;
    ok[ind1][ind2] = ok[ind2][ind1] = true;
  }
  for (i = 0; i < 4; i++)
    for (j = i + 1; j < 4; j++)
      if (!ok[i][j]) {
        ind1 = i;
        ind2 = j;
        i = 7;
        break;
      }
  if (a[ind1].name != "BERLAND") swap(ind1, ind2);
  a[ind1].och += 3;
  tem1 = a[ind1];
  tem2 = a[ind2];
  int delta = 1000000000;
  int loose = 1000000000;
  int bestx, besty;
  for (goal1 = 0; goal1 <= 100; goal1++)
    for (goal2 = 0; goal2 < goal1; goal2++) {
      a[ind1].goal = tem1.goal + goal1;
      a[ind1].lost = tem1.lost + goal2;
      a[ind2].goal = tem2.goal + goal2;
      a[ind2].lost = tem2.lost + goal1;
      for (i = 0; i < 4; i++) d[i] = a[i];
      mergesort(d, b, 4);
      if (d[0].name == "BERLAND" || d[1].name == "BERLAND") {
        if (goal1 - goal2 < delta) {
          delta = goal1 - goal2;
          bestx = goal1;
          besty = goal2;
          loose = goal2;
        } else if (goal1 - goal2 == delta && loose > goal2) {
          bestx = goal1;
          besty = goal2;
          loose = goal2;
        }
      }
    }
  if (delta == 1000000000) {
    printf("IMPOSSIBLE\n");
    return 0;
  }
  printf("%d:%d\n", bestx, besty);
  return 0;
}
