#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int g1, g2;
map<string, int> mg;
map<string, int> mpoints;
map<string, int> mgames;
map<string, int> mig;
struct team {
  string name;
  int goal;
  int ingoal;
  int points;
  int games;
};
struct fuckme {
  int x, y;
};
bool cmp2(fuckme a, fuckme b) {
  if (a.x - a.y != b.x - b.y) return a.x - a.y < b.x - b.y;
  return a.y < b.y;
}
vector<fuckme> ans;
bool cmp(team a, team b) {
  if (a.points != b.points) return a.points > b.points;
  if (a.goal - a.ingoal != b.goal - b.ingoal)
    return a.goal - a.ingoal > b.goal - b.ingoal;
  if (a.goal != b.goal) return a.goal > b.goal;
  return a.name < b.name;
}
void chk(int X, int Y) {
  team tmp;
  vector<team> ss;
  for (auto u : mg) {
    string name = u.first;
    int ngoals = u.second;
    tmp.name = name;
    tmp.goal = ngoals;
    tmp.ingoal = mig[name];
    tmp.points = mpoints[name];
    tmp.games = mgames[name];
    ss.push_back(tmp);
  }
  sort(ss.begin(), ss.end(), cmp);
  int cnt = 0;
  fuckme me;
  for (auto u : ss) {
    if (u.name == "BERLAND") {
      me.x = X;
      me.y = Y;
      ans.push_back(me);
      return;
    }
    cnt++;
    if (cnt == 2) return;
  }
}
int main() {
  for (int i = 0; i < 5; i++) {
    cin >> s1 >> s2;
    scanf("%d:%d", &g1, &g2);
    mg[s1] += g1;
    mg[s2] += g2;
    mig[s2] += g1;
    mig[s1] += g2;
    mgames[s1]++;
    mgames[s2]++;
    if (g1 > g2)
      mpoints[s1] += 3;
    else if (g2 > g1)
      mpoints[s2] += 3;
    else {
      mpoints[s1]++;
      mpoints[s2]++;
    }
  }
  s1 = "BERLAND";
  for (auto u : mgames) {
    if (u.second != 3 && u.first != "BERLAND") {
      s2 = u.first;
      break;
    }
  }
  for (int x = 0; x <= 100; x++) {
    for (int y = 0; y < x; y++) {
      mg[s1] += x;
      mg[s2] += y;
      mig[s1] += y;
      mig[s2] += x;
      if (x > y)
        mpoints[s1] += 3;
      else if (y > x)
        mpoints[s2] += 3;
      else {
        mpoints[s1]++;
        mpoints[s2]++;
      }
      chk(x, y);
      if (x > y)
        mpoints[s1] -= 3;
      else if (y > x)
        mpoints[s2] -= 3;
      else {
        mpoints[s1]--;
        mpoints[s2]--;
      }
      mig[s1] -= y;
      mig[s2] -= x;
      mg[s1] -= x;
      mg[s2] -= y;
    }
  }
  if (ans.empty())
    printf("IMPOSSIBLE");
  else {
    sort(ans.begin(), ans.end(), cmp2);
    auto it = ans[0];
    printf("%d:%d", it.x, it.y);
  }
  return 0;
}
