#include <bits/stdc++.h>
using namespace std;
bool debug = false;
struct Team {
  string name;
  int pnts, wn, ls;
  void print() {
    cout << name << " " << pnts << "pts " << wn << ":" << ls << endl;
  }
};
map<string, int> mp;
vector<Team> v;
void Add(string name, int win, int lose) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i].name == name) {
      if (win > lose) {
        v[i].pnts += 3;
      }
      if (win == lose) {
        v[i].pnts += 1;
      }
      v[i].wn += win;
      v[i].ls += lose;
      if (debug) {
        cout << "Added:";
        v[i].print();
      }
      return;
    }
  }
  Team t;
  t.pnts = 0;
  t.name = name;
  if (win > lose) {
    t.pnts = 3;
  }
  if (win == lose) {
    t.pnts = 1;
  }
  t.wn = win;
  t.ls = lose;
  if (debug) {
    cout << "New Team:";
    t.print();
  }
  v.push_back(t);
}
bool cmp(Team a, Team b) {
  if (a.pnts != b.pnts) return a.pnts > b.pnts;
  if (a.wn - a.ls != b.wn - b.ls) return a.wn - a.ls > b.wn - b.ls;
  if (a.wn != b.wn) return a.wn > b.wn;
  return a.name <= b.name;
}
void Del(string name, int win, int lose) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i].name == name) {
      if (win > lose) {
        v[i].pnts -= 3;
      }
      if (win == lose) {
        v[i].pnts -= 1;
      }
      v[i].wn -= win;
      v[i].ls -= lose;
      if (debug) {
        cout << "Del:";
        v[i].print();
      }
      return;
    }
  }
}
int main(int argc, char* argv[]) {
  for (int i = 0; i < 5; i++) {
    string a, b;
    int c, d;
    cin >> a >> b;
    scanf("%d:%d", &c, &d);
    mp[a]++;
    mp[b]++;
    Add(a, c, d);
    Add(b, d, c);
  }
  string enemy;
  for (map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    if (it->second == 2 && it->first != "BERLAND") {
      enemy = it->first;
      break;
    }
  }
  int mnx = -1, mny = -1, mnd = 1e9;
  for (int y = 100; y >= 0; y--) {
    for (int d = 1; d <= 100; d++) {
      int x = y + d;
      Add("BERLAND", x, y);
      Add(enemy, y, x);
      sort(v.begin(), v.end(), cmp);
      if (v[0].name == "BERLAND" || v[1].name == "BERLAND") {
        if ((y < mny || mny == -1) && d <= mnd) {
          mny = y;
          mnx = x;
          mnd = d;
        }
      }
      Del("BERLAND", x, y);
      Del(enemy, y, x);
    }
  }
  if (mnx == -1 || mny == -1)
    cout << "IMPOSSIBLE";
  else
    cout << mnx << ":" << mny << endl;
  return 0;
}
