#include <bits/stdc++.h>
using namespace std;
const string my_team = "BERLAND";
map<string, pair<int, pair<int, int> > > mp;
vector<pair<pair<int, pair<int, int> >, string> > v, tmp;
set<string> name;
vector<string> al;
string teamA, teamB, score;
int solve(int a, int b) {
  if (a > b) {
    return 3;
  } else if (a == b) {
    return 1;
  } else {
    return 0;
  }
}
bool cmp(pair<pair<int, pair<int, int> >, string> x,
         pair<pair<int, pair<int, int> >, string> y) {
  if (x.first.first != y.first.first) {
    return x.first.first < y.first.first;
  }
  if (x.first.second.first != y.first.second.first) {
    return x.first.second.first < y.first.second.first;
  }
  if (x.first.second.second != y.first.second.second) {
    return x.first.second.second < y.first.second.second;
  }
  return x.second > y.second;
}
void change_score_map(string teamA, string teamB, int ga, int gb) {
  mp[teamA].first += solve(ga, gb);
  mp[teamA].second.first += (ga - gb);
  mp[teamA].second.second += ga;
  mp[teamB].first += solve(gb, ga);
  mp[teamB].second.first += (gb - ga);
  mp[teamB].second.second += gb;
}
void change_score_vector(int idm, int opp, int x, int y, int i) {
  v[idm].first.first += solve(x, y);
  v[idm].first.second.first += i;
  v[idm].first.second.second += x;
  v[opp].first.first += solve(y, x);
  v[opp].first.second.first -= i;
  v[opp].first.second.second += y;
}
string find_oppenent() {
  for (int i = 0; i < al.size(); i++) {
    name.erase(al[i]);
  }
  name.erase(my_team);
  string no = *name.begin();
  return no;
}
bool is_possible() {
  tmp = v;
  sort(v.rbegin(), v.rend(), cmp);
  int sec = v[1].first.first;
  int ind;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].second == my_team) {
      ind = i;
      break;
    }
  }
  int mys = v[ind].first.first;
  if (mys + 3 < sec) {
    return false;
  }
  v = tmp;
  return true;
}
void print_answer(int x, int y) {
  cout << x << ":" << y << endl;
  exit(0);
}
int main() {
  for (int i = 1; i <= 5; i++) {
    cin >> teamA >> teamB >> score;
    name.insert(teamA);
    name.insert(teamB);
    if (teamA == my_team) {
      al.push_back(teamB);
    }
    if (teamB == my_team) {
      al.push_back(teamA);
    }
    int ga = score[0] - '0', gb = score[2] - '0';
    change_score_map(teamA, teamB, ga, gb);
  }
  string no = find_oppenent();
  for (map<string, pair<int, pair<int, int> > >::iterator it = mp.begin();
       it != mp.end(); it++) {
    v.push_back(make_pair(it->second, it->first));
  }
  if (!is_possible()) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  int idm, opp;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].second == my_team) {
      idm = i;
    } else if (v[i].second == no) {
      opp = i;
    }
  }
  for (int i = 1; i < 100; i++) {
    for (int y = 0; y <= 100; y++) {
      int x = y + i;
      change_score_vector(idm, opp, x, y, i);
      sort(v.rbegin(), v.rend(), cmp);
      int pos;
      for (int j = 0; j < v.size(); j++) {
        if (v[j].second == my_team) {
          pos = j;
          break;
        }
      }
      if (pos <= 1) {
        print_answer(x, y);
      }
      v = tmp;
    }
  }
  return 0;
}
