#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
int dblcmp(double d) {
  if (fabs(d) < eps) return 0;
  return d > eps ? 1 : -1;
}
struct team {
  string name;
  int sc;
  int g, m;
  team() {}
  team(string sv) {
    name = sv;
    sc = g = m = 0;
  }
  bool operator<(const team& gg) const {
    if (sc == gg.sc) {
      if (g - m == gg.g - gg.m) {
        if (g == gg.g) return name > gg.name;
        return g < gg.g;
      }
      return g - m < gg.g - gg.m;
    }
    return sc < gg.sc;
  }
};
bool check(vector<string> s) {
  map<string, team> mm;
  for (__typeof(s.begin()) e = s.begin(); e != s.end(); ++e) {
    stringstream ss(*e);
    string a, b, c;
    ss >> a >> b >> c;
    mm[a] = team(a);
    mm[b] = team(b);
  }
  for (__typeof(s.begin()) e = s.begin(); e != s.end(); ++e) {
    stringstream ss(*e);
    string a, b, c;
    ss >> a >> b >> c;
    for (int i = 0; i < (int)((c).size()); i++)
      if (c[i] == ':') c[i] = ' ';
    stringstream ss1(c);
    int x, y;
    ss1 >> x >> y;
    mm[a].g += x;
    mm[a].m += y;
    mm[b].g += y;
    mm[b].m += x;
    if (x > y) {
      mm[a].sc += 3;
    } else if (x == y) {
      mm[a].sc++;
      mm[b].sc++;
    } else {
      mm[b].sc += 3;
    }
  }
  vector<team> v;
  for (__typeof(mm.begin()) e = mm.begin(); e != mm.end(); ++e) {
    v.push_back(e->second);
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < (int)((v).size()); i++) {
    if (v[i].name == "BERLAND") {
      return i <= 1;
    }
  }
  return 0;
}
pair<int, int> less1(pair<int, int> a, pair<int, int> b) {
  if (a.first - a.second > b.first - b.second) return b;
  if (a.first - a.second < b.first - b.second) return a;
  if (a.second > b.second) return b;
  return a;
}
int main() {
  map<string, int> mm;
  int i, j, k;
  vector<string> s;
  for (i = 0; i < 5; i++) {
    string a, b, c;
    cin >> a >> b >> c;
    s.push_back(a + " " + b + " " + c);
    mm[a]++;
    mm[b]++;
  }
  string e = "";
  e += "BERLAND ";
  for (__typeof(mm.begin()) ee = mm.begin(); ee != mm.end(); ++ee) {
    if (ee->second == 2 && ee->first != "BERLAND") {
      e += ee->first;
      e += " ";
      break;
    }
  }
  pair<int, int> ans = make_pair(100, 0);
  bool ok = 0;
  for (i = 80; i >= 1; i--) {
    for (j = i - 1; j >= 0; j--) {
      char sv[33];
      sprintf(sv, "%d:%d", i, j);
      string v = e + (string)sv;
      s.push_back(v);
      if (check(s)) {
        ok = 1;
        ans = less1(ans, make_pair(i, j));
      }
      s.pop_back();
    }
  }
  if (!ok) {
    puts("IMPOSSIBLE");
    return 0;
  }
  printf("%d:%d\n", ans.first, ans.second);
  return 0;
}
