#include <bits/stdc++.h>
using namespace std;
struct G {
  string team;
  int played, points, scored, missed, diff;
} x[5];
bool cmp(G a, G b) {
  if (a.points != b.points)
    return a.points > b.points;
  else if (a.points == b.points) {
    if (a.diff != b.diff)
      return a.diff > b.diff;
    else if (a.diff == b.diff) {
      if (a.scored != b.scored)
        return a.scored > b.scored;
      else
        return a.team < b.team;
    }
  }
}
bool ok() {
  if (x[0].team == "BERLAND" || x[1].team == "BERLAND")
    return 1;
  else
    return 0;
}
int main() {
  string s1, s2, s3;
  char ch;
  int k = 0, team, B;
  for (int i = 0; i < 5; i++) {
    int f1 = 0, f2 = 0;
    cin >> s1 >> s2 >> s3;
    for (int j = 0; j < 4; j++) {
      if (x[j].team == s1)
        f1 = 1;
      else if (x[j].team == s2)
        f2 = 1;
    }
    if (f1 == 0 && f2 == 0)
      x[k++].team = s1, x[k++].team = s2;
    else if (f1 == 1 && f2 == 0)
      x[k++].team = s2;
    else if (f1 == 0 && f2 == 1)
      x[k++].team = s1;
    if (s3[0] == s3[2])
      ch = 'd';
    else if (s3[0] > s3[2])
      ch = '1';
    else
      ch = '2';
    for (int j = 0; j < 4; j++) {
      if (x[j].team == s1) {
        x[j].scored += s3[0] - 48;
        x[j].missed += s3[2] - 48;
        x[j].played++;
        if (ch == 'd')
          x[j].points++;
        else if (ch == '1')
          x[j].points += 3;
      } else if (x[j].team == s2) {
        x[j].scored += s3[2] - 48;
        x[j].missed += s3[0] - 48;
        x[j].played++;
        if (ch == 'd')
          x[j].points++;
        else if (ch == '2')
          x[j].points += 3;
      }
    }
  }
  for (int i = 0; i < 4; i++) {
    x[i].diff = x[i].scored - x[i].missed;
  }
  sort(x, x + 4, cmp);
  for (int i = 0; i < 4; i++) {
    if (x[i].played == 2 && x[i].team != "BERLAND") team = i;
    if (x[i].team == "BERLAND") B = i;
  }
  if (x[1].points - x[B].points > 3)
    cout << "IMPOSSIBLE" << endl;
  else {
    int X, Y, mini = 1 << 30, tmp, tmp1, tmp2;
    x[B].points += 3;
    for (int i = 1; i <= 200; i++) {
      x[B].scored++;
      x[B].diff++;
      x[team].diff--;
      tmp1 = x[team].scored;
      tmp = x[B].diff;
      tmp2 = x[team].diff;
      for (int j = 0; j < i; j++) {
        if (j > 0) {
          x[team].scored++;
          x[B].diff--;
          x[team].diff++;
        }
        sort(x, x + 4, cmp);
        if (i - j < mini && ok()) {
          mini = i - j;
          X = i, Y = j;
        }
        for (int i = 0; i < 4; i++) {
          if (x[i].played == 2 && x[i].team != "BERLAND") team = i;
          if (x[i].team == "BERLAND") B = i;
        }
      }
      x[B].diff = tmp;
      x[team].scored = tmp1;
      x[team].diff = tmp2;
    }
    cout << X << ":" << Y << endl;
  }
  return 0;
}
