#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int INF = 0x3f3f3f3f;
const int MAXN = 2100;
struct team {
  string name;
  int cnt, point, get, lost;
};
bool cmp(const team& a, const team& b) {
  if (a.point != b.point) return a.point > b.point;
  if ((a.get - a.lost) != (b.get - b.lost))
    return (a.get - a.lost) > (b.get - b.lost);
  if (a.get != b.get) return a.get > b.get;
  return a.name < b.name;
}
map<string, int> m;
team t[5];
int main() {
  char t1[200], t2[200], temp;
  int a, b;
  while (cin >> t1 >> t2 >> a >> temp >> b) {
    m.clear();
    int flag = 2;
    m[t1] = 1;
    m[t2] = 2;
    int cnt = 4;
    t[1].name = t1;
    t[2].name = t2;
    t[m[t1]].get = t[m[t2]].lost = a;
    t[m[t1]].lost = t[m[t2]].get = b;
    t[m[t1]].cnt++;
    t[m[t2]].cnt++;
    if (a > b) {
      t[m[t1]].point += 3;
      t[m[t2]].point += 0;
    } else if (a == b) {
      t[m[t1]].point += 1;
      t[m[t2]].point += 1;
    } else {
      t[m[t1]].point += 0;
      t[m[t2]].point += 3;
    }
    while (cnt--) {
      cin >> t1 >> t2 >> a >> temp >> b;
      if (m[t1] == 0) m[t1] = ++flag;
      if (m[t2] == 0) m[t2] = ++flag;
      t[m[t1]].name = t1;
      t[m[t2]].name = t2;
      t[m[t1]].get += a;
      t[m[t2]].lost += a;
      t[m[t1]].lost += b;
      t[m[t2]].get += b;
      t[m[t1]].cnt++;
      t[m[t2]].cnt++;
      if (a > b) {
        t[m[t1]].point += 3;
        t[m[t2]].point += 0;
      } else if (a == b) {
        t[m[t1]].point += 1;
        t[m[t2]].point += 1;
      } else {
        t[m[t1]].point += 0;
        t[m[t2]].point += 3;
      }
    }
    int opponent, me;
    for (int i = 1; i <= 4; i++)
      if (t[i].name != "BERLAND" && t[i].cnt == 2)
        opponent = i;
      else if (t[i].name == "BERLAND")
        me = i;
    int ans1 = INF, ans2 = INF;
    for (int dis = 50; dis >= 1; dis--) {
      for (int los = 50; los >= 0; los--) {
        int ge = los + dis;
        team a[5];
        a[1] = t[1];
        a[2] = t[2];
        a[3] = t[3];
        a[4] = t[4];
        a[me].get += ge;
        a[opponent].lost += ge;
        a[me].lost += los;
        a[opponent].get += los;
        if (ge > los) {
          a[me].point += 3;
          a[opponent].point += 0;
        } else if (ge == los) {
          a[me].point += 1;
          a[opponent].point += 1;
        } else {
          a[me].point += 0;
          a[opponent].point += 3;
        }
        sort(a + 1, a + 4 + 1, cmp);
        if (a[1].name == "BERLAND" || a[2].name == "BERLAND") {
          ans1 = ge;
          ans2 = los;
        }
      }
    }
    if (ans1 == INF || ans2 == INF)
      printf("IMPOSSIBLE\n");
    else
      printf("%d:%d\n", ans1, ans2);
  }
  return 0;
}
