#include <bits/stdc++.h>
using namespace std;
map<string, int> score, goal, miss, races;
const string me = "BERLAND";
int main() {
  for (int nnnnn = 1; nnnnn <= 5; nnnnn++) {
    string a, b, sc;
    cin >> a >> b >> sc;
    int sc1, sc2;
    sscanf(sc.c_str(), "%d:%d", &sc1, &sc2);
    if (sc1 < sc2)
      score[b] += 3;
    else if (sc1 > sc2)
      score[a] += 3;
    else {
      score[a]++;
      score[b]++;
    }
    goal[a] += sc1;
    goal[b] += sc2;
    miss[a] += sc2;
    miss[b] += sc1;
    races[a]++;
    races[b]++;
  }
  string tar;
  for (map<string, int>::iterator it = races.begin(); it != races.end(); it++) {
    if (it->second == 2 && it->first != me) tar = it->first;
  }
  for (int dif = 1; dif <= 50; dif++) {
    for (int Y = 0; Y <= 50; Y++) {
      int X = dif + Y;
      if (dif)
        score[me] += 3;
      else {
        score[me]++;
        score[tar]++;
      }
      goal[me] += X;
      goal[tar] += Y;
      miss[me] += Y;
      miss[tar] += X;
      int cnt = 0;
      for (map<string, int>::iterator it = races.begin(); it != races.end();
           it++) {
        string him = it->first;
        if (him == me) continue;
        if (score[him] > score[me]) {
          ++cnt;
          continue;
        }
        if (score[him] < score[me]) continue;
        int v = goal[him] - miss[him], vm = goal[me] - miss[me];
        if (v > vm) {
          ++cnt;
          continue;
        }
        if (v < vm) continue;
        v = goal[him];
        vm = goal[me];
        if (v > vm) {
          ++cnt;
          continue;
        }
        if (v < vm) continue;
        if (him < me) {
          ++cnt;
          continue;
        }
      }
      if (cnt <= 1) {
        cout << X << ':' << Y << endl;
        return 0;
      }
      if (dif)
        score[me] -= 3;
      else {
        score[me]--;
        score[tar]--;
      }
      goal[me] -= X;
      goal[tar] -= Y;
      miss[me] -= Y;
      miss[tar] -= X;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
