#include <bits/stdc++.h>
using namespace std;
struct Team {
  string name;
  int scor, diff, goal;
  int smat;
};
Team a[21], t[21];
map<string, int> mp;
int sumt;
int me, op;
bool cmp(Team u, Team v) {
  return u.scor == v.scor
             ? u.diff == v.diff
                   ? u.goal == v.goal ? u.name < v.name : u.goal > v.goal
                   : u.diff > v.diff
             : u.scor > v.scor;
}
bool Valid(int u, int v) {
  for (int i = 1; i <= 4; ++i) t[i] = a[i];
  t[me].scor += 3;
  t[me].diff += u - v;
  t[me].goal += u;
  t[op].diff += v - u;
  t[op].goal += v;
  sort(t + 1, t + 4 + 1, cmp);
  int rank;
  for (int i = 1; i <= 4; ++i) {
    if (t[i].name == "BERLAND") {
      rank = i;
      break;
    }
  }
  return rank <= 2;
}
int main() {
  for (int i = 1; i <= 5; ++i) {
    string t1, t2, mat;
    int g1, g2;
    cin >> t1 >> t2 >> mat;
    g1 = mat[0] - '0';
    g2 = mat[2] - '0';
    if (mp[t1] == 0) mp[t1] = ++sumt;
    if (mp[t2] == 0) mp[t2] = ++sumt;
    a[mp[t1]].name = t1;
    a[mp[t2]].name = t2;
    if (g1 > g2) {
      a[mp[t1]].scor += 3;
    } else if (g1 == g2) {
      ++a[mp[t1]].scor;
      ++a[mp[t2]].scor;
    } else {
      a[mp[t2]].scor += 3;
    }
    a[mp[t1]].diff += g1 - g2;
    a[mp[t2]].diff += g2 - g1;
    a[mp[t1]].goal += g1;
    a[mp[t2]].goal += g2;
    ++a[mp[t1]].smat;
    ++a[mp[t2]].smat;
  }
  for (int i = 1; i <= 4; ++i) {
    if (a[i].name == "BERLAND") {
      me = i;
    } else if (a[i].smat == 2) {
      op = i;
    }
  }
  for (int d = 1; d <= 100; ++d) {
    for (int Y = 0; Y <= 100; ++Y) {
      if (Valid(d + Y, Y)) {
        cout << d + Y << ":" << Y << endl;
        return 0;
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
