#include <bits/stdc++.h>
using namespace std;
const unsigned long long INF = 1000 * 1000 * 1000;
const double eps = 1e-9;
map<string, int> pts;
map<string, int> zab;
map<string, int> prp;
vector<string> was;
map<string, int> used;
int main() {
  string s = "BERLAND";
  used[s] = 1;
  was.push_back(s);
  set<string> team;
  for (int i = 1; i <= 5; i++) {
    string s1, s2;
    char c1, c, c2;
    cin >> s1 >> s2 >> c1 >> c >> c2;
    if (used[s1] == 0) {
      used[s1] = 1;
      was.push_back(s1);
    }
    if (used[s2] == 0) {
      used[s2] = 1;
      was.push_back(s2);
    }
    if (s1 == "BERLAND") {
      team.insert(s2);
    }
    if (s2 == "BERLAND") {
      team.insert(s1);
    }
    int g1 = int(c1 - '0');
    int g2 = int(c2 - '0');
    if (g1 > g2) {
      pts[s1] += 3;
    }
    if (g1 < g2) {
      pts[s2] += 3;
    }
    if (g1 == g2) {
      pts[s1]++;
      pts[s2]++;
    }
    zab[s1] += g1;
    prp[s1] += g2;
    zab[s2] += g2;
    prp[s2] += g1;
  }
  string d;
  for (int i = 1; i < was.size(); i++)
    if (team.count(was[i]) == 0) {
      d = was[i];
      break;
    }
  int ans1 = -1000000000;
  int ans2 = 1000000000;
  bool fl = 1;
  for (int i = 0; i <= 100; i++)
    for (int j = 0; j <= 100; j++) {
      if (i <= j) continue;
      zab[s] += i;
      prp[s] += j;
      pts[s] += 3;
      zab[d] += j;
      prp[d] += i;
      int kol = 0;
      for (int k = 1; k < was.size(); k++) {
        if (pts[s] > pts[was[k]]) {
          kol++;
          continue;
        }
        if (pts[s] < pts[was[k]]) continue;
        if (zab[s] - prp[s] > zab[was[k]] - prp[was[k]]) {
          kol++;
          continue;
        }
        if (zab[s] - prp[s] < zab[was[k]] - prp[was[k]]) {
          continue;
        }
        if (zab[s] > zab[was[k]]) {
          kol++;
          continue;
        }
        if (zab[s] < zab[was[k]]) continue;
        if (s < was[k]) kol++;
      }
      zab[s] -= i;
      prp[s] -= j;
      pts[s] -= 3;
      zab[d] -= j;
      prp[d] -= i;
      if (kol <= 1) continue;
      if (fl) {
        fl = 0;
        ans1 = i;
        ans2 = j;
        continue;
      }
      if (i - j < ans1 - ans2) {
        ans1 = i;
        ans2 = j;
        continue;
      }
      if (i - j > ans1 - ans2) continue;
      if (j < ans2) {
        ans1 = i;
        ans2 = j;
        continue;
      }
    }
  if (fl)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << ans1 << ":" << ans2 << endl;
  return 0;
}
