#include <bits/stdc++.h>
using namespace std;
struct Team {
  string name;
  int in, out;
  int points;
  inline bool operator<(const Team &o) const {
    if (points != o.points) return points > o.points;
    int d = out - in;
    int od = o.out - o.in;
    if (od != d) return d > od;
    if (out != o.out) return out > o.out;
    return name < o.name;
  }
  Team() { in = out = points = 0; }
} team[6];
int n;
map<string, int> id;
int getid(string s) {
  if (id.find(s) == id.end()) {
    team[n].name = s;
    return id[s] = n++;
  }
  return id[s];
}
int main() {
  int cnt[6];
  for (int i = 0; i < (6); i++) cnt[i] = 0;
  for (int i = 0; i < (5); i++) {
    string a, b, c;
    cin >> a >> b >> c;
    int x, y;
    sscanf(c.c_str(), "%d:%d", &x, &y);
    int u, v;
    u = getid(a);
    v = getid(b);
    team[u].out += x;
    team[u].in += y;
    team[v].out += y;
    team[v].in += x;
    if (x > y) team[u].points += 3;
    if (x < y) team[v].points += 3;
    if (x == y) {
      team[u].points++;
      team[v].points++;
    }
    cnt[u]++;
    cnt[v]++;
  }
  int i = getid("BERLAND");
  int other = 0;
  for (int k = 0; k < (6); k++)
    if (k != i && cnt[k] == 2) other = k;
  int best = -1;
  int bestx = 0, besty = 0;
  for (int x = 1; x <= 100; x++)
    for (int y = 0; y < x; y++) {
      Team t = team[i];
      team[i].points += 3;
      team[i].out += x;
      team[i].in += y;
      Team a[6];
      for (int j = 0; j < (6); j++) a[j] = team[j];
      a[other].in += x;
      a[other].out += y;
      sort(a, a + 6);
      if (a[0].name == "BERLAND" || a[1].name == "BERLAND") {
        int d = x - y;
        if (best == -1 || d < best || (d == best && y < besty)) {
          best = d;
          bestx = x;
          besty = y;
        }
      }
      team[i] = t;
    }
  if (best == -1) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << bestx << ":" << besty << endl;
  }
  return 0;
}
