#include <bits/stdc++.h>
using namespace std;
string our = "BERLAND";
struct standing {
  string team;
  int matches, points, gf, ga;
  standing(string team1 = "", int matches1 = 0, int points1 = 0, int gf1 = 0,
           int ga1 = 0) {
    team = team1;
    points = points1;
    matches = matches1;
    gf = gf1;
    ga = ga1;
  }
  bool operator<(const standing& p) const {
    if (points > p.points) return 1;
    if (points < p.points) return 0;
    if ((gf - ga) > (p.gf - p.ga)) return 1;
    if ((gf - ga) < (p.gf - p.ga)) return 0;
    if (gf > p.gf) return 1;
    if (gf < p.gf) return 0;
    return team < p.team;
  }
};
vector<standing> ts;
void read() {
  int i, j, p, g1, g2;
  char c;
  string t1, t2;
  for (i = 0; i < 5; ++i) {
    cin >> t1 >> t2 >> g1 >> c >> g2;
    bool found1 = 0, found2 = 0;
    for (j = 0; j < (int)ts.size(); ++j) {
      if (t1 == ts[j].team) {
        ts[j].gf += g1;
        ts[j].ga += g2;
        ts[j].matches++;
        if (g1 == g2)
          ts[j].points += 1;
        else if (g1 > g2)
          ts[j].points += 3;
        found1 = 1;
      }
      if (t2 == ts[j].team) {
        ts[j].gf += g2;
        ts[j].ga += g1;
        ts[j].matches++;
        if (g1 == g2)
          ts[j].points += 1;
        else if (g1 < g2)
          ts[j].points += 3;
        found2 = 1;
      }
    }
    if (!found1) {
      if (g1 > g2)
        p = 3;
      else if (g1 == g2)
        p = 1;
      else
        p = 0;
      ts.push_back(standing(t1, 1, p, g1, g2));
    }
    if (!found2) {
      if (g1 < g2)
        p = 3;
      else if (g1 == g2)
        p = 1;
      else
        p = 0;
      ts.push_back(standing(t2, 1, p, g2, g1));
    }
  }
}
bool check(int pos, int poso, int g1, int g2) {
  vector<standing> s;
  int i, p, n = (int)ts.size();
  for (i = 0; i < n; ++i) {
    s.push_back(ts[i]);
  }
  if (g1 == g2)
    p = 1;
  else if (g1 > g2)
    p = 3;
  else
    p = 0;
  s[pos].points += p;
  s[pos].gf += g1;
  s[pos].ga += g2;
  s[poso].gf += g2;
  s[poso].ga += g1;
  if (g1 == g2) s[poso].points += 1;
  if (g1 < g2) s[poso].points += 3;
  sort(s.begin(), s.end());
  if (s[0].team == our || s[1].team == our) return 1;
  return 0;
}
void solve() {
  int i, j, n = (int)ts.size(), pos, poso;
  for (i = 0; i < n; ++i) {
    if (ts[i].team == our) {
      pos = i;
    } else {
      if (ts[i].matches == 2) poso = i;
    }
  }
  int dif = 512, ii = -1, jj = -1;
  for (i = 0; i <= 128; ++i) {
    for (j = i + 1; j <= 128; ++j) {
      if (check(pos, poso, j, i)) {
        if (j - i < dif) {
          dif = j - i;
          ii = j;
          jj = i;
        } else if (j - i == dif && i < jj) {
          ii = j;
          jj = i;
        }
      }
    }
  }
  if (dif != 512) {
    cout << ii << ":" << jj << endl;
    return;
  }
  cout << "IMPOSSIBLE" << endl;
}
int main() {
  read();
  sort(ts.begin(), ts.end());
  solve();
  return 0;
}
