#include <bits/stdc++.h>
using namespace std;
struct node {
  string name;
  int SG, MG, points = 0;
};
bool compareinterval(node a, node b) {
  if (a.points != b.points)
    return a.points < b.points;
  else {
    int d1 = a.SG - a.MG;
    int d2 = b.SG - b.MG;
    if (d1 != d2)
      return d1 < d2;
    else {
      if (a.SG != b.SG)
        return a.SG < b.SG;
      else
        return (a.name > b.name);
    }
  }
}
map<string, node> mp;
map<string, int> mp1;
int ansx = 100, ansy = 0;
int main() {
  for (int i = 0; i < 5; i++) {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    mp1[s1]++;
    mp1[s2]++;
    int score = s3[0] - '0';
    int miss = s3[2] - '0';
    if (mp.find(s1) != mp.end()) {
      mp[s1].SG += score;
      mp[s1].MG += miss;
    } else {
      mp[s1].name = s1;
      mp[s1].SG += score;
      mp[s1].MG += miss;
    }
    if (mp.find(s2) != mp.end()) {
      mp[s2].SG += miss;
      mp[s2].MG += score;
    } else {
      mp[s2].name = s2;
      mp[s2].SG += miss;
      mp[s2].MG += score;
    }
    if (score > miss)
      mp[s1].points += 3;
    else if (score == miss) {
      mp[s1].points += 1;
      mp[s2].points += 1;
    } else
      mp[s2].points += 3;
  }
  string str1 = "BERLAND", str2;
  for (auto e : mp1) {
    if (e.second == 2 && e.first != "BERLAND") str2 = e.first;
  }
  for (int i = 1; i <= 20; i++) {
    for (int j = i - 1; j >= 0; j--) {
      bool ok = 0;
      map<string, node> copy(mp.begin(), mp.end());
      copy[str1].points += 3;
      copy[str1].SG += i;
      copy[str1].MG += j;
      copy[str2].SG += j;
      copy[str2].MG += i;
      vector<node> vt;
      for (auto e : copy) {
        vt.push_back(e.second);
      }
      sort(vt.begin(), vt.end(), compareinterval);
      if ((vt[3].name.compare("BERLAND") == 0) ||
          (vt[2].name.compare("BERLAND") == 0))
        ok = 1;
      if (ok) {
        if (i - j < ansx - ansy) {
          ansx = i;
          ansy = j;
        } else if (i - j == ansx - ansy) {
          if (j < ansy) {
            ansx = i;
            ansy = j;
          }
        }
      }
    }
  }
  ansx == 100 && ansy == 0 ? cout << "IMPOSSIBLE" : cout << ansx << ":" << ansy;
}
