#include <bits/stdc++.h>
using namespace std;
const int M = 4 + 10;
struct TEAM {
  string name;
  int score;
  int goal;
  int missed;
  bool operator<(const TEAM& x) const {
    if (score != x.score) {
      return score > x.score;
    } else {
      if ((goal - missed) != (x.goal - x.missed)) {
        return (goal - missed) > (x.goal - x.missed);
      } else {
        if (goal != x.goal) {
          return goal > x.goal;
        } else {
          return name < x.name;
        }
      }
    }
  }
} team1[M], team2[M];
map<string, int> ntoid;
int ihash[M];
int main() {
  int cnt = 0;
  for (int i = 0; i < 5; i++) {
    string t1, t2;
    string result;
    cin >> t1 >> t2 >> result;
    int score1, score2;
    score1 = result[0] - '0';
    score2 = result[2] - '0';
    int id = -1;
    if (ntoid.find(t1) != ntoid.end()) {
      id = ntoid[t1];
    } else {
      ntoid[t1] = cnt;
      id = ntoid[t1];
      cnt++;
    }
    team1[id].goal += score1;
    team1[id].missed += score2;
    if (score1 > score2) {
      team1[id].score += 3;
    }
    if (score1 == score2) {
      team1[id].score += 1;
    }
    team1[id].name = t1;
    ihash[id]++;
    id = -1;
    if (ntoid.find(t2) != ntoid.end()) {
      id = ntoid[t2];
    } else {
      ntoid[t2] = cnt;
      id = ntoid[t2];
      cnt++;
    }
    team1[id].goal += score2;
    team1[id].missed += score1;
    if (score2 > score1) {
      team1[id].score += 3;
    }
    if (score1 == score2) {
      team1[id].score += 1;
    }
    team1[id].name = t2;
    ihash[id]++;
  }
  string s;
  for (int i = 0; i < 4; i++) {
    if (ihash[i] < 3 && team1[i].name != "BERLAND") {
      s = team1[i].name;
    }
  }
  int id1 = ntoid["BERLAND"];
  int id2 = ntoid[s];
  int Y, X;
  Y = X = -1;
  for (int d = 1; d <= 100; d++) {
    for (int y = 0; y <= 100; y++) {
      int x = y + d;
      for (int i = 0; i < 4; i++) {
        team2[i].goal = team1[i].goal;
        team2[i].missed = team1[i].missed;
        team2[i].score = team1[i].score;
        team2[i].name = team1[i].name;
      }
      team2[id1].score += 3;
      team2[id1].goal += x;
      team2[id1].missed += y;
      team2[id2].goal += y;
      team2[id2].missed += x;
      sort(team2, team2 + 4);
      if (team2[0].name == "BERLAND" || team2[1].name == "BERLAND") {
        Y = y;
        X = x;
        break;
      }
    }
    if (Y != -1) {
      break;
    }
  }
  if (Y == -1) {
    cout << "IMPOSSIBLE" << endl;
  } else {
    cout << X << ":" << Y << endl;
  }
  return 0;
}
