#include <bits/stdc++.h>
using namespace std;
struct info {
  int go_w, go_m, point, play;
  string name;
};
struct in {
  int po, pos;
};
bool my(in a, in b) {
  if (a.po > b.po)
    ;
}
bool my2(info a, info b) {
  if (a.point > b.point)
    return 1;
  else if (a.point == b.point) {
    if ((a.go_w - a.go_m) > (b.go_w - b.go_m))
      return 1;
    else if ((a.go_w - a.go_m) == (b.go_w - b.go_m)) {
      if (a.go_w > b.go_w)
        return 1;
      else if (a.go_w == b.go_w) {
        return a.name < b.name;
      }
    }
  }
  return 0;
}
int main() {
  map<string, int> team;
  int cou = 0;
  info lis[10];
  for (int i = 1; i <= 5; i++) {
    lis[i].go_w = lis[i].go_m = lis[i].point = 0, lis[i].play = 0;
  }
  for (int i = 1; i <= 5; i++) {
    string a, b;
    int go_1, go_2;
    cin >> a >> b;
    scanf("%d:%d", &go_1, &go_2);
    if (team[a] == 0) team[a] = ++cou;
    if (team[b] == 0) team[b] = ++cou;
    int d = team[a];
    lis[d].name = a;
    int e = team[b];
    lis[e].name = b;
    if (go_1 == go_2)
      lis[d].point += 1, lis[e].point += 1;
    else if (go_1 > go_2)
      lis[d].point += 3;
    else
      lis[e].point += 3;
    lis[d].go_w += go_1, lis[d].go_m += go_2, lis[d].play++;
    lis[e].go_w += go_2, lis[e].go_m += go_1, lis[e].play++;
  }
  int c = team["BERLAND"];
  vector<in> li;
  int paisi;
  for (int i = 1; i <= 4; i++) {
    info te = lis[i];
    if (te.play == 2 && te.name != "BERLAND") paisi = i;
  }
  vector<info> tea;
  for (int i = 1; i <= 4; i++) tea.push_back(lis[i]);
  sort(tea.begin(), tea.end(), my2);
  info temp = tea[1];
  if (temp.point > lis[c].point + 3) {
    puts("IMPOSSIBLE");
    return 0;
  }
  int x = 0, y = 0;
  int ca = 0;
  lis[c].point += 3;
  for (int i = 1; i <= 100; i++) {
    for (int j = i; j <= 100; j++) {
      lis[c].go_w += j;
      lis[paisi].go_m += j;
      lis[c].go_m += j - i;
      lis[paisi].go_w += j - i;
      vector<info> tea;
      for (int i = 1; i <= 4; i++) tea.push_back(lis[i]);
      sort(tea.begin(), tea.end(), my2);
      info temp = tea[0], temp2 = tea[1];
      if (temp.name == "BERLAND" || temp2.name == "BERLAND") {
        cout << j << ":" << j - i;
        return 0;
      }
      lis[c].go_w -= j;
      lis[paisi].go_m -= j;
      lis[c].go_m -= j - i;
      lis[paisi].go_w -= j - i;
    }
  }
  return 0;
}
