#include <bits/stdc++.h>
using namespace std;
struct Team {
  string name;
  int played;
  int point;
  int goal, miss;
  Team() {
    this->point = 0;
    this->goal = 0;
    this->miss = 0;
    this->played = 0;
  }
  void process(int a, int b) {
    played++;
    goal += a;
    miss += b;
    if (a > b)
      point += 3;
    else if (a == b)
      point++;
  }
  bool operator<(const Team& a) const {
    int diff1 = this->goal - this->miss;
    int diff2 = a.goal - a.miss;
    if (this->point > a.point) return true;
    if (this->point < a.point) return false;
    if (diff1 > diff2) return true;
    if (diff1 < diff2) return false;
    if (this->goal > a.goal) return true;
    if (this->goal < a.goal) return false;
    return this->name < a.name;
  }
};
char str1[100];
char str2[100];
int main() {
  map<string, Team> maps;
  vector<Team> v;
  for (int(i) = (1), _n = (5); (i) <= _n; (i)++) {
    int a, b;
    scanf("%s %s %d:%d", str1, str2, &a, &b);
    maps[str1].process(a, b);
    maps[str2].process(b, a);
  }
  string dua;
  for (__typeof(maps.begin()) it = maps.begin(); it != maps.end(); it++) {
    it->second.name = it->first;
    if (it->second.played == 2) {
      if (it->second.name == "BERLAND") {
        it->second.point += 3;
        it->second.goal++;
      } else {
        dua = it->second.name;
        it->second.miss++;
      }
    }
    v.push_back(it->second);
  }
  sort(v.begin(), v.end());
  int a = 1;
  int b = 0;
  if (v[0].name == "BERLAND" || v[1].name == "BERLAND") {
    puts("1:0");
  } else if (maps["BERLAND"].point < v[1].point)
    puts("IMPOSSIBLE");
  else {
    int diff1, diff2;
    Team berland = maps["BERLAND"];
    if (v[1].name == dua) {
      diff1 = v[1].goal - v[1].miss;
      diff2 = berland.goal - berland.miss;
      int diff = (diff1 - diff2) / 2 + (diff1 - diff2) % 2;
      v[1].miss += diff;
      a += diff;
      for (__typeof(v.begin()) it = v.begin(); it != v.end(); it++) {
        if (it->name == "BERLAND") it->goal += diff;
      }
      berland.goal += diff;
      sort(v.begin(), v.end());
    }
    diff1 = v[1].goal - v[1].miss;
    diff2 = berland.goal - berland.miss;
    int diff = diff1 - diff2;
    if (diff > 0) {
      a += diff;
      berland.goal += diff;
      for (int(i) = (0), _n = (3); (i) <= _n; (i)++) {
        if (v[i].name == dua) {
          v[i].miss += diff;
        } else if (v[i].name == "BERLAND") {
          v[i].goal += diff;
        }
      }
    }
    sort(v.begin(), v.end());
    if (v[0].name != "BERLAND" && v[1].name != "BERLAND") {
      if (v[1].name == dua) {
        diff1 = v[0].goal - v[0].miss;
        diff2 = berland.goal - berland.miss;
        if (diff1 == diff2) {
          b += v[0].goal - berland.goal;
          a += v[0].goal - berland.goal;
          if (v[0].name < "BERLAND") {
            a++;
            b++;
          }
        } else
          a++;
      } else {
        b += v[1].goal - berland.goal;
        a += v[1].goal - berland.goal;
        if (v[1].name < "BERLAND") {
          a++;
          b++;
        }
      }
    }
    printf("%d:%d\n", a, b);
  }
  getchar();
  getchar();
  return 0;
}
