#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
inline int getInt() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long getLL() {
  long long x;
  scanf("%lld", &x);
  return x;
};
inline int NUM(char c) { return (int)c - 48; }
inline char CHR(int n) { return (char)(n + 48); }
template <class T>
inline T MAX(T a, T b) {
  if (a > b) return a;
  return b;
}
template <class T>
inline T MIN(T a, T b) {
  if (a < b) return a;
  return b;
}
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
map<string, int> score, sco, mis;
map<string, int> times;
int main() {
  vector<string> v;
  for (int k = 0, _n = (5); k < _n; k++) {
    string A, B, C;
    cin >> A >> B;
    cin >> C;
    for (int i = 0, _n = ((C).size()); i < _n; i++)
      if (C[i] == ':') C[i] = ' ';
    stringstream ss(C);
    int s, m;
    ss >> s >> m;
    if (s > m)
      score[A] += 3;
    else if (s < m)
      score[B] += 3;
    else {
      score[A]++;
      score[B]++;
    }
    sco[A] += s;
    mis[A] += m;
    sco[B] += m;
    mis[B] += s;
    v.push_back(A);
    v.push_back(B);
    times[A]++;
    times[B]++;
  }
  sort((v).begin(), (v).end());
  v.resize(unique((v).begin(), (v).end()) - v.begin());
  string OTHER;
  for (int i = 0, _n = ((v).size()); i < _n; i++) {
    if (times[v[i]] == 2 && v[i] != "BERLAND") OTHER = v[i];
  }
  vector<pair<int, pair<int, pair<int, string> > > > sorted;
  for (int d = (1), _b = (50); d <= _b; d++) {
    for (int m = (0), _b = (50); m <= _b; m++) {
      int s = m + d;
      string A, B;
      A = "BERLAND", B = OTHER;
      score[A] += 3;
      sco[A] += s;
      sco[B] += m;
      mis[B] += s;
      mis[A] += m;
      sorted.clear();
      for (int i = 0, _n = ((v).size()); i < _n; i++) {
        sorted.push_back(make_pair(
            -score[v[i]],
            make_pair(-sco[v[i]] + mis[v[i]], make_pair(-sco[v[i]], v[i]))));
      }
      sort((sorted).begin(), (sorted).end());
      if (sorted[0].second.second.second == "BERLAND" ||
          sorted[1].second.second.second == "BERLAND") {
        cout << s << ":" << m << endl;
        return 0;
      }
      score[A] -= 3;
      sco[A] -= s;
      sco[B] -= m;
      mis[B] -= s;
      mis[A] -= m;
    }
  }
  cout << "IMPOSSIBLE" << endl;
  return 0;
}
