#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN();
struct data {
  int score, goal, miss, match;
};
map<string, data> a;
map<string, data>::iterator it;
struct data2 {
  string name;
  int score, goal, miss;
};
bool compare(data2 i, data2 j) {
  if (i.score != j.score) return i.score > j.score;
  if (i.goal - i.miss != j.goal - j.miss)
    return i.goal - i.miss > j.goal - j.miss;
  if (i.goal != j.goal) return i.goal > j.goal;
  return i.name < j.name;
}
int main() {
  for (int i = 0; i < 5; i++) {
    string t1, t2, d;
    cin >> t1 >> t2 >> d;
    int k = 0, x = 0, y = 0;
    while (d[k] != ':') {
      x = x * 10 + (d[k] - '0');
      k++;
    }
    k++;
    while (k < d.size()) {
      y = y * 10 + (d[k] - '0');
      k++;
    }
    a[t1].match++;
    a[t2].match++;
    a[t1].goal += x;
    a[t1].miss += y;
    a[t2].goal += y;
    a[t2].miss += x;
    if (x > y)
      a[t1].score += 3;
    else if (x < y)
      a[t2].score += 3;
    else {
      a[t1].score++;
      a[t2].score++;
    }
  }
  string t1 = "BERLAND", t2;
  for (it = a.begin(); it != a.end(); it++)
    if (it->second.match == 2 && it->first != "BERLAND") {
      t2 = it->first;
      break;
    }
  a[t1].score += 3;
  int ansx = 99999, ansy = 9999;
  for (int i = 1; i <= 100; i++)
    for (int j = 0; j <= i - 1; j++) {
      a[t1].goal += i;
      a[t1].miss += j;
      a[t2].goal += j;
      a[t2].miss += i;
      vector<data2> b;
      for (it = a.begin(); it != a.end(); it++) {
        data2 tmp;
        tmp.name = it->first;
        tmp.score = it->second.score;
        tmp.goal = it->second.goal;
        tmp.miss = it->second.miss;
        b.push_back(tmp);
      }
      sort(b.begin(), b.end(), compare);
      if (b[0].name == t1 || b[1].name == t1) {
        if (i - j < ansx - ansy) {
          ansx = i;
          ansy = j;
        } else if (i - j == ansx - ansy && j < ansy) {
          ansx = i;
          ansy = j;
        }
      }
      a[t1].goal -= i;
      a[t1].miss -= j;
      a[t2].goal -= j;
      a[t2].miss -= i;
    }
  if (ansx == 99999 && ansy == 9999)
    printf("IMPOSSIBLE");
  else
    printf("%d:%d", ansx, ansy);
}
