#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-7;
const long long maxint = 2147483647;
const long long minint = -2147483648;
using namespace std;
long long MIN(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long MAX(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long power(long long a, long long p) {
  if (p == 0) return 1;
  if (p & 1) {
    return a * power(a, p - 1);
  } else {
    long long c = power(a, p / 2);
    return c * c;
  }
}
map<string, int> m;
struct team {
  char name[30];
  int dif, goal, point;
  int play;
};
vector<team> t(6);
char buf[30];
bool compare(const team &a, const team &b) {
  if (a.point > b.point)
    return true;
  else if (a.point == b.point && a.dif > b.dif)
    return true;
  else if (a.point == b.point && a.dif == b.dif && a.goal > b.goal)
    return true;
  else if (a.point == b.point && a.dif == b.dif && a.goal == b.goal &&
           strcmp(a.name, b.name) < 0)
    return true;
  else
    return false;
}
int main() {
  int i;
  int num = 1;
  for (i = 0; i < 5; i++) {
    scanf("%s", buf);
    int u;
    if (m[buf] == 0) {
      m[buf] = num++;
    }
    u = m[buf];
    strcpy(t[u].name, buf);
    scanf("%s", buf);
    int v;
    if (m[buf] == 0) {
      m[buf] = num++;
    }
    v = m[buf];
    strcpy(t[v].name, buf);
    int x, y;
    scanf("%d:%d", &x, &y);
    if (x > y) {
      t[u].point += 3;
    } else if (x == y) {
      t[u].point++;
      t[v].point++;
    } else
      t[v].point += 3;
    t[u].dif += x - y;
    t[v].dif += y - x;
    t[u].goal += x;
    t[v].goal += y;
    t[u].play++;
    t[v].play++;
  }
  sort(t.begin() + 1, t.begin() + 1 + 4, compare);
  int x = -1, y = -1;
  int j, k;
  int ber, op;
  for (k = 1; k <= 4; k++) {
    if (t[k].play == 2) {
      if (strcmp(t[k].name, "BERLAND") == 0)
        ber = k;
      else
        op = k;
    }
  }
  t[ber].point += 3;
  for (i = 1; i < 100; i++) {
    for (j = 0; j < i; j++) {
      for (k = 1; k <= 4; k++) {
        if (t[k].play == 2) {
          if (strcmp(t[k].name, "BERLAND") == 0)
            ber = k;
          else
            op = k;
        }
      }
      t[ber].goal += i;
      t[op].goal += j;
      t[ber].dif += i - j;
      t[op].dif += j - i;
      sort(t.begin() + 1, t.begin() + 1 + 4, compare);
      for (k = 1; k <= 4; k++) {
        if (t[k].play == 2) {
          if (strcmp(t[k].name, "BERLAND") == 0)
            ber = k;
          else
            op = k;
        }
      }
      if (ber == 2 || ber == 1) {
        if (x == -1) {
          x = i;
          y = j;
        } else if (i - j < x - y) {
          x = i;
          y = j;
        } else if (i - j == x - y && j < y) {
          x = i;
          y = j;
        }
      }
      t[ber].goal -= i;
      t[op].goal -= j;
      t[ber].dif -= i - j;
      t[op].dif -= j - i;
    }
  }
  if (x == -1) {
    printf("IMPOSSIBLE\n");
  } else
    printf("%d:%d\n", x, y);
  return 0;
}
