#include <bits/stdc++.h>
using namespace std;
map<string, int> p;
map<string, int> gd;
map<string, int> gf;
map<string, bool> done;
map<string, int> cnt;
string team[4];
int compar(string s, string t) { return p[s] > p[t]; }
int compar2(string s, string t) {
  if (p[s] != p[t])
    return p[s] > p[t];
  else {
    if (gd[s] != gd[t])
      return gd[s] > gd[t];
    else {
      if (gf[s] != gf[t])
        return gf[s] > gf[t];
      else {
        return s < t;
      }
    }
  }
}
int main() {
  int j = 5;
  int i, k;
  int id = 0;
  while (j--) {
    string s, t;
    cin >> s >> t;
    cnt[s]++;
    cnt[t]++;
    if (!done[s]) team[id++] = s;
    if (!done[t]) team[id++] = t;
    done[s] = done[t] = 1;
    scanf("%d:%d", &i, &k);
    gf[s] += i;
    gf[t] += k;
    gd[s] += i - k;
    gd[t] += k - i;
    if (i > k)
      p[s] += 3;
    else if (k > i)
      p[t] += 3;
    else
      p[s]++, p[t]++;
  }
  p["BERLAND"] += 3;
  sort(team, team + 4, compar);
  if (p[team[1]] > p["BERLAND"])
    cout << "IMPOSSIBLE\n";
  else {
    string opp;
    for (i = (0); i <= (3); i++)
      if (cnt[team[i]] < 3 && team[i] != "BERLAND") opp = team[i];
    int dif;
    bool ok = false;
    int x, y;
    for (dif = (1); dif <= (100); dif++) {
      for (y = (0); y <= (1000); y++) {
        x = y + dif;
        gf["BERLAND"] += x;
        gf[opp] += y;
        gd["BERLAND"] += x - y;
        gd[opp] += y - x;
        sort(team, team + 4, compar2);
        if (team[0] == "BERLAND" || team[1] == "BERLAND") ok = true;
        gf["BERLAND"] -= x;
        gf[opp] -= y;
        gd["BERLAND"] -= x - y;
        gd[opp] -= y - x;
        if (ok) break;
      }
      if (ok) break;
    }
    cout << x << ":" << y << endl;
  }
  return 0;
}
