#include <bits/stdc++.h>
using namespace std;
int main() {
  const string B = "BERLAND";
  set<string> seen;
  map<pair<string, string>, pair<int, int>> mp;
  map<string, int> cnt, in, out, score;
  for (int i = 0; i < 5; ++i) {
    string s0, s1, s2;
    cin >> s0 >> s1 >> s2;
    int X = s2[0] - '0';
    int Y = s2[2] - '0';
    mp[{s0, s1}] = mp[{s1, s0}] = {X, Y};
    ++cnt[s0];
    ++cnt[s1];
    seen.insert(s0);
    seen.insert(s1);
    in[s0] += X;
    in[s1] += Y;
    out[s0] += Y;
    out[s1] += X;
    if (X > Y) {
      score[s0] += 3;
    } else if (Y > X) {
      score[s1] += 3;
    } else {
      ++score[s0];
      ++score[s1];
    }
  }
  string other;
  for (string s : seen) {
    if (cnt[s] == 2 && s != B) {
      other = s;
    }
  }
  vector<string> v(seen.begin(), seen.end());
  auto update = [&](int X, int Y, int coeff) {
    score[B] += 3 * coeff;
    in[B] += X * coeff;
    in[other] += Y * coeff;
    out[B] += Y * coeff;
    out[other] += X * coeff;
  };
  int bestX = -1, bestY = -1;
  bool found = 0;
  for (int X = 0; X < 100; ++X) {
    for (int Y = 0; Y < X; ++Y) {
      update(X, Y, 1);
      sort(v.begin(), v.end(), [&](string a, string b) {
        if (score[a] == score[b]) {
          if (in[a] - out[a] == in[b] - out[b]) {
            if (in[a] == in[b]) {
              return a > b;
            }
            return in[a] < in[b];
          }
          return in[a] - out[a] < in[b] - out[b];
        }
        return score[a] < score[b];
      });
      reverse(v.begin(), v.end());
      if (v[0] == B || v[1] == B) {
        if (found && X - Y == bestX - bestY) {
          if (Y < bestY) {
            X = bestX;
            Y = bestY;
          }
        }
        if (!found || X - Y < bestX - bestY) {
          bestX = X;
          bestY = Y;
        }
        found = 1;
      }
      update(X, Y, -1);
    }
  }
  if (!found) {
    cout << "IMPOSSIBLE\n";
    return 0;
  }
  cout << bestX << ":" << bestY << '\n';
}
