#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, MOD = 1e9 + 7;
char arr[25];
map<string, pair<int, pair<int, int> > > mp;
map<string, pair<int, pair<int, int> > >::iterator it;
string s1, s2, s3;
vector<pair<int, pair<int, pair<int, string> > > > res;
vector<pair<int, int> > ans;
map<pair<string, string>, bool> dd;
int pt1, pt2;
int main() {
  for (int i = 0; i < 5; i++) {
    cin >> s1 >> s2 >> s3;
    dd[make_pair(s1, s2)] = true;
    dd[make_pair(s2, s1)] = true;
    pt1 = s3[0] - '0', pt2 = s3[2] - '0';
    mp[s1].second.first -= pt1;
    mp[s2].second.first -= pt2;
    mp[s1].second.second -= pt2;
    mp[s2].second.second -= pt1;
    mp[s2].first = (pt1 < pt2) ? mp[s2].first - 3 : mp[s2].first;
    mp[s1].first = (pt1 == pt2) ? mp[s1].first - 1 : mp[s1].first;
    mp[s2].first = (pt1 == pt2) ? mp[s2].first - 1 : mp[s2].first;
    mp[s1].first = (pt1 > pt2) ? mp[s1].first - 3 : mp[s1].first;
  }
  it = mp.begin();
  for (it; it != mp.end(); it++) {
    int tot = it->second.second.first;
    int in = it->second.second.second;
    res.push_back(make_pair(it->second.first,
                            make_pair(tot - in, make_pair(tot, it->first))));
  }
  sort(res.begin(), res.end());
  for (int x = 1; x < 100; x++) {
    for (int y = 0; y < x; y++) {
      for (int i = 0; i < 4; i++) {
        if (res[i].second.second.second == "BERLAND") {
          res[i].first -= 3;
          res[i].second.first -= (x - y);
          res[i].second.second.first -= x;
        }
      }
      for (int i = 0; i < 4; i++) {
        if (dd[make_pair("BERLAND", res[i].second.second.second)] == 0 &&
            res[i].second.second.second != "BERLAND") {
          res[i].second.first += (x - y);
          res[i].second.second.first -= y;
        }
      }
      sort(res.begin(), res.end());
      if (res[0].second.second.second == "BERLAND" ||
          res[1].second.second.second == "BERLAND") {
        ans.push_back(make_pair(x - y, y));
      }
      for (int i = 0; i < 4; i++) {
        if (res[i].second.second.second == "BERLAND") {
          res[i].first += 3;
          res[i].second.first += (x - y);
          res[i].second.second.first += x;
        }
      }
      for (int i = 0; i < 4; i++) {
        if (dd[make_pair("BERLAND", res[i].second.second.second)] == 0 &&
            res[i].second.second.second != "BERLAND") {
          res[i].second.first -= (x - y);
          res[i].second.second.first += y;
        }
      }
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.empty()) {
    cout << "IMPOSSIBLE";
  } else
    cout << ans[0].first + ans[0].second << ":" << ans[0].second;
  return 0;
}
