#include <bits/stdc++.h>
using namespace std;
int dcmp(double a, double b) {
  return fabs(a - b) <= 0.00000001 ? 0 : (a > b) ? 1 : -1;
}
map<string, int> points, goals, miss, cnt;
int main() {
  for (int i = 0; i < 5; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    int x, y;
    scanf("%d:%d", &x, &y);
    if (x > y)
      points[s1] += 3;
    else if (y > x)
      points[s2] += 3;
    else
      points[s1] += 1, points[s2] += 1;
    goals[s1] += x;
    miss[s1] += y;
    goals[s2] += y;
    miss[s2] += x;
    cnt[s1]++;
    cnt[s2]++;
  }
  vector<string> v;
  string with;
  for (auto i = cnt.begin(); i != cnt.end(); i++) {
    v.push_back((*i).first);
    if ((*i).second == 2 && (*i).first != "BERLAND") with = (*i).first;
  }
  for (int i = 1; i < 100; i++) {
    for (int k = 0; k < 100; k++) {
      int p = i + k;
      goals[with] += k;
      goals["BERLAND"] += p;
      miss["BERLAND"] += k;
      miss[with] += p;
      points["BERLAND"] += 3;
      vector<tuple<int, int, int, string> > v1;
      for (int i = 0; i < ((int)(v).size()); i++) {
        v1.push_back(make_tuple(-points[v[i]], -goals[v[i]] + miss[v[i]],
                                -goals[v[i]], v[i]));
      }
      sort(((v1).begin()), ((v1).end()));
      if (get<3>(v1[0]) == "BERLAND" || get<3>(v1[1]) == "BERLAND") {
        cout << p << ":" << k << endl;
        return 0;
      }
      goals[with] -= k;
      goals["BERLAND"] -= p;
      miss["BERLAND"] -= k;
      miss[with] -= p;
      points["BERLAND"] -= 3;
    }
  }
  cout << "IMPOSSIBLE";
  return 0;
}
