import java.util.Scanner;

public class Championship implements Runnable {
  boolean check(String[] name, int op, int g0, int gop, int[] s, int[] g, int[] d) {
    if (g0 <= gop) throw new RuntimeException();

    s[0] += 3;
    g[0] += g0;
    g[op] += gop;
    d[0] += g0 - gop;
    d[op] += gop - g0;

    int[] n = new int[4];
    for (int i = 0; i < 4; i++) {
      n[i] = i;
    }
    for (int i = 0; i < 4; i++) {
      for (int j = i + 1; j < 4; j++) {
        if (first(n[j], n[i], name, s, g, d)) {
          int t = n[i]; n[i] = n[j]; n[j] = t;
        }
      }
    }

    s[0] -= 3;
    g[0] -= g0;
    g[op] -= gop;
    d[0] -= g0 - gop;
    d[op] -= gop - g0;

    return n[0] == 0 || n[1] == 0;
  }

  boolean first(int i, int j, String[] name, int[] s, int[] g, int[] d) {
    if (s[i] != s[j]) {
      return s[i] > s[j];
    }
    if (d[i] != d[j]) {
      return d[i] > d[j];
    }
    if (g[i] != g[j]) {
      return g[i] > g[j];
    }
    return name[i].compareTo(name[j]) < 0;
  }
  public void run() {
    try {
      Scanner in = new Scanner(System.in);
      String[] name = new String[4];
      name[0] = "BERLAND";
      int[] score = new int[4];
      boolean[] was = new boolean[4];
      int[] g = new int[4];
      int[] d = new int[4];
      int c = 1;
      for(int i = 0; i < 5; i++) {
        String s1 = in.next();
        boolean f = false;
        int p1 = -1;
        for (int j = 0; j < c; j++) {
          if (name[j].equals(s1)) {
            f = true;
            p1 = j;
          }
        }
        if (!f) {
          p1 = c;
          name[c++] = s1;
        }
        String s2 = in.next();
        f = false;
        int p2 = -1;
        for (int j = 0; j < c; j++) {
          if (name[j].equals(s2)) {
            f = true;
            p2 = j;
          }
        }
        if (!f) {
          p2 = c;
          name[c++] = s2;
        }
        if (p1 == 0 || p2 == 0) {
          was[p2] = true;
          was[p1] = true;
        }
        String[] p = in.next().split(":");
        int g1 = Integer.parseInt(p[0]);
        int g2 = Integer.parseInt(p[1]);
        if (g1 > g2) {
          score[p1] += 3;
        } else if (g1 == g2) {
          score[p1] += 1;
          score[p2] += 1;
        } else {
          score[p2] += 3;
        }
        g[p1] += g1;
        g[p2] += g2;
        d[p1] += g1 - g2;
        d[p2] += g2 - g1;
      }
      int o = 0;
      for (int i = 0; i < 4; i++) {
        if (!was[i]) o = i;
      }
      if (o == 0) throw new RuntimeException();
      int g0 = -1;
      int g1 = -1;
      for (int i = 1; i < 100; i++) {
        for (int j = i - 1; j >= 0; j--) {
          if (check(name, o, i, j, score, g, d)) {
            if (g0 == -1 || (i - j < g0 - g1 || (i - j == g0 - g1 && g1 > j))) {
              g0 = i;
              g1 = j;
            }
          }
        }
      }
      if (g0 == -1) {
        System.out.println("IMPOSSIBLE");
      } else {
        System.out.println(g0 + ":" + g1);
      }
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  public static void main(String[] args) {
    new Thread(new Championship()).start();
  }
}

import java.io.*;
import java.util.*;

/**
 * */
public class Solution {

	public static List<Team> listTeams=Collections.synchronizedList(new ArrayList<Team>(4));
	public static Team BERLAND=null;
	public static TeamComparator teamComparator=null;

	public class Team{
		public String name;
		public Map<String,Integer> selfScores=Collections.synchronizedMap(new HashMap<String,Integer>());
		public Map<String,Integer> oppScores=Collections.synchronizedMap(new HashMap<String,Integer>());

		public Integer points=0;
		public Integer goalDiff=0;
		public Integer goalFor=0;

		public Team(String name){
			this.name=name;
		}
	}
	public Team newTeam(String name){
		return new Team(name);
	}

	public static Team getTeam(String name){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			if(team.name.equals(name))
				return team;
		}
		return null;
	}

	public static int getBerlandRanking(){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			team.points=team.goalDiff=team.goalFor=0;
			Iterator<String> iterOpp=team.selfScores.keySet().iterator();
			while(iterOpp.hasNext()){
				String oppName=iterOpp.next();
				int selfScore=team.selfScores.get(oppName);
				int oppScore=team.oppScores.get(oppName);
				team.points+=(selfScore>oppScore)?3:(selfScore==oppScore)?1:0;
				team.goalDiff+=(selfScore-oppScore);
				team.goalFor+=selfScore;
				}}
		Collections.sort(listTeams,teamComparator);
		return listTeams.indexOf(BERLAND);
	}

	public class TeamComparator implements Comparator<Team>{

		@Override
		public int compare(Team team1, Team team2) {
			if(team1.points.equals(team2.points)){
				if(team1.goalDiff.equals(team2.goalDiff)){
					if(team1.goalFor.equals(team2.goalFor))
						return team2.name.compareTo(team1.name);
					return team1.goalFor.compareTo(team2.goalFor);
				}
				return team1.goalDiff.compareTo(team2.goalDiff);
			}
			return team1.points.compareTo(team2.points);
		}}
	public TeamComparator newTeamComparator(){
		return new TeamComparator(); }

	/**
	 * @param args
	 */
	public static void main(String[] args){
	    try {

	    	BufferedReader reader =new BufferedReader( new InputStreamReader( System.in)); // STDIN

	    	// Teams
	    	Solution solution=new Solution();
	    	listTeams.add(solution.newTeam("BERLAND"));
	    	BERLAND=getTeam("BERLAND");
	    	teamComparator=solution.newTeamComparator();

	    	//
	    	for(int i=0;i!=5;i++){
	    		String[] result=reader.readLine().trim().split(" ",3);
	    		// Team1
	    		String name1=result[0].trim();
	    		Team team1=getTeam(name1);
	    		if(team1==null){
	    			listTeams.add(solution.newTeam(name1));
	    			team1=getTeam(name1);
	    		}
	    		// Team2
	    		String name2=result[1].trim();
	    		Team team2=getTeam(name2);
	    		if(team2==null){
	    			listTeams.add(solution.newTeam(name2));
	    			team2=getTeam(name2);
	    		}
	    		String[] score=result[2].trim().split(":",2);
	    		Integer score1=Integer.valueOf(score[0].trim());
	    		Integer score2=Integer.valueOf(score[1].trim());
	    		team1.selfScores.put(team2.name,score1);
	    		team1.oppScores.put(team2.name,score2);
	    		team2.selfScores.put(team1.name,score2);
	    		team2.oppScores.put(team1.name,score1);
	    	}

	    	String oppName="";
	    	Iterator<Team> iterTeam=listTeams.iterator();
	    	while(iterTeam.hasNext()&&(oppName=="")){
	    		Team team=iterTeam.next();
	    		if((team.oppScores.size()==2)&&(team.name!="BERLAND"))
	    			oppName=team.name; }

	    	//
	    	boolean bPossible=false;
	    	for(int diff=1;diff<=30;diff++){
	    		for(int opp=0;opp<=30;opp++){
	    			int selfScore=diff+opp;
	    			Team oppTeam=getTeam(oppName);
	    			oppTeam.selfScores.put(BERLAND.name,opp);
	    			oppTeam.oppScores.put(BERLAND.name,selfScore);
	    			BERLAND.selfScores.put(oppName,selfScore);
	    			BERLAND.oppScores.put(oppName,opp);
	    			if(getBerlandRanking()>=2){
	    				System.out.println(selfScore+":"+opp);
	    				bPossible=true;
	    				break;
	    			}
	    		}
	    		if(bPossible)
	    			break;
	    	}
	    	if(!bPossible)
	    		System.out.println("IMPOSSIBLE");

		    }catch(Exception e){
		    	e.printStackTrace(System.err);
		}
	}
}

import java.util.*;
import java.math.*;
import java.io.*;

public class Main
	{
	public static void main(String args[]) throws IOException
		{
		Scanner c=new Scanner(System.in);
		team T[]=new team[4];
		for(int i=0;i<4;i++)
			T[i]=new team(0,0,0,"");
		for(int i=0;i<5;i++)
			{
			String S[]=c.nextLine().split(" ");
			int t1Index=index(T,S[0]);
			if(t1Index==-1)
				{
				t1Index=getFreeIndex(T);
				T[t1Index].name=S[0];
				}
			int t2Index=index(T,S[1]);
			if(t2Index==-1)
				{
				t2Index=getFreeIndex(T);
				T[t2Index].name=S[1];
				}
			int goals1=S[2].charAt(0)-'0';
			int goals2=S[2].charAt(2)-'0';
			if(goals1>goals2)
				T[t1Index].points+=3;
			else if(goals1==goals2)
				{
				T[t1Index].points+=1;
				T[t2Index].points+=1;
				}
			else
				T[t2Index].points+=3;
			T[t1Index].scored+=goals1;
			T[t1Index].missed+=goals2;
			T[t2Index].scored+=goals2;
			T[t2Index].missed+=goals1;
			T[t1Index].occ++;
			T[t2Index].occ++;
			}
		//for(int i=0;i<4;i++)
		//	{
		//	System.out.println(T[i].name+" "+T[i].scored+" "+T[i].missed+" "+T[i].occ);
		//	}
		int berIndex=-1;
		int othIndex=-1;
		for(int i=0;i<4;i++)
			{
			if(T[i].occ==2&&T[i].name.equals("BERLAND"))
				berIndex=i;
			else if(T[i].occ==2)
				othIndex=i;
			}
		//System.out.println("berIndex= "+berIndex+" othIndex= "+othIndex);
		TreeSet<score> Tr=new TreeSet<score>();
		Comparator<team> comp=new Comparator<team>()
			{
			public int compare(team t1,team t2)
				{
				if(t1.points<t2.points)
					return -1;
				else if(t1.points==t2.points)
					{
					int diff1=t1.scored-t1.missed;
					int diff2=t2.scored-t2.missed;
					if(diff1<diff2)
						return -1;
					else if(diff1==diff2)
						{
						if(t1.scored<t2.scored)
							return -1;
						else if(t1.scored==t2.scored)
							{
							if(t1.name.compareTo(t2.name)>0)
								return -1;
							}
						}
					}
				return 1;
				}
			};
		for(int X=1;X<=100;X++)
			{
			for(int Y=0;Y<X;Y++)
				{
				//System.out.println("goals: "+X+" "+Y);
				team Temp[]=new team[4];
				for(int i=0;i<4;i++)
					Temp[i]=new team(T[i].points,T[i].scored,T[i].missed,T[i].name);
				Temp[berIndex].points+=3;
				Temp[berIndex].scored+=X;
				Temp[berIndex].missed+=Y;
				Temp[othIndex].scored+=Y;
				Temp[othIndex].missed+=X;
				Arrays.sort(Temp,comp);
				//for(int i=0;i<4;i++)
				//	System.out.println(Temp[i].name+" "+Temp[i].points+" "+Temp[i].scored+" "+Temp[i].missed);
				if(Temp[3].name.equals("BERLAND")||Temp[2].name.equals("BERLAND"))
					Tr.add(new score(X,Y));
				}
			}
		if(Tr.size()==0)
			System.out.println("IMPOSSIBLE");
		else
			{
			score ans=Tr.first();
			System.out.println(ans.x+":"+ans.y);
			}
		}

	private static int getFreeIndex(team[] T)
		{
		for(int i=0;i<4;i++)
			{
			if(T[i].name.equals(""))
				return i;
			}
		return -1;
		}

	private static int index(team[] T,String string)
		{
		for(int i=0;i<4;i++)
			{
			if(T[i].name.equals(string))
				return i;
			}
		return -1;
		}
	}

class team
	{
	int scored;
	int missed;
	String name;
	int points;
	int occ;
	public team(int points, int scored, int missed, String name)
		{
		this.points=points;
		this.scored=scored;
		this.missed=missed;
		this.name=name;
		this.occ=0;
		}
	}

class score implements Comparable<score>
	{
	int x;
	int y;

	public score(int x,int y)
		{
		this.x=x;
		this.y=y;
		}

	public int compareTo(score o)
		{
		if(this.x-this.y<o.x-o.y)
			return -1;
		if(this.y<o.y)
			return -1;
		if(this.x==o.x&&this.y==o.y)
			return 0;
		return 1;
		}
	}
//must declare new classes here

import java.util.*;

/**
 *
 *

 * Unsolved
 *

 *

 * Created on Jun 24, 2012, 11:16:48 AM
 *

 * @Author Andy Y.F. Huang
 */
public class p200CFootballChampionship {
  class Team implements Comparable<Team> {
    String name;
    int gd;
    int goals;
    int points;

    public Team(Team x) {
      this.name = x.name;
      this.gd = x.gd;
      this.goals = x.goals;
      this.points = x.points;
    }

    public Team(String name) {
      this.name = name;
    }

    public int compareTo(Team o) {
      if (points != o.points)
        return o.points - points;
      if (gd != o.gd)
        return o.gd - gd;
      if (goals != o.goals)
        return o.goals - goals;
      return name.compareTo(o.name);
    }

    public String toString() {
      return name + ";" + points + "," + gd + "," + goals;
    }

  }

  private final String ber = "BERLAND";

  private void solve(int test_number) {
    Map<String, Integer> names = new HashMap<String, Integer>();
    Team teams[] = new Team[4];
    int games[] = new int[4];
    int cur = 1;
    names.put(ber, 0);
    for (int i = 0; i < 5; i++) {
      String a = in.next();
      String b = in.next();
      StringTokenizer st = new StringTokenizer(in.next(), "\t\r\n :");
      if (!names.containsKey(a))
        names.put(a, cur++);
      if (!names.containsKey(b))
        names.put(b, cur++);
      int x = names.get(a);
      int y = names.get(b);
      if (teams[x] == null)
        teams[x] = new Team(a);
      if (teams[y] == null)
        teams[y] = new Team(b);
      games[x]++;
      games[y]++;
      int sc1 = Integer.parseInt(st.nextToken());
      int sc2 = Integer.parseInt(st.nextToken());
      if (sc1 == sc2) {
        teams[x].points++;
        teams[y].points++;
      }
      else if (sc1 > sc2) {
        teams[x].points += 3;
      }
      else
        teams[y].points += 3;
      teams[x].goals += sc1;
      teams[y].goals += sc2;
      teams[x].gd += sc1 - sc2;
      teams[y].gd += sc2 - sc1;
    }

    int other = 1;
    while (games[other] == 3)
      other++;
    int x = 1500, y = 100;
    boolean poss = false;
    for (int a = 0; a < 100; a++) {
      for (int b = 0; b < a; b++) {
        Team copy[] = copy(teams);
        copy[0].points += 3;
        copy[0].goals += a;
        copy[0].gd += a - b;
        copy[other].goals += b;
        copy[other].gd += b - a;
        Arrays.sort(copy);
        int i = 0;
        while (!copy[i].name.equals(ber))
          i++;
        if (i <= 1 && a - b < x - y || (a - b == x - y && b < y)) {// poss
          // pln(Arrays.toString(copy));
          poss = true;
          x = a;
          y = b;
        }
      }
    }
    if (!poss)
      out.appendln("IMPOSSIBLE");
    else
      out.appendln(x + ":" + y);

  }

  private Team[] copy(Team orig[]) {
    Team ans[] = new Team[orig.length];
    for (int i = 0; i < ans.length; i++)
      ans[i] = new Team(orig[i]);
    return ans;
  }

  private Input in;
  private Output out;

  void solve() {
    in = new Input("");
    out = new Output("");
    int tests = 1;
    for (int i = 1; i <= tests; i++)
      solve(i);
    out.flush();
  }

  public static void main(String[] args) {
    p200CFootballChampionship solver = new p200CFootballChampionship();
    solver.solve();
  }
}

final class Input {
  private java.io.BufferedReader reader;
  private java.util.StringTokenizer tokenizer;

  Input(String filename) {
    if (!filename.isEmpty()) {
      try {
        reader = new java.io.BufferedReader(new java.io.FileReader(filename));
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    }
    else
      reader = new java.io.BufferedReader(new java.io.InputStreamReader(
          System.in));
    tokenizer = new java.util.StringTokenizer("");
  }

  String next() {
    while (!tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      }
      catch (java.io.IOException e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  String nextLine() {
    try {
      return reader.readLine();
    }
    catch (java.io.IOException e) {
      throw new RuntimeException(e);
    }
  }

  long nextLong() {
    return Long.parseLong(next());
  }

  int nextInt() {
    return Integer.parseInt(next());
  }

  double nextDouble() {
    return Double.parseDouble(next());
  }

}

final class Output {
  private java.io.PrintWriter buffer;

  Output(String filename) {
    if (!filename.isEmpty())
      try {
        buffer = new java.io.PrintWriter(filename);
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException();
      }
    else
      buffer = new java.io.PrintWriter(System.out);
  }

  void flush() {
    buffer.flush();
  }

  void close() {
    buffer.close();
  }

  void append(Object... obj) {
    for (int i = 0; i < obj.length; i++) {
      if (i != 0)
        buffer.write(' ');
      buffer.print(obj[i]);
    }
  }

  void appendln(Object... obj) {
    append(obj);
    buffer.write('\n');
  }

}

import java.io.*;
import java.util.*;

public class C {

	HashMap<String, Team> mapper = new HashMap<String, C.Team>();
	ArrayList<Team> teams = new ArrayList<C.Team>();

	void run() throws IOException{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		Team berland=null;

		for(int i=0; i<5; i++){
			String[] toks = bf.readLine().trim().split("[ :]+");
			Team t1 = mapper.get(toks[0]);
			if(t1==null){
				t1 = new Team(toks[0]);
				mapper.put(toks[0], t1);
				teams.add(t1);
			}

			Team t2 = mapper.get(toks[1]);
			if(t2==null){
				t2 = new Team(toks[1]);
				mapper.put(toks[1], t2);
				teams.add(t2);
			}
			int g1 = Integer.parseInt(toks[2]);
			int g2 = Integer.parseInt(toks[3]);
			t1.addResult(g1, g2);
			t2.addResult(g2, g1);
		}

		Collections.sort(teams);
//		for(int i=0; i<teams.size(); i++) System.out.println(teams.get(i));
		Team t2=null;
		for(int i=0; i<teams.size(); i++){
			if(teams.get(i).name.equals("BERLAND")) berland = teams.get(i);
			else if(teams.get(i).numPlayed<3) t2 = teams.get(i);
		}

		if(berland.points+3<teams.get(1).points){
			System.out.println("IMPOSSIBLE");
		} else if(teams.get(1).name.equals("BERLAND") || berland.points+3>teams.get(1).points){
			System.out.println("1:0");
		} else{
			for(int diff=1; diff<100; diff++){
				for(int g1=diff; g1<100; g1++){
					int g2 = g1-diff;
					berland.addResult(g1, g2);
					t2.addResult(g2, g1);

					Collections.sort(teams);
					if(berland.compareTo(teams.get(1)) <= 0){
						System.out.println(g1 + ":" + g2);
						return;
					}else{
						berland.removeResult(g1, g2);
						t2.removeResult(g2, g1);
						Collections.sort(teams);
					}
				}
			}
		}
	}

	public static void main(String[] args)throws IOException {
		new C().run();
	}

	class Team implements Comparable<Team>{

		String name;
		int points;
		int goals;
		int misses;
		int numPlayed=0;

		public Team(String name){
			this.name = name;
		}

		void addResult(int goals, int misses){
			numPlayed++;
			this.goals += goals;
			this.misses += misses;
			if(goals>misses) points+=3;
			else if(goals==misses) points++;
		}

		void removeResult(int goals, int misses){
			numPlayed--;
			this.goals -= goals;
			this.misses -= misses;
			if(goals>misses) points-=3;
			else if(goals==misses) points--;
		}

		@Override
		public int compareTo(Team t) {
			int diff = t.points-points;
			if(diff==0) diff = (t.goals-t.misses) - (goals-misses);
			if(diff==0) diff = t.goals-goals;
			if(diff==0) diff = name.compareTo(t.name);
			return diff;
		}

		public String toString(){
			String s = name + ": " + points + ", " + goals + ", " + misses +", played = " + numPlayed;
			return s;
		}
	}
}

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;

public class C {

        final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
        BufferedReader in;
        PrintWriter out;
        StringTokenizer tok = new StringTokenizer("");

        void init() throws FileNotFoundException{
                if (ONLINE_JUDGE){
                        in = new BufferedReader(new InputStreamReader(System.in));
                        out = new PrintWriter(System.out);
                }else{
                        in = new BufferedReader(new FileReader("input.txt"));
                        out = new PrintWriter("output.txt");
                }
        }

        String readString() throws IOException{
                while(!tok.hasMoreTokens()){
                        tok = new StringTokenizer(in.readLine());
                }
                return tok.nextToken();
        }

        int readInt() throws IOException{
                return Integer.parseInt(readString());
        }

        long readLong() throws IOException{
                return Long.parseLong(readString());
        }

        double readDouble() throws IOException{
                return Double.parseDouble(readString());
        }

        int[] readArr(int n) throws IOException{
        	int[] res = new int[n];
        	for(int i = 0; i < n; i++){
        		res[i] = readInt();
        	}
        	return res;
        }

        long[] readArrL(int n) throws IOException{
        	long[] res = new long[n];
        	for(int i = 0; i < n; i++){
        		res[i] = readLong();
        	}
        	return res;
        }

        public static void main(String[] args){
                new C().run();
        }

        public void run(){
                try{
                        long t1 = System.currentTimeMillis();
                        init();
                        solve();
                        out.close();
                        long t2 = System.currentTimeMillis();
                        System.err.println("Time = "+(t2-t1));
                }catch (Exception e){
                        e.printStackTrace(System.err);
                        System.exit(-1);
                }
        }

        class Command implements Comparable<Command>{
        	String name;
        	int points, games, plus, minus;
			public Command(String name) {
				super();
				this.name = name;
			}
			@Override
			public int compareTo(Command o) {
				if(this.points > o.points) return -1;
				if(this.points < o.points) return 1;
				if(this.plus - this.minus > o.plus - o.minus) return -1;
				if(this.plus - this.minus < o.plus - o.minus) return 1;
				if(this.plus > o.plus) return -1;
				if(this.plus < o.plus) return 1;
				return this.name.compareTo(o.name);
			}

        }

        void solve() throws IOException{
        	Command[] commands = new Command[4];
        	commands[0] = new Command("BERLAND");
        	int cur = 1;
        	for(int i = 0; i < 5; i++){
        		String s1 = readString();
        		String s2 = readString();
        		String res = readString();
        		int a1 = res.charAt(0) - '0';
        		int a2 = res.charAt(2) - '0';
        		int x1 = -1;
        		int x2 = -1;

        		for(int j = 0; j < cur; j++){
        			if(commands[j].name.compareTo(s1) == 0) x1 = j;
        		}
        		if(x1 == -1){
        			commands[cur] = new Command(s1);
        			cur++;
        			x1 = cur-1;
        		}
        		for(int j = 0; j < cur; j++){
        			if(commands[j].name.compareTo(s2) == 0) x2 = j;
        		}
        		if(x2 == -1){
        			commands[cur] = new Command(s2);
        			cur++;
        			x2 = cur-1;
        		}

        		commands[x1].plus += a1;
        		commands[x1].minus += a2;
        		commands[x2].plus += a2;
        		commands[x2].minus += a1;

        		if(a1>a2) commands[x1].points += 3;
        		if(a2>a1) commands[x2].points += 3;
        		if(a1 == a2){
        			commands[x1].points++;
        			commands[x2].points++;
        		}
        		commands[x1].games++;
        		commands[x2].games++;
        	}

        	Arrays.sort(commands);

        	int num = -1;
        	for(int i = 0; i < 4; i++){
        		if(commands[i].name.compareTo("BERLAND") == 0) num = i;
        	}
        	int z = 0;
        	for(int i = 0; i < 4; i++){
        		if(commands[i].name.compareTo("BERLAND") != 0 && commands[i].games == 2) z = i;
        	}

        	commands[num].points += 3;

        	for(int i = 1; i < 100; i++){
        		for(int j = 0; j < 100; j++){
        			Command[] c1 = new Command[4];
        			for(int o = 0; o < 4; o++){
        				c1[o] = new Command(commands[o].name);
        				c1[o].games = commands[o].games;
        				c1[o].points = commands[o].points;
        				c1[o].minus = commands[o].minus;
        				c1[o].plus = commands[o].plus;
        			}

        			c1[num].minus += j;
        			c1[num].plus += i+j;
        			c1[z].plus += j;
        			c1[z].minus += i+j;

        			Arrays.sort(c1);
        			int y = -1;
        			for(int o = 0; o < 4; o++){
        				if(c1[o].name.compareTo("BERLAND") == 0) y = o;
        			}
        			if(y < 2){
        				out.println((i+j)+":"+j);
        				return;
        			}
        		}
        	}

        	out.println("IMPOSSIBLE");
        }

        void maxHepify(int[] a, int i, int length){
        	int l = (i<<1) + 1;
        	int r = (i<<1) + 2;
        	int largest = i;
        	if(l < length && a[l] > a[largest])
        		largest = l;
        	if(r < length && a[r] > a[largest])
        		largest = r;
        	if(largest != i){
        		a[largest] += a[i];
        		a[i] = a[largest] - a[i];
        		a[largest] -= a[i];
        		maxHepify(a, largest, length);
        	}
        }

        void buildMaxHeap(int[] a){
        	for(int i = a.length/2 - 1; i >= 0; i--){
        		maxHepify(a, i, a.length);
        	}
        }

        void heapSort(int[] a){
        	buildMaxHeap(a);
        	for(int i = a.length - 1; i > 0; i--){
        		a[i] += a[0];
        		a[0] = a[i] - a[0];
        		a[i] -= a[0];
        		maxHepify(a, 0, i);
        	}
        }

        int[] zFunction(char[] s){
        	int[] z = new int[s.length];
        	z[0] = 0;
        	for (int i=1, l=0, r=0; i<s.length; ++i) {
        		if (i <= r)
        			z[i] = min (r-i+1, z[i-l]);
        		while (i+z[i] < s.length && s[z[i]] == s[i+z[i]])
        			++z[i];
        		if (i+z[i]-1 > r){
        			l = i;
        			r = i+z[i]-1;
        		}
        	}
        	return z;
        }

        int[] prefixFunction(char[] s){
        	int[] pr = new int[s.length];
        	for (int i = 1; i< s.length; ++i) {
        		int j = pr[i-1];
        		while (j > 0 && s[i] != s[j])
        			j = pr[j-1];
        		if (s[i] == s[j])  ++j;
        		pr[i] = j;
        	}
        	return pr;
        }

        int ModExp(int a, int n, int mod){
        	int res = 1;
        	while (n!=0)
        		if ((n & 1) != 0) {
        			res = (res*a)%mod;
        			--n;
        		}
        		else {
        			a = (a*a)%mod;
        			n >>= 1;
        		}
        	return res;
        }

        public static class Utils {

        	private Utils() {}

        	public static void mergeSort(int[] a) {
                    mergeSort(a, 0, a.length - 1);
            }

        	private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
                    final int MAGIC_VALUE = 50;
                    if (leftIndex < rightIndex) {
                            if (rightIndex - leftIndex <= MAGIC_VALUE) {
                                    insertionSort(a, leftIndex, rightIndex);
                            } else {
                                    int middleIndex = (leftIndex + rightIndex) / 2;
                                    mergeSort(a, leftIndex, middleIndex);
                                    mergeSort(a, middleIndex + 1, rightIndex);
                                    merge(a, leftIndex, middleIndex, rightIndex);
                            }
                    }
            }

            private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
            	int length1 = middleIndex - leftIndex + 1;
            	int length2 = rightIndex - middleIndex;
                int[] leftArray = new int[length1];
                int[] rightArray = new int[length2];
                System.arraycopy(a, leftIndex, leftArray, 0, length1);
                System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
                for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                    if (i == length1) {
                            a[k] = rightArray[j++];
                    } else if (j == length2) {
                            a[k] = leftArray[i++];
                    } else {
                            a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                    }
                }
            }

            private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
                for (int i = leftIndex + 1; i <= rightIndex; i++) {
            		int current = a[i];
                    int j = i - 1;
                	while (j >= leftIndex && a[j] > current) {
                        a[j + 1] = a[j];
                        j--;
                        }
                    a[j + 1] = current;
                }
            }
        }

        boolean isPrime(int a){
        	for(int i = 2; i <= sqrt(a); i++)
        		if(a % i == 0) return false;
        	return true;
        }

        static double distance(long x1, long y1, long x2, long y2){
        	return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
        }

        static long gcd(long a, long b){
        	if(min(a,b) == 0) return max(a,b);
        	return gcd(max(a, b) % min(a,b), min(a,b));
        }

        static long lcm(long a, long b){
        	return a * b /gcd(a, b);
        }
}

/*class Treap<K extends Comparable<K>>{

	public K x;
	public double y;
	public Treap<K> left;
	public Treap<K> right;

	public Treap(K x, double y, Treap<K> left, Treap<K> right) {
		this.x = x;
		this.y = y;
		this.left = left;
		this.right = right;
	}

	public static <K extends Comparable<K>> Treap<K> merge(Treap<K> l, Treap<K> r){
		if(l == null) return r;
		if(r == null) return l;
		if(l.y > r.y){
			return new Treap<K>(l.x, l.y, l.left, merge(l.right, r));
		}
		else{
			return new Treap<K>(r.x, r.y, merge(l, r.left), r.right);
		}
	}

	public void split(K x, Treap<K> left, Treap<K> right){
		Treap<K> newTreap = null;
		if(this.x.compareTo(x) <= 0){
			if(this.right == null){
				right = null;
			}
			else{
				right.split(x, newTreap, right);
			}
			left = new Treap<K>(this.x, this.y, left, newTreap);
		}
		else{
			if(this.left == null){
				left = null;
			}
			else{
				left.split(x, left, newTreap);
			}
			right = new Treap<K>(x, y, newTreap, right);
		}
	}

	public Treap<K> add(K x){
		Treap<K> left = null, right = null;
		this.split(x, left, right);
		Treap<K> temp = new Treap<K>(x, random(), null, null);
		return merge(merge(left, temp), right);
	}

	@SuppressWarnings("null")
	public Treap<K> remove(K x){
		Treap<K> left = null, temp = null, right = null;
		this.split(x, left, right);
		right.split(x, temp, right);
		return merge(left, right);
	}

	public static <K extends Comparable<K>> Treap<K> build(K[] a){
		Treap<K> temp = new Treap<K>(a[0], random(), null, null);
		for(int i = 1; i < a.length; i++){
			temp = temp.add(a[i]);
		}
		return temp;
	}
}*/

//package contest_126_div2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
 * Date     : Jun 24, 2012
 * Time     : 2:10:30 PM
 * Email    : denys.astanin@gmail.com
 */

public class C {
	public static void main(String[] args) throws IOException {
		new C().run();
	}

	int nextInt() throws IOException {
		in.nextToken();
		return (int) in.nval;
	}

	String nextString() throws IOException {
		in.nextToken();
		return (String) in.sval;
	}

	StreamTokenizer in;
	Writer writer;
	Reader reader;
	private class Team implements Comparable <Team>{
		String name;
		int zabito;
		int prop;
		int scores;
		int played;
		public Team(String name) {
			this.name = name;
		}
		public Team(String name, int zabito, int prop, int scores) {
			this.name = name;
			this.zabito = zabito;
			this.prop = prop;
			this.scores = scores;
		}
		@Override
		public int compareTo(Team second) {
			if (scores > second.scores)
				return -1;

			if (scores < second.scores)
				return 1;

			if (zabito - prop > second.zabito - second.prop) {
				return -1;
			}

			if (zabito - prop < second.zabito - second.prop) {
				return 1;
			}

			if (zabito > second.zabito) {
				return -1;
			}

			if (zabito < second.zabito) {
				return 1;
			}
			return name.compareTo(second.name);
		}

		@Override
		public String toString() {
			return name + "| scores = " + scores + "| zabito = " + zabito + "| propusheno = " + prop;
		}
	}
	void run() throws IOException {
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		reader = oj ? new InputStreamReader(System.in, "ISO-8859-1")
				: new FileReader("src/contest_126_div2/C.txt");
		writer = new OutputStreamWriter(System.out, "ISO-8859-1");
		in = new StreamTokenizer(new BufferedReader(reader));
		PrintWriter out = new PrintWriter(writer);
		String[] firstTeam = new String[5];
		int[] firstScore   = new int[5];
		String[] secondTeam = new String[5];
		int[] secondScore = new int[5];

		Map<String, Team> teams = new HashMap<String, Team>();
		List<Team> list = new ArrayList<Team>();
		int[] answ = new int[2];

		for (int i = 0; i < 5; i++) {
			firstTeam[i] = nextString();
			secondTeam[i] = nextString();
			firstScore[i] = nextInt();
			nextString();
			secondScore[i] = nextInt();
			Team team1 = teams.get(firstTeam[i]);
			Team team2 = teams.get(secondTeam[i]);
			if (team1 == null) {
				team1 = new Team(firstTeam[i]);
				teams.put(firstTeam[i], team1);
				list.add(team1);
			}
			if (team2 == null) {
				team2 = new Team(secondTeam[i]);
				teams.put(secondTeam[i], team2);
				list.add(team2);
			}
			if (firstScore[i] == secondScore[i]) {
				team1.scores++;
				team2.scores++;
			}
			if (firstScore[i] > secondScore[i]) {
				team1.scores+= 3;
			}
			if (firstScore[i] < secondScore[i]) {
				team2.scores+= 3;
			}
			team1.zabito += firstScore[i];
			team2.zabito += secondScore[i];

			team1.prop += secondScore[i];
			team2.prop += firstScore[i];

			team1.played++;
			team2.played++;
		}
		Iterator<Team> it = list.iterator();
		Team opponentTeam = null;
		Team berlandTeam = teams.get("BERLAND");
		while (it.hasNext()) {
			Team team = it.next();
			if (!"BERLAND".equals(team.name) && team.played != 3) {
				opponentTeam = team;
				break;
			}
		}
		Collections.sort(list);

		int berlandPos = getPost(list, berlandTeam);
		int opponentPos = getPost(list, opponentTeam);

		if (berlandPos <= 2) {
			answ[0] = 1;
			answ[1] = 0;
			out.println(answ[0] + ":" + answ[1]);
			out.flush();
			out.close();
			return;
		}

		Team best = null;
		for (int x = 1; x < 1000; x++) {
			for (int y = 0; y < x; y++) {
				Team test = new Team("BERLAND", berlandTeam.zabito + x, berlandTeam.prop + y, berlandTeam.scores + 3);
				opponentTeam.zabito += y;
				opponentTeam.prop += x;
				Collections.sort(list);
				Team sTeam = list.get(1);
				if (test.compareTo(sTeam) < 0 && (best == null || test.compareTo(best) > 0)) {
					best = test;
				}
				opponentTeam.zabito -= y;
				opponentTeam.prop -= x;
			}
		}

		out.println(best == null ? "IMPOSSIBLE" : (best.zabito - berlandTeam.zabito) + ":" + (best.prop - berlandTeam.prop));
		out.flush();
		out.close();
	}

	int getPost(List<Team> lst, Team team) {
		for (int i = 0; i < lst.size(); i++) {
			if (lst.get(i).name.equals(team.name))
				return i+1;
		}
		return 0;
	}
}

//package round126;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("BERLAND", 0);
		int p = 1;
		String[] name = new String[4];
		int[] played = new int[4];
		int[] obt = new int[4];
		int[] miss = new int[4];
		int[] point = new int[4];

		for(int i = 0;i < 5;i++){
			String a = ns();
			String b = ns();
			if(!map.containsKey(a)){
				map.put(a, p++);
			}
			if(!map.containsKey(b)){
				map.put(b, p++);
			}

			int as = ni();
			int bs = ni();
			int at = map.get(a);
			int bt = map.get(b);
			played[at]++;
			played[bt]++;

			obt[at] += as; miss[bt] += as;
			obt[bt] += bs; miss[at] += bs;
			if(as > bs){
				point[at] += 3;
			}else if(as < bs){
				point[bt] += 3;
			}else{
				point[at] += 1;
				point[bt] += 1;
			}
		}

		for(Map.Entry<String, Integer> e : map.entrySet()){
			name[e.getValue()] = e.getKey();
		}

		int op = 0;
		for(int i = 1;i < 4;i++){
			if(played[i] == 2){
				op = i;
				break;
			}
		}

		int ox = -1, oy = 9999999;
		int minxy = 9999999;

		point[0] += 3;
		for(int x = 0;x <= 300;x++){
			for(int y = 0;y < x;y++){
				obt[0] += x; miss[op] += x;
				obt[op] += y; miss[0] += y;
				int r = rank(name, obt, miss, point);
				if(r <= 2){
					if(x - y < minxy){
						minxy = x - y;
						ox = x;
						oy = y;
					}else if(x - y == minxy && y < oy){
						ox = x;
						oy = y;
					}
				}
				obt[0] -= x; miss[op] -= x;
				obt[op] -= y; miss[0] -= y;
			}
		}

		if(ox == -1){
			out.println("IMPOSSIBLE");
		}else{
			out.println(ox + ":" + oy);
		}
	}

	int rank(String[] name, int[] obt, int[] miss, int[] point)
	{
		int ret = 1;
		for(int i = 1;i < 4;i++){
			if(point[0] < point[i]){
				ret++; continue;
			}
			if(point[0] > point[i]){
				continue;
			}

			if(obt[0] - miss[0] < obt[i] - miss[i]){
				ret++; continue;
			}
			if(obt[0] - miss[0] > obt[i] - miss[i]){
				continue;
			}

			if(obt[0] < obt[i]){
				ret++; continue;
			}
			if(obt[0] > obt[i]){
				continue;
			}

			if(name[0].compareTo(name[i]) > 0){
				ret++; continue;
			}
			continue;
		}
		return ret;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new C().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.*;
import java.rmi.server.UID;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Q200C implements Runnable {
    Map<String, Data> table = new HashMap<String, Data>();
    static String BERLAND = "BERLAND";
    private void solve() throws IOException {
        //solve

        for (int i = 0; i < 5; i++) {
            String t1 = nextToken();
            String t2 = nextToken();
            String score = nextToken();
            int s1 = Integer.parseInt(score.substring(0, score.indexOf(":")));
            int s2 = Integer.parseInt(score.substring(score.indexOf(":") + 1));
            addRes(t1, t2, s1, s2);
        }
        Data[] t = new Data[4];
        int i = 1;
        int other =0;
        t[0]=table.remove(BERLAND);
        for (Data d : table.values()) {
            t[i++] = d;
            if(d.games==2)other = i-1;
        }

        int x1=-1;
        int x2=-1;
        t[0].points+=3;
        for (int s1 = 1; s1 < 50; s1++) {
            for (int s2 = 0; s2 < s1; s2++) {
                int betterThen=0;
                t[0].s+=s1;
                t[0].m+=s2;
                t[other].s+=s2;
                t[other].m+=s1;
                for (int j = 0; j < 3; j++) {
                    if(t[0].compareTo(t[1+j])>0)betterThen++;
                }
                t[0].s-=s1;
                t[0].m-=s2;
                t[other].s-=s2;
                t[other].m-=s1;
                if(betterThen>=2 && (x1==-1 || (s1-s2)<(x1-x2) || ((s1-s2)==(x1-x2) && s2<x2))){
                    x1=s1;x2=s2;
                }
            }
        }

        if(x1==-1)writer.println("IMPOSSIBLE");
        else{
            writer.println(x1+":"+x2);
        }
    }

    private void addRes(String t1, String t2, int s1, int s2) {
        if (!table.containsKey(t1)) {
            table.put(t1, new Data(t1));
        }
        if (!table.containsKey(t2)) {
            table.put(t2, new Data(t2));
        }

        Data d1 = table.get(t1);
        Data d2 = table.get(t2);
        d1.s += s1;
        d1.m += s2;
        d2.s += s2;
        d2.m += s1;
        d1.points += s1 > s2 ? 3 : s1 == s2 ? 1 : 0;
        d2.points += s2 > s1 ? 3 : s2 == s1 ? 1 : 0;

        d1.games++;
        d2.games++;
    }

    private static class Data implements Comparable<Data>{
        int games;
        String name;
        int points;
        int s;
        int m;

        public Data(String t1) {
            name = t1;
        }

        public int compareTo(Data o) {
            if(points>o.points)return 1;
            else if(points<o.points)return -1;
            else{
                if(s-m>o.s-o.m)return 1;
                else if(s-m<o.s-o.m)return -1;
                else{
                    if(s>o.s)return 1;
                    else if(s<o.s)return -1;
                    else{
                        return o.name.compareTo(name);
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        new Q200C().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            boolean oj = System.getProperty("ONLINE_JUDGE") != null;
            reader = oj ? new BufferedReader(new InputStreamReader(System.in)) :
                    new BufferedReader(new FileReader(new File("input.txt")));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            long start = System.currentTimeMillis();
            solve();
            reader.close();
            if (!oj) writer.print("\nTime: " + (System.currentTimeMillis() - start) + "\n");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;

/**
 * Works good for CF
 *
 * @author cykeltillsalu
 */
public class A126 {

	// some local config
	static boolean test = false;
	static String testDataFile = "testdata.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solution
	class Team{
		int win, goals, agains, cnt;
		String name;
		public Team(String name, int win, int goals, int agains) {
			super();
			this.name = name;
			this.win = win;
			this.goals = goals;
			this.agains = agains;
		}
		int diff(){
			return goals - agains;
		}
		@Override
		public String toString() {
			return "Team [win=" + win + ", goals=" + goals + ", agains=" + agains + ", cnt=" + cnt + ", name=" + name + "]";
		}

	}
	private void solve() throws Throwable {
		HashMap<String, Team> teams = new HashMap<String, A126.Team>();
		for (int i = 0; i < 5; i++) {
			String a = wread();
			String b = wread();
			String[] tmp = wread().split(":");

			int ap = Integer.parseInt(tmp[0]);
			int bp = Integer.parseInt(tmp[1]);
			Team at = teams.containsKey(a) ? teams.get(a) : new Team(a, 0, 0, 0);
			Team bt = teams.containsKey(b) ? teams.get(b) : new Team(b, 0, 0, 0);

			at.goals += ap;
			at.agains += bp;
			bt.goals += bp;
			bt.agains += ap;
			if(ap > bp){
				at.win += 3;
			} else if( bp > ap){
				bt.win += 3;
			} else {
				at.win += 1;
				bt.win += 1;
			}
			at.cnt ++;
			bt.cnt ++;
			teams.put(a, at);
			teams.put(b, bt);
		}

		int pro = Integer.MAX_VALUE;
		int against = Integer.MAX_VALUE/2;

		for (int ap = 0; ap < 100; ap++) {
			for (int bp = 0; bp < ap; bp++) {
				Team at = teams.get("BERLAND");
				Team bt = null;
				for (Team t : teams.values()) {
					if(!t.name.equals("BERLAND") && t.cnt == 2){
						bt = t;
					}
				}
				at.goals += ap;
				at.agains += bp;
				bt.goals += bp;
				bt.agains += ap;

				if(ap > bp){
					at.win += 3;
				} else if( bp > ap){
					bt.win += 3;
				} else {
					at.win += 1;
					bt.win += 1;
				}
				//sort teams
				ArrayList<Team> arrayList = new ArrayList<Team>();
				arrayList.addAll(teams.values());
				Collections.sort(arrayList, new Comparator<Team>() {

					@Override
					public int compare(Team o1, Team o2) {
						if(o1.win != o2.win){
							return o2.win - o1.win;
						}
						if(o1.diff() != o2.diff()){
							return o2.diff() - o1.diff();
						}
						if(o1.goals != o2.goals){
							return o2.goals - o1.goals;
						}
						return o1.name.compareTo(o2.name);
					}
				});
				if(arrayList.get(0).name.equals("BERLAND") || arrayList.get(1).name.equals("BERLAND")){
					if(ap-bp < pro - against){
						pro = ap;
						against = bp;
					} else if (ap-bp == pro - against && bp < against){
						pro = ap;
						against = bp;
					}
				}
				at.goals -= ap;
				at.agains -= bp;
				bt.goals -= bp;
				bt.agains -= ap;

				if(ap > bp){
					at.win -= 3;
				} else if( bp > ap){
					bt.win -= 3;
				} else {
					at.win -= 1;
					bt.win -= 1;
				}

			}
		}

		if(pro == Integer.MAX_VALUE){
			System.out.println("IMPOSSIBLE");
		} else {
			System.out.println(pro + ":" + against);
		}

		out.flush();
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if (test) { // run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if (!readLine.equalsIgnoreCase("input")) {
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if (readLine.equalsIgnoreCase("output")) {
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case " + (++casenr) + ": ");

				new A126().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if (readLine == null) {
						break out;
					}
					if (readLine.equalsIgnoreCase("input")) {
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new A126().solve();
		}
		out.close();
	}

	public A126() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {
		CF, OTHER
	};
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class C
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	String FInput="";

	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{

			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}

	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " :");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}

	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	public void readFInput()
	{
		for(;;)
		{
			try
			{
				readNextLine();
				FInput+=line+" ";
			}
			catch(Exception e)
			{
				break;
			}
		}
		inputParser = new StringTokenizer(FInput, " ");
	}

	long NextLong()
    {
            String n = inputParser.nextToken();

            long val = Long.parseLong(n);

            return val;
    }

	public static void main(String [] argv)
	{
		String filePath=null;
		if(argv.length>0)filePath=argv[0];
		new C(filePath);
	}

	Team [] t = new Team[4];
	int cntT=0;
	public C(String inputFile)
	{
		openInput(inputFile);

		for(int m=0; m<5; m++)
		{
			readNextLine();

			String t1=NextString();
			String t2=NextString();
			int s1=NextInt();
			int s2=NextInt();
			addScore(t1, s1, s2);
			addScore(t2, s2, s1);
		}
		Arrays.sort(t);
		Team myTeam=null;
		Team otherTeam=null;
		for(int i=0; i<4; i++)
		{
			if(t[i].name.compareTo("BERLAND")==0)myTeam=t[i];
			else if(t[i].m==2)otherTeam=t[i];
		}

		for(int d=1; d<50; d++)
		{
			for(int g=d; g<=50; g++)
			{
				int go=g-d;
				myTeam.addScore(g, go);
				otherTeam.addScore(go, g);
				Arrays.sort(t);
				for(int i=0; i<2; i++)
				{
					if(t[i].name.compareTo("BERLAND")==0)
					{
						System.out.println(g+":"+go);
						return;
					}
				}
				myTeam.removeScore(g, go);
				otherTeam.removeScore(go, g);
			}
		}

		System.out.println("IMPOSSIBLE");
        closeInput();
	}

	private void addScore(String t2, int s2, int s1) {
		Team pt=null;
		for(int i=0; i<cntT; i++)
		{
			if(t[i].name.compareTo(t2)==0)pt=t[i];
		}
		if(pt==null)
		{
			t[cntT]=new Team(t2);
			pt=t[cntT];
			cntT++;
		}
		pt.addScore(s2, s1);
	}

	private class Team implements Comparable<Team>
	{
		String name;
		int points, g1, g2, m;

		Team(String s)
		{
			name=s;
		}

		void addScore(int g1, int g2)
		{
			if(g1>g2)points+=3;
			else if(g1==g2)points++;
			this.g1+=g1;
			this.g2+=g2;
			m++;
		}

		void removeScore(int g1, int g2)
		{
			if(g1>g2)points-=3;
			else if(g1==g2)points--;
			this.g1-=g1;
			this.g2-=g2;
			m--;
		}

		public int compareTo(Team d)
		{
			if(d.points!=points)return d.points-points;
			if(g1-g2!=d.g1-d.g2)return d.g1-d.g2-g1+g2;
			if(d.g1!=g1)return d.g1-g1;
			return name.compareTo(d.name);
		}
	}

}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    static class Team{
        String name;
        int id;
        int winP;
        int goal;
        int missgoal;
        int rank=0;

        Team(int id,String name,
        int winP,int minssgoal,
        int goal){
            this.id=id;
            this.name=name;
            this.winP=winP;
            this.goal=goal;
            this.missgoal=minssgoal;
        }
    }

    int id=0;

    HashMap<String,Team> teams;

    boolean[][] game=new boolean[4][4];
    List<Team> teamlist;
    public void solve() {
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<4;i++){
            game[i][i]=true;
        }
        teams=new HashMap<String, Main.Team>();
        for (int i = 0; i < 5; i++) {
            String name1=sc.next();
            String name2=sc.next();

            String param=sc.next();
            int p1=param.charAt(0)-'0';
            int p2=param.charAt(2)-'0';

            Team t1,t2;
            if(!teams.containsKey(name1)){
                t1=new Team(id++,name1,0,0,0);
                teams.put(name1,t1);
            }else{
                t1=teams.get(name1);
            }
            if(!teams.containsKey(name2)){
                t2=new Team(id++,name2,0,0,0);
                teams.put(name2,t2);
            }else{
                t2=teams.get(name2);
            }

            game[t1.id][t2.id]=true;
            game[t2.id][t1.id]=true;
            t1.goal+=p1;
            t2.goal+=p2;
            t1.missgoal+=p2;
            t2.missgoal+=p1;
            if(p1<p2){
                t2.winP+=3;
            }else if(p1> p2){
                t1.winP+=3;
            }else{
                t1.winP++;
                t2.winP++;
            }
        }

        teamlist=new ArrayList<Team>();
        for(Entry<String,Team> team:teams.entrySet()){
            teamlist.add(team.getValue());
        }

        refreashRank();

        Team berand=null;
        for(Team team:teamlist){
            if(team.name.equals("BERLAND")){
                berand=team;
                break;
            }
        }

        int lastgameid=0;
        for(int i=0;i<4;i++){
            if(!game[i][berand.id]){
                lastgameid=i;break;
            }
        }

        Team lastGame=null;
        for(Team team:teamlist){
            if(team.id==lastgameid){
                lastGame=team;
            }
        }

        berand.winP+=3;
        int mx=Integer.MAX_VALUE;int my=0;
        for(int x=0;x<=60;x++){
            for(int y=0;y<x;y++){
                berand.goal+=x;
                lastGame.goal+=y;
                berand.missgoal+=y;
                lastGame.missgoal+=x;

                refreashRank();
                if(berand.rank<=1){
                    if(mx-my>x-y || (mx-my==x-y && my>y)){
                        mx=x;
                        my=y;
                    }
                }
                berand.goal-=x;
                lastGame.goal-=y;
                berand.missgoal-=y;
                lastGame.missgoal-=x;
            }
        }

        if(mx==Integer.MAX_VALUE){
            pr("IMPOSSIBLE");
        }else{
            pr(mx+":"+my);
        }
    }

    public void  refreashRank(){
        Collections.sort(teamlist,new Comparator<Team>() {
            @Override
            public int compare(Team o1, Team o2) {
                if(o1.winP!=o2.winP){
                    return o2.winP-o1.winP;
                }
                if(o1.goal-o1.missgoal!=o2.goal-o2.missgoal){
                    return o2.goal-o2.missgoal-(o1.goal-o1.missgoal);
                }
                if(o1.goal!=o2.goal){
                    return o2.goal-o1.goal;
                }
                return o1.name.compareTo(o2.name);
            }
        });
        int rank=0;
        for(Team team:teamlist){
            team.rank=rank;
            rank++;
        }
    }

    public void run() {
        solve();
    }

    public static void main(String[] _) {
        new Main().run();
    }

    public static void pr() {
        System.out.println();
    }

    public static void pr(Object o) {
        System.out.println(o);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class First
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class Team
{
    String teamName;
    int score;
    int goalFor;
    int goalAgainst;
    int matchPlayed;

    public Team(String teamName, int score, int goalFor, int goalAgainst, int matchPlayed)
    {
        super();
        this.teamName = teamName;
        this.score = score;
        this.goalFor = goalFor;
        this.goalAgainst = goalAgainst;
        this.matchPlayed = matchPlayed;
    }
}

class MyComparator implements Comparator<Team>
{
    @Override
    public int compare(Team t1, Team t2)
    {

        if(t1.score < t2.score) return 1;
        if(t1.score > t2.score) return -1;
        if(t1.goalFor - t1.goalAgainst < t2.goalFor - t2.goalAgainst) return 1;
        if(t1.goalFor - t1.goalAgainst > t2.goalFor - t2.goalAgainst) return -1;
        if(t1.goalFor < t2.goalFor) return 1;
        if(t1.goalFor > t2.goalFor) return -1;
        return t1.teamName.compareTo(t2.teamName);
    }
}

class TaskA
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        Set <String> hset = new HashSet <String> ();
        String[] inputStr = new String[5];
        for(int i = 0; i < 5; i++)
        {
            inputStr[i] = in.nextLine();
        }

        Team[] team = new Team[4];
        for(int i = 0; i < 5; i++)
        {
            String str = inputStr[i];
            str = str.replace(":", " ");
            String[] ans = str.split("[ ]+");
            hset.add(ans[0]); hset.add(ans[1]);
        }
        int index = 0;
        for(String str : hset)
        {
            int myScore = 0;
            int myGoalFor = 0;
            int myGoalAgainst = 0;
            int matchPlayed = 0;
            for(int i = 0; i < 5; i++)
            {
                String current = inputStr[i];
                current = current.replace(":", " ");
                String[] ans = current.split("[ ]+");
                String firstTeam = ans[0];
                String secondTeam = ans[1];
                int firstScoreGoal = Integer.parseInt(ans[2]);
                int secondScoreGoal = Integer.parseInt(ans[3]);

                if(firstTeam.equals(str))
                {
                    myGoalFor += firstScoreGoal;
                    myGoalAgainst += secondScoreGoal;
                    if(firstScoreGoal > secondScoreGoal)
                    {
                        myScore += 3;
                    }
                    if(firstScoreGoal == secondScoreGoal)
                        myScore++;
                    matchPlayed++;
                }
                if(secondTeam.equals(str))
                {
                    myGoalFor += secondScoreGoal;
                    myGoalAgainst += firstScoreGoal;
                    if(secondScoreGoal > firstScoreGoal) myScore += 3;
                    if(secondScoreGoal == firstScoreGoal) myScore++;
                    matchPlayed++;
                }
            }
            team[index++] = new Team(str, myScore, myGoalFor, myGoalAgainst, matchPlayed);
        }
        Arrays.sort(team, new MyComparator());

        index = 0; int i = 0;
        for(Team item : team)
        {   if(item.teamName.equals("BERLAND"))
                index = i;
            i++;
            //System.out.println(item.teamName + " " + item.score + "  " + item.goalFor + "  " + item.goalAgainst + " " + item.matchPlayed);
        }
        if(team[0].teamName.equals("BERLAND") || team[1].teamName.equals("BERLAND"))
            out.println("1:0");

        else
        {
            String secondTeamName = team[1].teamName;
            int secondScore = team[1].score;
            int secondGoalFor = team[1].goalFor;
            int secondGoalAgainst = team[1].goalAgainst;
            int differenceSecond = secondGoalFor - secondGoalAgainst;

            int berlandScore = team[index].score;
            int berlandGoalFor = team[index].goalFor;
            int berlandGoalAgainst = team[index].goalAgainst;
            int differenceBerland = berlandGoalFor - berlandGoalAgainst;
            if(secondScore <= berlandScore + 2)
            {
                out.println("1:0");
            }
            else if (secondScore > berlandScore + 3)
            {
                out.println("IMPOSSIBLE");
            }
            else
            {
                int kk = 0;
                for(int k = 1; k < 4; k++)
                {
                    if(team[k].teamName.equals("BERLAND") == false && team[k].matchPlayed == 2)
                    {
                        kk = k;
                        break;
                    }
                }
                Team[] tempTeam = new Team[4];

                outer:for(int diff = 1; ; diff++)
                {

                int counter = 0; int hisGoals = 0;
                for(int myGoals = diff; ; myGoals++, hisGoals++)
                {

                    for(int step = 0; step < 4; step++)
                    {
                        tempTeam[step] = new Team(team[step].teamName, team[step].score, team[step].goalFor , team[step].goalAgainst, team[step].matchPlayed);
                    }

                    tempTeam[index].score += 3;
                    tempTeam[index].goalFor += myGoals;
                    tempTeam[index].goalAgainst += hisGoals;

                    tempTeam[kk].goalAgainst += myGoals;
                    tempTeam[kk].goalFor += hisGoals;

                    if(myGoals > 60) continue outer;
                    Arrays.sort(tempTeam, new MyComparator());
                    if(tempTeam[0].teamName.equals("BERLAND") || tempTeam[1].teamName.equals("BERLAND"))
                    {
                        out.println(myGoals + ":" + hisGoals);
                        break outer;
                    }
                }
                }
            }
        }
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next()
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
        {
            try
            {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public String nextLine()
    {
        String inputLine = "";
        try
        {
            inputLine = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return inputLine;
    }
}

import java.io.*;
import java.util.*;

public class C {
    public static void main(String[] args) throws Exception {
        new C().solve();
    }

    void solve() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] sp;
        int[] score = new int[4];
        int[] goal = new int[4];
        int[] miss = new int[4];
        int[] count = new int[4];
        String[] name = new String[4];
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        for (int i = 0; i < 5; i++) {
            sp = in.readLine().split(" ");
            int t1, t2;
            if (map.containsKey(sp[0])) {
                t1 = map.get(sp[0]);
            } else {
                t1 = map.size();
                map.put(sp[0], t1);
            }
            if (map.containsKey(sp[1])) {
                t2 = map.get(sp[1]);
            } else {
                t2 = map.size();
                map.put(sp[1], t2);
            }
            name[t1] = sp[0];
            name[t2] = sp[1];
            count[t1]++;
            count[t2]++;
            sp = sp[2].split(":");
            int s1 = Integer.parseInt(sp[0]);
            int s2 = Integer.parseInt(sp[1]);
            if (s1 > s2) {
                score[t1] += 3;
            } else if (s1 == s2) {
                score[t1] += 1;
                score[t2] += 1;
            } else {
                score[t2] += 3;
            }
            goal[t1] += s1;
            goal[t2] += s2;
            miss[t1] += s2;
            miss[t2] += s1;
        }
        int ber = map.get("BERLAND");
        int op = 0;
        for (int i = 0; i < 4; i++) {
            if (count[i] == 2 && i != ber) {
                op = i;
                break;
            }
        }

        for (int df = 1; df < 100; df++) {
            for (int x = df; x < 100; x++) {
                int y = x - df;
                int pos = 0;
                for (int i = 0; i < 4; i++) {
                    if (i != ber) {
                        // score
                        if (score[i] > score[ber] + 3) {
                            pos++;
                        } else if (score[i] == score[ber] + 3) {
                            // df
                            int gl = i == op ? goal[i] + y : goal[i];
                            int ms = i == op ? miss[i] + x : miss[i];
                            if (gl - ms > goal[ber] + x - (miss[ber] + y)) {
                                pos++;
                            } else if (gl - ms == goal[ber] + x - (miss[ber] + y)) {
                                // goal
                                if (gl > goal[ber] + x) {
                                    pos++;
                                } else if (gl == goal[ber] + x) {
                                    // lex
                                    if (name[i].compareTo(name[ber]) <= 0) {
                                        pos++;
                                    }
                                }
                            }
                        }
                    }
                }
                if (pos < 2) {
                    System.out.println(x + ":" + y);
                    return;
                }
            }
        }
        System.out.println("IMPOSSIBLE");
    }
}

import java.util.*;

public class C {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Map<String, Integer> X = new HashMap<String, Integer>();
		int ber = -1;
		final int[] points = new int[4];
		final int[] scored = new int[4];
		final int[] let_in = new int[4];
		final int[] count = new int[4];
		final String[] names = new String[4];
		for(int i=0; i<5; i++) {
			String t1 = in.next();
			String t2 = in.next();
			String[] scores = in.next().split(":");

			if(!X.containsKey(t1)) X.put(t1, X.size());
			if(!X.containsKey(t2)) X.put(t2, X.size());
			int x1 = X.get(t1);
			int x2 = X.get(t2);
			names[x1] = t1;
			names[x2] = t2;
			if(t1.equals("BERLAND")) ber = x1;
			if(t2.equals("BERLAND")) ber = x2;
			int s1 = Integer.parseInt(scores[0]);
			int s2 = Integer.parseInt(scores[1]);

			count[x1]++; count[x2]++;
			if(s1 > s2) { points[x1]+=3; }
			else if(s1 == s2) { points[x1]++; points[x2]++; }
			else { points[x2]+=3; }
			scored[x1] += s1; scored[x2]+=s2;
			let_in[x1] += s2; let_in[x2]+=s1;
			//System.out.println(t1+" "+t2+" "+x1+" "+x2+" "+Arrays.toString(points));
		}
		int opp = -1;
		for(int i=0; i<4; i++)
			if(count[i]==2 && i!=ber)
				opp = i;

		boolean ok = false;
		int best_x = 10000;
		int best_y = 0;
		points[ber]+=3;
		for(int x=0; x<100; x++)
			for(int y=0; y<x; y++) {
				final int[] new_scored = new int[5];
				final int[] new_let_in = new int[5];
				for(int i=0; i<4; i++) {
					new_scored[i] = scored[i];
					new_let_in[i] = let_in[i];
				}
				new_scored[ber] += x; new_scored[opp] += y;
				new_let_in[ber] += y; new_let_in[opp] += x;

				Integer[] sort = new Integer[4];
				for(int i=0; i<4; i++) sort[i] = i;
				Arrays.sort(sort, new Comparator<Integer>() {
					public int compare(Integer A, Integer B) {
						if(points[A] > points[B]) return -1;
						if(points[A] < points[B]) return 1;

						int s1 = new_scored[A]-new_let_in[A];
						int s2 = new_scored[B]-new_let_in[B];
						if(s1 > s2) return -1;
						if(s1 < s2) return 1;

						if(new_scored[A] > new_scored[B]) return -1;
						if(new_scored[A] < new_scored[B]) return 1;

						return (names[A].compareTo(names[B]));
					}
				});
				if(ber == sort[0] || ber==sort[1]) { // OK
					ok = true;
					int diff = x-y;
					int best_diff = best_x-best_y;
					if(diff < best_diff || (diff==best_diff && y < best_y)) {
						best_x = x;
						best_y = y;
					}
				}
			}

		if(!ok)
			System.out.println("IMPOSSIBLE");
		else System.out.println(best_x+":"+best_y);

		/*
		int more = 0;
		for(int i=0; i<5; i++)
			if(i != ber && points[i]>points[ber])
				more++;
		if(more >= 2) { System.out.println("IMPOSSIBLE"); return; }

		List<Integer> diff = new ArrayList<Integer>();
		int ix = 0;
		for(int i=0; i<5; i++)
			if(points[i]==points[ber] && i!=ber)
				diff.add(scored[i]-let_in[i]);
		Collections.sort(diff);

		int need = more==1 ? diff.get(diff.size()-1) : diff.get(diff.size()-2);
		int diff_needed = need - (scored[ber]-let_in[ber]);

		if(more == 0 && diff.get(
		*/
	}
}

import java.io.FileNotFoundException;
import java.util.*;
import static java.lang.System.out;

public class Main {
    private static void debug(Object...os) {
        out.println(Arrays.deepToString(os));
    }

    static final int TEAMS = 4;

    public static void main(String[] args) throws FileNotFoundException {
        Scanner cin = new Scanner(System.in);
        String[] name = new String[TEAMS];
        int[] points = new int[TEAMS];
        int[] scored = new int[TEAMS];
        int[] taken = new int[TEAMS];
        Map<String, Integer> map = new HashMap<String, Integer>();
        Map<String, Integer> val = new HashMap<String, Integer>();
        int index = 0;
        for (int i = 0; i < 5; ++i) {
            String[] parts = cin.nextLine().split(" ");
            if (!map.containsKey(parts[0])) {
                map.put(parts[0], index);
                name[index++] = parts[0];
            }
            if (!map.containsKey(parts[1])) {
                map.put(parts[1], index);
                name[index++] = parts[1];
            }
            Integer value = val.get(parts[0]);
            if (value == null)
                val.put(parts[0], 1);
            else
                val.put(parts[0], value + 1);
            value = val.get(parts[1]);
            if (value == null)
                val.put(parts[1], 1);
            else
                val.put(parts[1], value + 1);
            int teamOneIndex = map.get(parts[0]);
            int teamTwoIndex = map.get(parts[1]);
            int teamOneGoals = parts[2].charAt(0) - '0';
            int teamTwoGoals = parts[2].charAt(2) - '0';
            scored[teamOneIndex] += teamOneGoals;
            scored[teamTwoIndex] += teamTwoGoals;
            taken[teamOneIndex] += teamTwoGoals;
            taken[teamTwoIndex] += teamOneGoals;
            if (teamOneGoals > teamTwoGoals) {
                points[teamOneIndex] += 3;
            } else if (teamOneGoals < teamTwoGoals) {
                points[teamTwoIndex] += 3;
            } else {
                ++points[teamOneIndex];
                ++points[teamTwoIndex];
            }
        }
        Team[] teams = new Team[TEAMS];
        for (int i = 0; i < TEAMS; ++i)
            teams[i] = new Team(name[i], points[i], scored[i], taken[i], scored[i] - taken[i]);
        String secondTeam = "";
        for (Map.Entry<String, Integer> entry : val.entrySet())
            if (!"BERLAND".equals(entry.getKey()) && entry.getValue() == 2) {
                secondTeam = entry.getKey();
                break;
            }
        int teamOneIndex = map.get("BERLAND");
        int teamTwoIndex = map.get(secondTeam);
        int resX = -1;
        int resY = -1;
        int min = Integer.MAX_VALUE;
        int minY = min;
        for (int x = 1; x <= 100; ++x)
            for (int y = x - 1; y >= 0; --y) {
                Team[] scoreboard = new Team[TEAMS];
                for (int k = 0; k < TEAMS; ++k)
                    scoreboard[k] = new Team(teams[k].name, teams[k].points, teams[k].scored, teams[k].taken, teams[k].diff);
                scoreboard[teamOneIndex].scored += x;
                scoreboard[teamTwoIndex].taken += x;
                scoreboard[teamOneIndex].taken += y;
                scoreboard[teamTwoIndex].scored += y;
                scoreboard[teamOneIndex].points += 3;
                scoreboard[teamOneIndex].diff = (scoreboard[teamOneIndex].scored - scoreboard[teamOneIndex].taken);
                scoreboard[teamTwoIndex].diff = (scoreboard[teamTwoIndex].scored - scoreboard[teamTwoIndex].taken);
                Arrays.sort(scoreboard);
                if (scoreboard[0].name.equals("BERLAND") || scoreboard[1].name.equals("BERLAND")) {
                    if (x - y <= min) {
                        if (x - y == min) {
                            if (y < minY) {
                                resX = x;
                                resY = y;
                                minY = y;
                            }
                        } else {
                            resX = x;
                            resY = y;
                            min = x - y;
                            minY = y;
                        }
                    }
                }
            }
        if (resX == -1)
            out.println("IMPOSSIBLE");
        else
            out.printf("%d:%d\n", resX, resY);
    }

    private static void printTeams(Team[] teams) {
        for (Team team : teams)
            debug(team.name, team.points, team.scored, team.taken, team.scored - team.taken);
    }

    static class Team implements Comparable<Team> {
        String name;
        int scored;
        int taken;
        int points;
        int diff;

        Team(String name, int points, int scored, int taken, int diff) {
            this.name = name;
            this.diff = diff;
            this.points = points;
            this.taken = taken;
            this.scored = scored;
        }

        public int compareTo(Team team) {
            if (points != team.points)
                return team.points - points;
            if (diff != team.diff)
                return team.diff - diff;
            if (scored != team.scored)
                return team.scored - scored;
            return name.compareTo(team.name);
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {
    class Team implements Comparable< Team > {
        int scored, missed;
        String name;
        int points;

        public Team( int s, int m, String n, int p ) {
            scored = s;
            missed = m;
            name = n;
            points = p;

        }

        public String toString( ) { return name + " " + points + " " + scored + " " + missed; }
        public int compareTo( Team t ) {
            if ( t.points != points ) {
                return -points + t.points;
            }
            if ( ( scored - missed ) != ( t.scored - t.missed ) ) {
                return -( scored - missed ) + ( t.scored - t.missed ) ;
            }
            if ( scored != t.scored ) {
                return -scored + t.scored;
            }
            return name.compareTo( t.name );
        }
    }

    public void solve( ) throws Throwable {
        Map< String, Team > names = new HashMap< String, Team >( );
        Map< String, Integer > played = new HashMap< String, Integer >( );
        for ( int i = 0; i < 5; ++i ) {
            StringTokenizer st = new StringTokenizer( in.nextLine( ), ": " );
            String f = st.nextToken( ), s = st.nextToken( );
            int nf = Integer.parseInt( st.nextToken( ) ), ns = Integer.parseInt( st.nextToken( ) );
            Team get1 = names.get( f );
            Integer t1 = played.get( f );
            if ( get1 == null ) {
                get1 =  new Team( 0, 0, f, 0 ) ;
                t1 = 0;
            }
            Team get2 = names.get( s );
            Integer t2 = played.get( s );
            if ( get2 == null ) {
                get2 = new Team( 0, 0, s, 0 );
                t2 = 0;
            }
            if ( nf == ns ) {
                get1.points++;
                get2.points++;
            } else {
                if ( nf > ns ) {
                    get1.points += 3;
                } else {
                    get2.points += 3;
                }
            }
            get1.scored += nf;
            get1.missed += ns;

            get2.scored += ns;
            get2.missed += nf;

            names.put( f, get1 );
            names.put( s, get2 );

            played.put( f, t1 + 1 );
            played.put( s, t2 + 1 );
        }

        PriorityQueue< Team > pq = new PriorityQueue< Team >( );
        for ( String t : names.keySet( ) ) {
            pq.add( names.get( t ) );
        }

        //debug( pq );
        int diff = 1000, mx = -1, my = -1;
        for ( String s : played.keySet( ) ) {
            if ( !s.equals( "BERLAND" ) && played.get( s ) == 2 ) {
                Team t1 = names.get( "BERLAND" ), t2 = names.get( s );
                for ( int y = 0; y < 200; ++y ) {
                    pq.remove( t2 );
                    t2.scored += y;
                    for ( int x = y + 1 ;x < 200; ++x ) {
                        pq.remove( t1 );
                        t1.points += 3;
                        t1.scored += x;
                        t1.missed += y;

                        t2.missed += x;
                        pq.add( t2 );

                        pq.add( t1 );

                        //debug( x, y, pq );

                        Team first = pq.poll(  ), second = pq.poll(  );

                        if ( ( first.name.equals( "BERLAND" ) || second.name.equals( "BERLAND" ) ) && x - y < diff ) {
                            diff = ( x - y );
                            mx = x;
                            my = y;
                        }
                        pq.add( first );
                        pq.add( second );

                        t2.missed -= x;
                        pq.remove( t2 );

                        pq.remove( t1 );
                        t1.missed -= y;
                        t1.scored -= x;
                        t1.points -= 3;
                        pq.add( t1 );
                    }
                    t2.scored -= y;
                    pq.add( t2 );
                }
            }
        }
        out.println( diff == 1000 ? "IMPOSSIBLE" : ( mx + ":" + my ) );
    }

    public void run( ) {
        in = new FastScanner( System.in );
        out = new PrintWriter( new PrintStream( System.out ), true );

        try {
            solve( );
            out.close( );
            System.exit( 0 );
        } catch( Throwable e ) {
            e.printStackTrace( );
            System.exit( -1 );
        }
    }

    public void debug( Object...os ) {
        System.err.println( Arrays.deepToString( os ) );
    }

    public static void main( String[ ] args ) {
        ( new Main( ) ).run( );
    }

    private FastScanner in;
    private PrintWriter out;

    private static class FastScanner {
        private int charsRead;
        private int currentRead;
        private byte buffer[ ] = new byte[ 0x1000 ];
        private InputStream reader;

        public FastScanner( InputStream in ) {
            reader = in;
        }

        public int read( ) {
            if ( charsRead == -1 ) {
                throw  new InputMismatchException( );
            }

            if ( currentRead >= charsRead ) {
                currentRead = 0;
                try {
                    charsRead = reader.read( buffer );

                } catch( IOException e ) {
                    throw new InputMismatchException(  );
                }

                if ( charsRead <= 0 ) {
                    return -1;
                }
            }

            return buffer[ currentRead++ ];
        }

        public int nextInt( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public long nextLong( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            long ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public boolean isWhitespace( int c ) {
            return  c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;
        }

        public String next( ) {
            int c = read( );
            StringBuffer ans = new StringBuffer( );

            while ( isWhitespace( c ) && c != -1 ) {
                c  = read( );
            }

            if ( c == -1 ) {
                return null;
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public String nextLine( ) {
            String ans = nextLine0( );

            while ( ans.trim( ).length( ) == 0 ) {
                ans = nextLine0( );
            }

            return ans;
        }

        private String nextLine0( ) {
            int c = read( );
            if ( c == -1 ) {
                return null;
            }
            StringBuffer ans = new StringBuffer( );
            while ( c != '\n' && c != '\r' && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public double nextDouble( ) {
            int c = read( );
            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '.' && c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( c == '-' ) {
                c = read( );
            }
            double ans = 0;
            while ( c != -1 && c != '.' && !isWhitespace( c ) ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }

                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            if ( !isWhitespace( c ) && c != -1 && c != '.' ) {
                throw new InputMismatchException( );
            }

            double pow10 = 1.0;

            if ( c == '.' ) {
                c = read( );
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                pow10 *= 10.0;

                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            return ans * sign / pow10;
        }
    }

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        in.useDelimiter("\n");
        int i,points[]=new int[4],scored[]=new int[4],missed[]=new int[4],j,index=0,num[]=new int[4];
        String tea1,tea2="";
        ArrayList<String> team=new ArrayList<String>();
        for(i=0;i<5;i++)
        {
            String s[]=in.next().split(" ");
            tea1=s[0];
            tea2=s[1];
            if(!team.contains(tea1))
            {
                team.add(tea1);

            }
            index=team.indexOf(tea1);
            scored[index]+=s[2].charAt(0)-48;
            missed[index]+=s[2].charAt(2)-48;
            if(s[2].charAt(0)>s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
            if(!team.contains(tea2))
            {
                team.add(tea2);

            }
            index=team.indexOf(tea2);
            scored[index]+=s[2].charAt(2)-48;
            missed[index]+=s[2].charAt(0)-48;
            if(s[2].charAt(0)<s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
        }
        table a[]=new table[4];
        for(i=0;i<4;i++)
            a[i]=new table(team.get(i),points[i],scored[i],missed[i]);
        for(i=0;i<4;i++)
        {
            if(num[i]==2&&(team.get(i).equals("BERLAND")==false))
                tea2=team.get(i);

        }
        Arrays.sort(a);
        int index2=0;
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
            out.println("1:0");
            return;
        }
        if(a[1].points-a[index].points>3)
        {
            out.println("IMPOSSIBLE");
            return;
        }
        if(a[1].points-a[index].points<3)
        {
            out.println("1:0");
            return;
        }
        a[index].points+=3;
        Arrays.sort(a);
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
           out.println("1:0");
            return;
        }
        int k,min=Integer.MAX_VALUE,x=0,y=0;
        for(i=1;i<=50;i++)
        {
            for(j=0;j<i;j++)
            {
                table fin[]=new table[4];
                for(k=0;k<4;k++)
                {
                    if(team.get(k).equals("BERLAND"))
                        fin[k]=new table("BERLAND",points[k]+3,scored[k]+i,missed[k]+j);
                    else if(team.get(k).equals(tea2))
                        fin[k]=new table(tea2,points[k],scored[k]+j,missed[k]+i);
                    else
                        fin[k]=new table(team.get(k),points[k],scored[k],missed[k]);
                }
                Arrays.sort(fin);
                index=0;
                for(k=0;k<4;k++)
                    if(fin[k].tname.equals("BERLAND"))
                        index=k;
                if(index<2&&(i-j)<min)
                {
                    min=Math.min(min,i-j);
                    x=i;
                    y=j;
                }
            }
        }
        out.println(x+":"+y);

	}
    class table implements Comparable<table>
    {
        String tname;
        int points,s,m;
        public table(String tname,int points,int s,int m)
        {
            this.tname=tname;
            this.points=points;
            this.s=s;
            this.m=m;
        }
        public int compareTo(table a)
        {
            if(a.points>this.points)
                return 1;
            else if(a.points<this.points)
                return -1;
            else
            {
                int diff1=a.s-a.m;
                int diff2=this.s-this.m;
                if(diff1>diff2)
                    return 1;
                else if(diff1<diff2) return -1;
                else
                {
                    if(a.s>this.s) return 1;
                    else if(a.s<this.s) return -1;
                    else
                    {
                        return ((a.tname).compareTo(this.tname)<0?1:-1);
                    }
                }
            }
        }
    }
}

import java.util.*;
import java.io.*;

public class cf200c {
  static Map<String, Integer> names = new HashMap<String, Integer>();
  static Map<Integer, String> rev = new HashMap<Integer, String>();
  public static void main(String[] args) {
    FastIO in = new FastIO(), out = in;
    names.put("BERLAND",0);
    rev.put(0,"BERLAND");

    int[][] v = new int[4][4];
    for(int[] x : v) Arrays.fill(x,-1);
    for(int i=0; i<5; i++) {
      String team1 = in.next().trim();
      int t1 = names.size();
      if(names.containsKey(team1)) t1 = names.get(team1);
      else names.put(team1,t1);
      String team2 = in.next().trim();
      int t2 = names.size();
      if(names.containsKey(team2)) t2 = names.get(team2);
      else names.put(team2,t2);
      String[] g = in.next().trim().split(":");
      int g1 = Integer.parseInt(g[0]);
      int g2 = Integer.parseInt(g[1]);
      v[t1][t2] = g1;
      v[t2][t1] = g2;
      rev.put(t1,team1);
      rev.put(t2,team2);
    }
    int other = 0;
    int bestx = -1, besty = -1;
    for(int i=1; i<4; i++)
      if(v[0][i] == -1) other = i;
    for(int x=0; x<100; x++)
      for(int y=0; y<x; y++) {
        v[0][other] = x;
        v[other][0] = y;
        if(ok(v)) {
          if(bestx == -1 || (x-y < bestx - besty) || (x-y == bestx - besty && y < besty)) {
            bestx = x;
            besty = y;
          }
        }
      }
    if(bestx == -1) out.println("IMPOSSIBLE");
    else out.println(bestx+":"+besty);
    out.close();
  }
  static boolean ok(int[][] v) {
    Team[] teams = new Team[4];
    for(int i=0; i<4; i++)
      teams[i] = new Team(rev.get(i), i);

    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++) {
        if(i == j) continue;
        if(v[i][j] > v[j][i]) teams[i].points += 6;
        if(v[i][j] == v[j][i]) teams[i].points += 2;
        teams[i].goals += v[i][j];
        teams[i].misses += v[j][i];
      }

    Arrays.sort(teams);
    return teams[0].id == 0 || teams[1].id == 0;
  }
  static class Team implements Comparable<Team> {
    String name;
    int id, points, goals, misses;
    Team(String s, int v) {
      name = s; id = v;
    }
    public int compareTo(Team t) {
      if(points != t.points) return t.points - points;
      if(goals - misses != t.goals - t.misses) return (t.goals - t.misses) - (goals - misses);
      if(goals != t.goals) return t.goals - goals;
      return name.compareTo(t.name);
    }
    public String toString() {
      return name+" "+points+" "+goals+" "+misses;
    }
  }
  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in,System.out);
    }
    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }
    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch(Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }
    public int numTokens() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }
    public String next() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }
    public double nextDouble() {
      return Double.parseDouble(next());
    }
    public long nextLong() {
      return Long.parseLong(next());
    }
    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Solution {
    //<editor-fold desc="input parse" defaultstate="collapsed">

    private static StringTokenizer st;
    private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    private static long nextLong() {
        return Long.parseLong(st.nextToken());
    }

    private static int nextInt() {
        return Integer.parseInt(st.nextToken());
    }

    private static double nextDouble() {
        return Double.parseDouble(st.nextToken());
    }

    private static short nextShort() {
        return Short.parseShort(st.nextToken());
    }

    private static byte nextByte() {
        return Byte.parseByte(st.nextToken());
    }

    private static void initTokenizer() throws Exception {
        st = new StringTokenizer(reader.readLine());
    }

    //</editor-fold>

    private static class TeamComparator implements Comparator<Team> {
        @Override
        public int compare (Team a, Team b) {
            int c = a.points - b.points;
            if (c != 0) return c;

            c = a.goalsDone - a.goalsLost - (b.goalsDone - b.goalsLost);
            if (c != 0) return c;

            c = a.goalsDone - b.goalsDone;
            if (c != 0) return c;

            return b.country.compareTo(a.country);
        }
    }

    private static class Team {
        private int points;
        private int goalsDone;
        private int goalsLost;
        private String country;
        private int games;

        public Team (String country) {
            this.country = country;
            points = 0;
            goalsDone = 0;
            goalsLost = 0;
            games = 0;
        }
    }

    private static class CountComparator implements Comparator<Count> {
        @Override
        public int compare (Count a, Count b) {
            int c = a.win - a.los - (b.win - b.los);
            if (c != 0) return c;

            return a.los - b.los;
        }

    }

    private static class Count {
        private int win;
        private int los;

        public Count (int win, int los) {
            this.win = win;
            this.los = los;
        }

    }

    private final static TeamComparator comparator = new TeamComparator() {

        @Override
        public int compare (Team a, Team b) {
            return -super.compare(a, b);
        }
    };

    private final static CountComparator countcomparator = new CountComparator();

    private static HashMap<String, Team> teamsMap;

    public static void main(String[] args) throws Exception {
        teamsMap = new HashMap<>();

        for (int i = 0; i < 5; i++) {
            st = new StringTokenizer(reader.readLine(), ": ");

            String team1 = st.nextToken();
            String team2 = st.nextToken();

            int g1 = nextInt();
            int g2 = nextInt();

            Team t1 = teamsMap.get(team1);
            if (t1 == null) {
                t1 = new Team(team1);
                teamsMap.put(team1, t1);
            }

            Team t2 = teamsMap.get(team2);
            if (t2 == null) {
                t2 = new Team(team2);
                teamsMap.put(team2, t2);
            }

            t1.goalsDone += g1;
            t1.goalsLost += g2;

            t2.goalsDone += g2;
            t2.goalsLost += g1;

            if (g1 == g2) {
                t1.points++;
                t2.points++;
            }
            else if (g1 > g2) {
                t1.points += 3;
            }
            else {
                t2.points += 3;
            }

            t1.games++;
            t2.games++;
        }

        Team berland = teamsMap.get("BERLAND");

        Team other = null;

        for (Entry<String, Team> e : teamsMap.entrySet()) {
            if (!e.getKey().equals("BERLAND") && e.getValue().games == 2) {
                other = e.getValue();
                break;
            }
        }

        berland.points += 3;

        ArrayList<Team> list = new ArrayList<>(6);

        for (Team t : teamsMap.values()) {
            list.add(t);
        }

        int bgd = berland.goalsDone;
        int bgl = berland.goalsLost;

        int ogd = other.goalsDone;
        int ogl = other.goalsLost;

        ArrayList<Count> count = new ArrayList<>(1000);

        for (int i = 1; i <= 1000; i++) {
            berland.goalsDone = bgd + i;
            other.goalsLost = ogl + i;

            for (int j = i - 1; j >= 0; j--) {
                berland.goalsLost = bgl + j;
                other.goalsDone = ogd + j;

                Collections.sort(list, comparator);

                if (list.get(0).country.equals("BERLAND") || list.get(1).country.equals("BERLAND")) {
                    count.add(new Count(i, j));
                }
            }
        }

        Collections.sort(count, countcomparator);

        System.out.print(count.size() == 0 ? "IMPOSSIBLE" : (count.get(0).win + ":" + count.get(0).los));
    }
}

import java.util.*;
import java.io.*;

public class Main{

    BufferedReader in;
    StringTokenizer str = null;
    PrintWriter out;

    private String next() throws Exception{
    	while (str == null || !str.hasMoreElements())
    	    str = new StringTokenizer(in.readLine());
    	return str.nextToken();
    }

    private int nextInt() throws Exception{
	   return Integer.parseInt(next());
    }

    Map<String, Team> map;

    public void run() throws Exception{
    	in = new BufferedReader(new InputStreamReader(System.in));
    	out = new PrintWriter(System.out);

        map = new HashMap<String, Team>();
        for(int i = 0; i < 5; ++i) {
            String []a = in.readLine().split(" ");
            // System.out.println(Arrays.toString(a));
            Team t1 = null, t2 = null;
            if (!map.containsKey(a[0])) {
                map.put(a[0], new Team(a[0]));
            }
            t1 = map.get(a[0]);
            if (!map.containsKey(a[1])) {
                map.put(a[1], new Team(a[1]));
            }
            t2 = map.get(a[1]);
            a = a[2].split(":");
            int s1 = Integer.parseInt(a[0]), s2 = Integer.parseInt(a[1]);
            t1.zabil += s1;
            t1.propustil += s2;
            t1.played += 1;
            t2.zabil += s2;
            t2.propustil += s1;
            t2.played += 1;

            if (s1 > s2) {
                t1.pts += 3;
            }else if (s1 < s2) {
                t2.pts += 3;
            }else {
                t1.pts += 1;
                t2.pts += 1;
            }
        }

        Team []t = new Team[4];
        int at = 0;
        for(String i : map.keySet()) {
            t[at++] = map.get(i);
        }

        Team berland = map.get("BERLAND");
        Team other = null;
        for(int i = 0; i < 4; ++i) {
            if (t[i].played == 2) {
                if (t[i].name.equals("BERLAND")) continue;
                other = t[i];
            }
        }

        berland.pts += 3;
        berland.played += 1;

        other.played += 1;

        int score1 = -1, score2 = -1;

        for(int x = 0; x < 1000; ++x) {
            for(int y = 0; y < x; ++y) {
                Team []b = new Team[4];
                at = 0;
                for(int i = 0; i < 4; ++i) {
                    if (t[i].name.equals("BERLAND")) continue;
                    if (t[i].name.equals(other.name)) continue;
                    b[at++] = t[i];
                }
                Team berl = new Team(berland);
                Team opp = new Team(other);
                berl.zabil += x;
                berl.propustil += y;
                opp.zabil += y;
                opp.propustil += x;

                b[at++] = berl;
                b[at++] = opp;

                Arrays.sort(b);
                if (b[0].name.equals("BERLAND") || b[1].name.equals("BERLAND")) {
                    if (score1 == -1) {
                        score1 = x;
                        score2 = y;
                    }else if (score1 - score2 > x - y) {
                        score1 = x;
                        score2 = y;
                    }else if (score1 - score2 == x - y && score2 > y) {
                        score1 = x;
                        score2 = y;
                    }
                }
            }
        }
        if (score1 == -1) {
            out.println("IMPOSSIBLE");
        }else {
            out.println(score1 + ":" + score2);
        }

        out.close();
    }

    class Team implements Comparable<Team> {
        String name;
        int pts, zabil, propustil, played;
        public Team(String name) {
            this.name = name;
            pts = 0;
            zabil = 0;
            propustil = 0;
            played = 0;
        }

        public Team(Team other) {
            this.name = other.name;
            this.pts = other.pts;
            this.zabil = other.zabil;
            this.propustil = other.propustil;
            this.played = other.played;
        }

        public int hashCode() {
            return name.hashCode();
        }

        public int compareTo(Team other) {
            if (this.pts > other.pts) return -1;
            if (this.pts < other.pts) return 1;
            if (zabil - propustil > other.zabil - other.propustil) return -1;
            if (zabil - propustil < other.zabil - other.propustil) return 1;
            if (zabil > other.zabil) return -1;
            if (zabil < other.zabil) return 1;
            return name.compareTo(other.name);
        }
    }

    public static void main(String args[]) throws Exception{
	   new Main().run();
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.geom.*;

import static java.lang.Math.*;

public class Solution implements Runnable {

	class Team implements Comparable<Team> {
		int points, goals, misses;
		String name;

		public Team(String name) {
			this.name = name;
			points = goals = misses = 0;
		}

		public Team(String name, int points, int goals, int misses) {
			this.name = name;
			this.points = points;
			this.goals = goals;
			this.misses = misses;
		}

		@Override
		public int compareTo(Team arg0) {
			if (this.points > arg0.points) return -1;
			if (this.points < arg0.points) return 1;
			if ((this.goals - this.misses) > (arg0.goals - arg0.misses)) return -1;
			if ((this.goals - this.misses) < (arg0.goals - arg0.misses)) return 1;
			if (this.goals > arg0.goals) return -1;
			if (this.goals < arg0.goals) return 1;
			return this.name.compareTo(arg0.name);
		}

	}

	int n;
	Team teams [];
	HashMap<String, Integer> teamToIndex = new HashMap<String, Integer>();
	HashMap<String, Integer> teamToGames = new HashMap<String, Integer>();

	int getTeamIndex (String team) {
		if (teamToIndex.containsKey(team)) return teamToIndex.get(team);
		teamToIndex.put(team, n++);
		return n - 1;
	}

	void increaseGames (String team) {
		Integer games = teamToGames.get(team);
		if (games == null) games = 0;
		games++;
		teamToGames.put(team, games);
	}

	int sgoal1 = -1, sgoal2 = -1;

	void check (int goal1, int goal2, int index1, int index2) {
		Team [] sortTeams = new Team [4];
		for (int i = 0; i < 4; i++) {
			sortTeams [i] = new Team (teams[i].name, teams[i].points, teams[i].goals, teams[i].misses);
		}

		sortTeams[index1].goals += goal1; sortTeams[index1].misses += goal2;
		sortTeams[index2].goals += goal2; sortTeams[index2].misses += goal1;
		sortTeams[index1].points += 3;

		Arrays.sort(sortTeams);

		if (sortTeams[0].name.equals("BERLAND") || sortTeams[1].name.equals("BERLAND")) {
			if (sgoal1 == -1) {
				sgoal1 = goal1;
				sgoal2 = goal2;
			} else {
				if (sgoal1 - sgoal2 > goal1 - goal2) {
					sgoal1 = goal1;
					sgoal2 = goal2;
				} else if (sgoal1 - sgoal2 == goal1 - goal2) {
					if (sgoal2 > goal2) {
						sgoal1 = goal1;
						sgoal2 = goal2;
					}
				}
			}
		}
	}

	public void solve () throws Exception {
		teams = new Team [4];
		for (int i = 0; i < 5; i++) {
			String team1 = nextToken();
			String team2 = nextToken();
			String score [] = nextToken().split(":");

			int goal1 = Integer.parseInt(score[0]);
			int goal2 = Integer.parseInt(score[1]);
			int index1 = getTeamIndex(team1);
			int index2 = getTeamIndex(team2);

			if (teams[index1] == null) teams[index1] = new Team (team1);
			if (teams[index2] == null) teams[index2] = new Team (team2);

			teams[index1].goals += goal1; teams[index1].misses += goal2;
			teams[index2].goals += goal2; teams[index2].misses += goal1;

			if (goal1 > goal2) {
				teams[index1].points += 3;
			} else if (goal1 == goal2) {
				teams[index1].points ++;
				teams[index2].points ++;
			} else {
				teams[index2].points += 3;
			}

			increaseGames(team1);
			increaseGames(team2);
		}

		String berland = "BERLAND";
		String opponent = "";

		for (String team : teamToGames.keySet()) {
			if (teamToGames.get(team) == 2 && !team.equals("BERLAND")) {
				opponent = team;
				break;
			}
		}

		for (int goal1 = 0; goal1 < 100; goal1++) {
			for (int goal2 = 0; goal2 < 100; goal2++) {
				if (goal2 >= goal1) continue;

				int index1 = getTeamIndex(berland);
				int index2 = getTeamIndex(opponent);

				check(goal1, goal2, index1, index2);

			}
		}

		if (sgoal1 == -1) {
			out.println("IMPOSSIBLE");
		} else {
			out.println(sgoal1+":"+sgoal2);
		}

	}

	static final String fname = "";
	static long stime = 0;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	private String nextToken () throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	private int nextInt () throws Exception {
		return Integer.parseInt(nextToken());
	}

	private long nextLong () throws Exception {
		return Long.parseLong(nextToken());
	}

	private double nextDouble () throws Exception {
		return Double.parseDouble(nextToken());
	}

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve ();
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Solution(), "", 1<<26).start();
	}

}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		long time_beg = -1;
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		if (args.length > 0 && args[0].equals("outside")) {
			time_beg = System.currentTimeMillis();
			try {
				inputStream = new FileInputStream("io/in.txt");
//				outputStream = new FileOutputStream("io/out.txt");
			} catch (Exception e) {
				System.err.println(e);
				System.exit(1);
			}
		} else {
//			try {
//				inputStream = new FileInputStream("file_name");
//				outputStream = new FileOutputStream("file_name");
//			} catch (Exception e) {
//				System.err.println(e);
//				System.exit(1);
//			}
		}
		Solver s = new Solver();
		s.in = new InputReader(inputStream);
		s.out = new OutputWriter(outputStream);
		s.solve();
		s.out.close();
		if (args.length > 0 && args[0].equals("outside")) {
			System.err.printf("*** Total time: %.3f ***\n", (System.currentTimeMillis() - time_beg) / 1000.0);
		}
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object... objects) {
		writer.printf(format, objects);
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}
}

class Solver {
	InputReader in;
	OutputWriter out;

	void solve() {
		HashMap<String, Integer> M = new HashMap<>();
		String[] MR = new String[4];
		int count = 0;
		int[][] mas = new int[4][4];
		for (int j = 0; j < 4; ++j)
			for (int i = 0; i < 4; ++i)
				mas[j][i] = -1;
		for (int i = 0; i < 5; ++i) {
			String s = in.readLine();
			s = s.replace(':', ' ');
			String[] temp = s.split(" ");
			if (!M.containsKey(temp[0])) {
				MR[count] = temp[0];
				M.put(temp[0], count++);
			}
			if (!M.containsKey(temp[1])) {
				MR[count] = temp[1];
				M.put(temp[1], count++);
			}
			mas[M.get(temp[0])][M.get(temp[1])] = Integer.parseInt(temp[2]);
			mas[M.get(temp[1])][M.get(temp[0])] = Integer.parseInt(temp[3]);
		}
		int me = M.get("BERLAND");
		int he;
		for (he = 0; he < 4; ++he)
			if (he != me) {
				boolean flag = false;
				for (int i = 0; i < 4; ++i)
					if (he != i && mas[he][i] == -1) {
						flag = true;
						break;
					}
				if (flag) break;
			}
		int a = -1, b = -1;
		for (int x = 1; x < 100; ++x)
			for (int y = x - 1; y >= 0; --y) {
				mas[me][he] = x;
				mas[he][me] = y;
				int[] P = new int[4];
				int[] miss = new int[4];
				int[] hit = new int[4];
				for (int j = 0; j < 4; ++j)
					for (int i = 0; i < 4; ++i)
						if (j != i) {
							if (mas[j][i] > mas[i][j]) P[j] += 3;
							if (mas[j][i] == mas[i][j]) P[j] += 1;
							hit[j] += mas[j][i];
							miss[j] += mas[i][j];
						}
				ArrayList<Pair<Pair<Integer, Integer>, Pair<Integer, String>>> A = new ArrayList<>();
				for (int i = 0; i < 4; ++i)
					A.add(new Pair<Pair<Integer, Integer>, Pair<Integer, String>>(
							new Pair<Integer, Integer>(-P[i], -hit[i] + miss[i]),
							new Pair<Integer, String>(-hit[i], MR[i])));
				Collections.sort(A);
				if (A.get(0).second.second == MR[me] || A.get(1).second.second == MR[me]) {
					if (a == -1 || (a - b > x - y || (a - b == x - y && b > y))) {
						a = x;
						b = y;
					}
				}
			}
		if (a != -1) out.printFormat("%d:%d\n", a, b);
		else out.printLine("IMPOSSIBLE");
	}
}

class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
	U first;
	V second;

	Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair<U, V> o) {
		int value = first.compareTo(o.first);
		if (value != 0) return value;
		return second.compareTo(o.second);
	}

	@Override
	public String toString() {
		return "(" + first + ", " + second + ")";
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	String arr[];
	int goalsS[];
	int goalsM[];
	int points[];
	int match[];

	String arr1[];
	int goalsS1[];
	int goalsM1[];
	int points1[];
	int match1[];

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			if(!input())
				break;
			solve();
		}
	}

	void solve() throws IOException
	{
		int berl = 0, other = 0;

		arr1 = new String[4];
		goalsS1 = new int[4];
		goalsM1 = new int[4];
		points1 = new int[4];
		match1 = new int[4];

		for(int i = 0;i<4;i++)
		{
			if(arr[i].equals("BERLAND"))
				berl = i;
			if(match[i] == 2 && !(arr[i].equals("BERLAND")))
				other = i;

			arr1[i] = arr[i];
			goalsS1[i] = goalsS[i];
			goalsM1[i] = goalsM[i];
			points1[i] = points[i];
			match1[i] = match[i];
		}

		//debug(berl,other);
		//debug(arr,goalsS,goalsM,points,match);
		//debug(arr1,goalsS1,goalsM1,points1,match1);

		int mini = 100000000;
		int x = 100000000;
		int y = 10000000;

		for(int i = 0;i<100;i++)
		{
			for(int j = 0;j<i;j++)
			{
				goalsS1[berl] = i + goalsS[berl];
				goalsM1[berl] = j + goalsM[berl];
				points1[berl] = 3 + points[berl];
				match1[berl] = 1 + match[berl];

				goalsS1[other] = j + goalsS[other];
				goalsM1[other] = i + goalsM[other];
				points1[other] = points[other];
				match1[other] = 1 + match[other];

				int win = winner();
				//debug(i,j,win);
				//debug(goalsS1,goalsM1,points1,match1);

				if(win == 1 || win == 2)
				{
					if(i-j < mini)
					{
						mini = i-j;
						x = i;
						y = j;
					}
					else if(i-j == mini)
					{
						if(j<y)
						{
							mini = i-j;
							x = i;
							y = j;
						}
					}
				}
			}
		}
		if(mini == 100000000)
		{
			System.out.println("IMPOSSIBLE");
		}
		else
			System.out.println(x+":"+y);
	}

	int winner()
	{
		//String pos[] = new String[4];
		boolean done[] = new boolean[4];
		int pos[] = new int[4];

		int maxi = 0;
		int dcount = 0;

		while(dcount<4)
		{
			for(int i = 0;i<4;i++)
			{
				if(!done[i])
				{
					if(points1[i] > points1[maxi])
						maxi = i;
					else if(points1[i] == points1[maxi])
					{
						if(goalsS1[i] - goalsM1[i] > goalsS1[maxi] - goalsM1[maxi])
							maxi = i;
						else if(goalsS1[i] - goalsM1[i] == goalsS1[maxi] - goalsM1[maxi])
						{
							if(goalsS1[i] > goalsS1[maxi])
								maxi = i;
							else if(goalsS1[i] == goalsS1[maxi])
							{
								if(arr1[i].compareTo(arr1[maxi]) < 0)
									maxi = i;
							}
						}
					}
				}
			}
			done[maxi] = true;
			pos[dcount++] = maxi;
			for(int i = 0;i<4;i++)
				if(!done[i])
					maxi = i;
		}

		for(int i = 0;i<4;i++)
		{
			if(arr1[pos[i]].equals("BERLAND"))
				return (i+1);
		}
		return 1;
	}

	boolean input() throws IOException
	{
		arr = new String[4];
		goalsS = new int[4];
		goalsM = new int[4];
		points = new int[4];
		match = new int[4];

		int count = 0;

		for(int i = 0;i<5;i++)
		{
			//debug(arr);
			String a = ns();
			String b = ns();
			String scr = ns();

			int as = scr.charAt(0)-'0';
			int bs = scr.charAt(2)-'0';
			int scoreA = 0;
			int scoreB = 0;
			if(as == bs)
			{
				scoreA = 1;
				scoreB = 1;
			}
			else if(as > bs)
			{
				scoreA = 3;
				scoreB = 0;
			}
			else
			{
				scoreA = 0;
				scoreB = 3;
			}

			int k = find(a);
			//debug(k);
			if(k == -1)
			{
				k = count;
				count++;
			}
			arr[k] = a;
			goalsS[k]+= as;
			goalsM[k]+= bs;
			points[k]+= scoreA;
			match[k]+= 1;
			//debug(arr);

			k = find(b);
			//debug(k);

			if(k == -1)
			{
				k = count;
				count++;
			}
			arr[k] = b;
			goalsS[k]+= bs;
			goalsM[k]+= as;
			points[k]+= scoreB;
			match[k]+= 1;

			//debug(arr);

		}
		return true;
	}

	int find(String a)
	{
		for(int i = 0;i<4;i++)
		{
			if(a.equals(arr[i]))
				return i;
		}
		return -1;
	}
}

import java.io.*;
import java.util.*;

public class Solution {
    public static void main(String[] args) throws IOException {
        new Solution().run();
    }
    StringTokenizer tok;
    BufferedReader reader;
    PrintWriter out;
    void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //reader = new BufferedReader(new FileReader(new File("input.txt")));
        //out = new PrintWriter(new File("output.txt"));
        tok = null;
        solve();
        out.close();
    }
    String nextString() throws IOException {
        while(tok == null || !tok.hasMoreTokens()){
            tok = new StringTokenizer(reader.readLine()," \r\n:");
            //tok = new StringTokenizer(reader.readLine());
        }
        return tok.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextString());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextString());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextString());
    }
    int b_id;
    String idNames[];
    int score[] = new int[4];
    int sumGoal[] = new int[4];
    int sumDelta[] = new int[4];
    Integer place[] = new Integer[4];
    int getPlace(int res[][]){
        for(int i=0;i<4;i++){
            place[i]=i;
            score[i]=0;
            sumGoal[i]=0;
            sumDelta[i]=0;
        }
        for(int i=0;i<4;i++){
            for(int j=i+1;j<4;j++){
                if (res[i][j] > res[j][i]){
                    score[i]+=3;
                    score[j]+=0;
                }else if (res[i][j]==res[j][i]){
                    score[i]+=1;
                    score[j]+=1;
                }else{
                    score[i]+=0;
                    score[j]+=3;
                }
                sumDelta[i]+=res[i][j]-res[j][i];
                sumDelta[j]+=res[j][i]-res[i][j];
                sumGoal[i]+=res[i][j];
                sumGoal[j]+=res[j][i];
            }
        }
        Arrays.sort(place,new Comparator<Integer>(){
            @Override
            public int compare(Integer a, Integer b) {
                if (score[a] == score[b]){
                    if (sumDelta[a]==sumDelta[b]){
                        if (sumGoal[a]==sumGoal[b])
                            return idNames[a].compareTo(idNames[b]);
                        return sumGoal[b]-sumGoal[a];
                    }
                    return sumDelta[b]-sumDelta[a];
                }
                return score[b]-score[a];
            }
        });
        for(int i=0;i<4;i++) if (place[i]==b_id)
            return i;
        assert false;
        return -1;
    }
    void solve() throws IOException {
        String Anames[] = new String[5];
        String Bnames[] = new String[5];
        int Aval[] = new int[5];
        int Bval[] = new int[5];
        TreeSet<String> names = new TreeSet<String>();
        for(int i=0;i<5;i++){
            Anames[i]=nextString();
            Bnames[i]=nextString();
            Aval[i]=nextInt();
            Bval[i]=nextInt();
            names.add(Anames[i]);
            names.add(Bnames[i]);
        }
        idNames = new String[names.size()];
        names.toArray(idNames);
        int results[][] = new int[4][4];
        for(int i=0;i<4;i++) Arrays.fill(results[i],-1);
        for(int i=0;i<5;i++){
            int a = Arrays.binarySearch(idNames,Anames[i]);
            int b = Arrays.binarySearch(idNames,Bnames[i]);
            results[a][b]=Aval[i];
            results[b][a]=Bval[i];
        }
        b_id = Arrays.binarySearch(idNames,"BERLAND");
        int c_id = -1;
        for(int i=0;i<4;i++) if (i!=b_id && results[b_id][i]==-1) c_id = i;
        int ans_x=1000,ans_y=0;
        for(int x=0;x<100;x++) for(int y=0;y<100;y++){
            if (x > y){
                results[b_id][c_id]=x;
                results[c_id][b_id]=y;
                int place = getPlace(results);
                if (place == 0 || place==1){
                    int ans_delta = ans_x-ans_y;
                    int cur_delta = x-y;
                    if (cur_delta < ans_delta || cur_delta==ans_delta && y < ans_y){
                        ans_x = x;
                        ans_y = y;
                    }
                }
            }
        }
        if (ans_x == 1000)
            out.print("IMPOSSIBLE");
        else
            out.print(ans_x+":"+ans_y);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out,true);
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Map<String,Team> teams = new HashMap<>();
        for(int i = 0;i < 5;i++) {
            StringTokenizer st = new StringTokenizer(in.readLine()," :");
            String team1 = st.nextToken();
            String team2 = st.nextToken();
            if(!teams.containsKey(team1)) teams.put(team1,new Team(team1));
            if(!teams.containsKey(team2)) teams.put(team2,new Team(team2));
            int goals1 = Integer.parseInt(st.nextToken());
            int goals2 = Integer.parseInt(st.nextToken());
            if(goals1 > goals2) {
                teams.get(team1).points += 3;
                teams.get(team1).dist += goals1 - goals2;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 0;
                teams.get(team2).dist += goals2 - goals1;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
            if(goals1 < goals2) {
                teams.get(team1).points += 0;
                teams.get(team1).dist += goals1 - goals2;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 3;
                teams.get(team2).dist += goals2 - goals1;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
            if(goals1 == goals2) {
                teams.get(team1).points += 1;
                teams.get(team1).dist += 0;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 1;
                teams.get(team2).dist += 0;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
        }
        Team[] mas = new Team[4];
        int i = 0;
        for(Map.Entry<String,Team> a : teams.entrySet()) {
            mas[i] = a.getValue();
            i++;
        }
        int min = 1000000;
        int a = -1;
        int b = -1;
        for(int j = 0;j <= 500;j++) {
            for(int k = 0;k <= 500;k++) {
                if(k <= j) continue;
                for(int p = 0;p < mas.length;p++) {
                    if(mas[p].name.equals("BERLAND")) {
                        mas[p].points += 3;
                        mas[p].dist += k-j;
                        mas[p].goals += k;
                    }
                    if(mas[p].matches == 2 && !mas[p].name.equals("BERLAND")) {
                        mas[p].points += 0;
                        mas[p].dist += j-k;
                        mas[p].goals += j;
                    }
                }
                Arrays.sort(mas, new Comparator<Team>() {
                    @Override
                    public int compare(Team t1, Team t2) {
                        if(t1.points > t2.points) return -1;
                        if(t1.points < t2.points) return 1;
                        if(t1.dist > t2.dist) return -1;
                        if(t1.dist < t2.dist) return 1;
                        if(t1.goals > t2.goals) return -1;
                        if(t1.goals < t2.goals) return 1;
                        return t1.name.compareTo(t2.name);
                    }
                });
                for(int p = 0;p < mas.length;p++) {
                    if(mas[p].name.equals("BERLAND")) {
                        mas[p].points -= 3;
                        mas[p].dist -= k-j;
                        mas[p].goals -= k;
                    }
                    if(mas[p].matches == 2 && !mas[p].name.equals("BERLAND")) {
                        mas[p].points -= 0;
                        mas[p].dist -= j-k;
                        mas[p].goals -= j;
                    }
                }
                if(mas[0].name.equals("BERLAND") || mas[1].name.equals("BERLAND")) {
                    if(k-j < min) {
                        a = k;
                        b = j;
                        min = k-j;
                    }
                }
            }

        }
        if(a < 0) {
            out.println("IMPOSSIBLE");
        }else{
            out.println(a+":"+b);
        }

    }

    public static boolean T1bolT2(Team t1, Team t2) {
        if(t1.points > t2.points) return true;
        else if(t1.dist > t2.dist) return true;
        else if(t1.goals > t2.goals) return true;
        else if(t1.name.compareTo(t2.name) < 0) return true;
        return false;
    }
}

class Team {
    String name;
    int points = 0;
    int dist = 0;
    int goals = 0;
    int matches = 0;
    Team(String name) {
        this.name = name;
    }
}

import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        HashMap<String, State> teams = new HashMap<>();
        for (int i = 0; i < 5; ++i) {
            String x = sc.next(), y = sc.next();
            String[] z = sc.next().split(":");
            int a = Integer.parseInt(z[0]), b = Integer.parseInt(z[1]);
            teams.computeIfAbsent(x, State::new).update(a, b);
            teams.computeIfAbsent(y, State::new).update(b, a);
        }
        String t1 = "BERLAND", t2 = null;
        for(Map.Entry<String, State> e: teams.entrySet())
            if(e.getValue().played == 2 && !e.getKey().equals(t1))
                t2 = e.getKey();
        State s1 = teams.get(t1), s2 = teams.get(t2);

        boolean possible = false;
        ll: for(int d = 1; d < 100; ++d)
            for(int i = d; i < 100; ++i) {
                int j = i - d;
                State bState = s1.play(i, j);
                teams.put(t1, bState);
                teams.put(t2, s2.play(j, i));
                int cnt = 0;
                for (State s: teams.values())
                    if(s.compareTo(bState) < 0)
                        ++cnt;
                if (cnt <= 1) {
                    possible = true;
                    out.println(i + ":" + j);
                    break ll;
                }
            }

        if (!possible) out.println("IMPOSSIBLE");
        out.close();

    }

    static class State implements Comparable<State> {
        int points, goalsFor, goalsAgainst, played;
        String name;

        State(String s) { name = s; }

        void update(int x, int y) {
            goalsFor += x;
            goalsAgainst += y;
            points += x > y ? 3 : x < y ? 0 : 1;
            played++;
        }

        State play(int x, int y) {
            State newState = new State(name);
            newState.points = points;
            newState.goalsFor = goalsFor;
            newState.goalsAgainst = goalsAgainst;
            newState.update(x, y);
            return newState;
        }

        @Override
        public int compareTo(State s) {
            if (points != s.points)
                return s.points - points;
            int gd1 = goalsFor - goalsAgainst;
            int gd2 = s.goalsFor - s.goalsAgainst;
            if (gd1 != gd2)
                return gd2 - gd1;
            if (goalsFor != s.goalsFor)
                return s.goalsFor - goalsFor;
            return name.compareTo(s.name);
        }
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public boolean ready() throws IOException {return br.ready();}

    }
}

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main
{
    public static class GameResults
    {
        int points;
        int successful_balls;
        int unsuccessful_balls;
        int games_played;
        GameResults()
        {
            points = 0;
            successful_balls = 0;
            unsuccessful_balls = 0;
            games_played = 0;
        }
    }
    public static class Answer
    {
        int good;
        int bad;
        Answer()
        {
            good = 100;
            bad = 0;
        }
    }
    static boolean is_better( GameResults arg1, GameResults arg2, String arg1_name, String arg2_name )
    {
        if ( arg1.points > arg2.points ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls > arg2.successful_balls - arg2.unsuccessful_balls ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls == arg2.successful_balls - arg2.unsuccessful_balls &&
                  arg1.successful_balls > arg2.successful_balls ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls == arg2.successful_balls - arg2.unsuccessful_balls &&
                  arg1.successful_balls == arg2.successful_balls && arg1_name.compareTo( arg2_name ) < 0 ) return true;
        else return false;
    }
    public static void main( String[] args )
    {
        Scanner in = new Scanner( System.in );
        Map < String, GameResults > football_result = new TreeMap<String, GameResults>();
        for ( int i = 1; i < 6; i++ )
        {
            String first_team_name = in.next();
            String second_team_name = in.next();
            if ( football_result.get( first_team_name ) == null ) football_result.put( first_team_name, new GameResults() );
            if ( football_result.get( second_team_name ) == null ) football_result.put( second_team_name, new GameResults() );
            String balls = in.next();
            int first_team_balls = Character.digit( balls.charAt( 0 ), 10 );
            int second_team_balls = Character.digit( balls.charAt( 2 ), 10 );
            football_result.get( first_team_name ).successful_balls += first_team_balls;
            football_result.get( first_team_name ).unsuccessful_balls += second_team_balls;
            football_result.get( first_team_name ).games_played++;
            football_result.get( second_team_name ).successful_balls += second_team_balls;
            football_result.get( second_team_name ).unsuccessful_balls += first_team_balls;
            football_result.get( second_team_name ).games_played++;
            if ( first_team_balls > second_team_balls ) football_result.get( first_team_name ).points += 3;
            else if ( first_team_balls == second_team_balls )
            {
                football_result.get( first_team_name ).points += 1;
                football_result.get( second_team_name ).points += 1;
            }
            else football_result.get( second_team_name ).points += 3;
        }
        football_result.get( "BERLAND" ).points += 3;

        String opponent_team = "";
        for ( String element : football_result.keySet() )
        {
            if ( element.equals( "BERLAND" ) ) continue;
            if ( football_result.get( element ).games_played < 3 ) opponent_team = element;
        }

        Answer answer = new Answer();
        for ( int good = 1; good < 100; good++ )
        {
            for ( int bad = 0; bad < good; bad++ )
            {
                football_result.get( opponent_team ).unsuccessful_balls += good;
                football_result.get( opponent_team ).successful_balls += bad;
                football_result.get( "BERLAND" ).successful_balls += good;
                football_result.get( "BERLAND" ).unsuccessful_balls += bad;
                int count = 0;
                for ( String element : football_result.keySet() )
                {
                    if ( element.equals( "BERLAND" ) ) continue;
                    if ( is_better( football_result.get( "BERLAND" ), football_result.get( element ), "BERLAND", element ) ) count++;
                    if ( count >= 2 )
                    {
                        if ( answer.good - answer.bad > good - bad ) { answer.good = good; answer.bad = bad; }
                        else if ( answer.good - answer.bad == good - bad && answer.bad > bad ) { answer.good = good; answer.bad = bad; }
                    }
                }
                football_result.get( opponent_team ).unsuccessful_balls -= good;
                football_result.get( opponent_team ).successful_balls -= bad;
                football_result.get( "BERLAND" ).successful_balls -= good;
                football_result.get( "BERLAND" ).unsuccessful_balls -= bad;
            }
        }
        if ( answer.good == 100 ) System.out.println( "IMPOSSIBLE" );
        else System.out.println( answer.good + ":" + answer.bad );
    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class C implements Runnable {

    // leave empty to read from stdin/stdout
    private static final String TASK_NAME_FOR_IO = "";

    // file names
    private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";
    private static final String FILE_OUT = TASK_NAME_FOR_IO + ".out";

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tokenizer = new StringTokenizer("");

    public static void main(String[] args) {
        new Thread(new C()).start();
    }

    int TEAMS = 4;

    class Table {

        int[] points;
        int[] gScored;
        int[] gReceived;
        int[] gPlayed;

        Table() {
            points = new int[TEAMS];
            gScored = new int[TEAMS];
            gReceived = new int[TEAMS];
            gPlayed = new int[TEAMS];
        }

        public Table(int[] points, int[] gScored, int[] gReceived, int[] gPlayed) {
            this.points = points.clone();
            this.gScored = gScored.clone();
            this.gReceived = gReceived.clone();
            this.gPlayed = gPlayed.clone();
        }

        void addGame(int t1, int t2, int g1, int g2) {
            // process points
            if (g1 > g2) {
                points[t1] += 3;
            } else if (g1 < g2) {
                points[t2] += 3;
            } else {
                points[t1]++;
                points[t2]++;
            }

            // process gScored and gReceived
            gScored[t1] += g1;
            gReceived[t1] += g2;
            gScored[t2] += g2;
            gReceived[t2] += g1;

            // process gPlayed
            gPlayed[t1]++;
            gPlayed[t2]++;
        }

        Table copy() {
            return new Table(this.points, this.gScored, this.gReceived, this.gPlayed);
        }

        public int getTeamPlace(int teamIdx) {
            List<Integer> idx = new ArrayList<Integer>();
            for (int i = 0; i < TEAMS; i++) {
                idx.add(i);
            }

            Collections.sort(idx, new Comparator<Integer>() {
                public int compare(Integer t1, Integer t2) {

                    if (points[t1] > points[t2]) return -1;
                    if (points[t1] < points[t2]) return 1;

                    if (gScored[t1] - gReceived[t1] > gScored[t2] - gReceived[t2]) return -1;
                    if (gScored[t1] - gReceived[t1] < gScored[t2] - gReceived[t2]) return 1;

                    if (gScored[t1] > gScored[t2]) return -1;
                    if (gScored[t1] < gScored[t2]) return 1;

                    if (teamName.get(t1).compareTo(teamName.get(t2)) < 0) return -1;
                    if (teamName.get(t1).compareTo(teamName.get(t2)) > 0) return 1;

                    return 0;
                }
            });

            for (int place = 0; place < TEAMS; place++)
                if (idx.get(place) == teamIdx) {
                    return place;
                }

            throw new IllegalStateException("Cannot find team place");
        }

    }

    Table main;
    Map<String, Integer> teamIdx;
    Map<Integer, String> teamName;

    private void solve() throws IOException {
        teamIdx = new HashMap<String, Integer>();
        teamName = new HashMap<Integer, String>();
        main = new Table();
        for (int i = 0; i < 5; i++) {
            int t1 = getTeamIdx(nextToken());
            int t2 = getTeamIdx(nextToken());
            StringTokenizer score = new StringTokenizer(nextToken(), ":");
            int g1 = Integer.parseInt(score.nextToken());
            int g2 = Integer.parseInt(score.nextToken());
            main.addGame(t1, t2, g1, g2);
        }

        int berlandIdx = teamIdx.get("BERLAND");
        int notBerlandIdx = -1;
        for (int i = 0; i < TEAMS; i++)
            if (main.gPlayed[i] == 2 && i != berlandIdx) {
                notBerlandIdx = i;
                break;
            }

        if (notBerlandIdx == -1) {
            throw new IllegalStateException("Invalid input");
        }

        long bestX = Integer.MAX_VALUE;
        long bestY = Integer.MIN_VALUE;
        for (int x = 0; x <= 500; x++)
            for (int y = 0; y < x; y++) {
                Table results = main.copy();
                results.addGame(berlandIdx, notBerlandIdx, x, y);

                int berlandPlace = results.getTeamPlace(berlandIdx);
                if (berlandPlace == 0 || berlandPlace == 1) {

                    if (x - y < bestX - bestY) {
                        bestX = x;
                        bestY = y;
                    } else if ((x - y == bestX - bestY) && (y < bestY)) {
                        bestX = x;
                        bestY = y;
                    }

                }
            }

        if (bestX < Integer.MAX_VALUE) {
            out.println(bestX + ":" + bestY);
        } else {
            out.println("IMPOSSIBLE");
        }
    }

    private int getTeamIdx(String name) {
        Integer result = teamIdx.get(name);
        if (result == null) {
            result = teamIdx.size();
            teamIdx.put(name, result);
            teamName.put(result, name);
        }
        return result;
    }

    public void run() {
        long timeStart = System.currentTimeMillis();

        boolean fileIO = TASK_NAME_FOR_IO.length() > 0;
        try {

            if (fileIO) {
                in = new BufferedReader(new FileReader(FILE_IN));
                out = new PrintWriter(new FileWriter(FILE_OUT));
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            solve();

            in.close();
            out.close();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        long timeEnd = System.currentTimeMillis();

        if (fileIO) {
            System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");
        }
    }

    private String nextToken() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private BigInteger nextBigInt() throws IOException {
        return new BigInteger(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}

import java.io.*;
import java.util.*;
import java.math.*;

public class C implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	Random rnd;

	final int border = 32;

	class Team implements Comparable<Team> {
		String name;
		int matches, points, goalsFor, goalsAgainst;

		public Team(String name) {
			this.name = name;
		}

		public int goalsDiff() {
			return goalsFor - goalsAgainst;
		}

		public int compareTo(Team o) {
			if (points != o.points) {
				return -(points - o.points);
			}

			if (goalsDiff() != o.goalsDiff()) {
				return -(goalsDiff() - o.goalsDiff());
			}

			if (goalsFor != o.goalsFor) {
				return -(goalsFor - o.goalsFor);
			}

			return name.compareTo(o.name);
		}
	}

	Map<String, Team> indexes = new HashMap<String, Team>();
	List<Team> teams = new ArrayList<Team>();

	void addPoints(String teamName, int points, int goalsFor, int goalsAgainst,
			boolean add) {
		int matchInc = 1;

		if (!add) {
			points = -points;
			goalsFor = -goalsFor;
			goalsAgainst = -goalsAgainst;
			matchInc = -matchInc;
		}

		Team team = indexes.get(teamName);

		if (team == null) {
			team = new Team(teamName);
			indexes.put(teamName, team);
			teams.add(team);
		}

		team.points += points;
		team.goalsFor += goalsFor;
		team.goalsAgainst += goalsAgainst;
		team.matches += matchInc;
	}

	int getIndex(Team team) {
		Collections.sort(teams);

		// printTable();

		for (int i = 0; i < teams.size(); i++) {
			Team o = teams.get(i);

			if (o == team) {
				return i;
			}
		}

		throw new AssertionError();
	}

	void printTable() {
		out.println("Table:");

		for (Team team : teams) {
			out.println(team.name + " " + team.matches + " " + team.points
					+ " " + team.goalsFor + " " + team.goalsAgainst);

		}

		out.println("---");
	}

	boolean check(int diff, Team firstTeam, Team secondTeam, boolean flag) {
		int l = diff - 1, r = border + 1;

		while(r - l > 1) {
			int x = (l + r) / 2, y = x - diff;

			addPoints(firstTeam.name, 3, x, y, true);
			addPoints(secondTeam.name, 0, y, x, true);

			int pos = getIndex(firstTeam);

			addPoints(firstTeam.name, 3, x, y, false);
			addPoints(secondTeam.name, 0, y, x, false);

			if (pos <= 1) {
				r = x;
			} else {
				l = x;
			}
		}

		if(r > border) {
			return false;
		} else {
			if(flag) {
				out.println(r + ":" + (r - diff));
			}
			return true;
		}
	}

	void solve() throws IOException {
		for (int i = 0; i < 5; i++) {
			String match = in.readLine().trim();
			String[] tokens = match.split(" ");
			String firstName = tokens[0], secondName = tokens[1];
			String[] scores = tokens[2].split("\\:");
			int firstScore = Integer.parseInt(scores[0]), secondScore = Integer
					.parseInt(scores[1]);
			int firstPoints = 0, secondPoints = 0;

			if (firstScore > secondScore) {
				firstPoints = 3;
			} else if (firstScore < secondScore) {
				secondPoints = 3;
			} else {
				firstPoints = secondPoints = 1;
			}

			addPoints(firstName, firstPoints, firstScore, secondScore, true);
			addPoints(secondName, secondPoints, secondScore, firstScore, true);
		}

		Team firstTeam = indexes.get("BERLAND"), secondTeam = null;

		for (Team team : teams) {
			if (team != firstTeam && team.matches == 2) {
				secondTeam = team;
			}
		}

		int l = 0, r = border + 1;

		while (r - l > 1) {
			int diff = (l + r) / 2;

			boolean found = check(diff, firstTeam, secondTeam, false);

			if(found) {
				r = diff;
			} else {
				l = diff;
			}
		}

		if(r > border) {
			out.println("IMPOSSIBLE");
		} else {
			check(r, firstTeam, secondTeam, true);
		}

	}

	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(42);
		}
	}

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null) {
				return null;
			}

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class C implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	Random rnd;

	class Team implements Comparable<Team> {
		String name;
		int matches, points, goalsFor, goalsAgainst;

		public Team(String name) {
			this.name = name;
		}

		public int goalsDiff() {
			return goalsFor - goalsAgainst;
		}

		public int compareTo(Team o) {
			if (points != o.points) {
				return -(points - o.points);
			}

			if (goalsDiff() != o.goalsDiff()) {
				return -(goalsDiff() - o.goalsDiff());
			}

			if (goalsFor != o.goalsFor) {
				return -(goalsFor - o.goalsFor);
			}

			return name.compareTo(o.name);
		}
	}

	Map<String, Team> indexes = new HashMap<String, Team>();
	List<Team> teams = new ArrayList<Team>();

	void addPoints(String teamName, int points, int goalsFor, int goalsAgainst,
			boolean add) {
		int matchInc = 1;

		if (!add) {
			points = -points;
			goalsFor = -goalsFor;
			goalsAgainst = -goalsAgainst;
			matchInc = -matchInc;
		}

		Team team = indexes.get(teamName);

		if (team == null) {
			team = new Team(teamName);
			indexes.put(teamName, team);
			teams.add(team);
		}

		team.points += points;
		team.goalsFor += goalsFor;
		team.goalsAgainst += goalsAgainst;
		team.matches += matchInc;
	}

	int getIndex(Team team) {
		Collections.sort(teams);

		//printTable();

		for (int i = 0; i < teams.size(); i++) {
			Team o = teams.get(i);

			if (o == team) {
				return i;
			}
		}

		throw new AssertionError();
	}

	void printTable() {
		out.println("Table:");

		for(Team team : teams) {
			out.println(team.name + " " + team.matches + " " + team.points + " " + team.goalsFor + " " + team.goalsAgainst);

		}

		out.println("---");
	}

	void solve() throws IOException {
		for (int i = 0; i < 5; i++) {
			String match = in.readLine().trim();
			String[] tokens = match.split(" ");
			String firstName = tokens[0], secondName = tokens[1];
			String[] scores = tokens[2].split("\\:");
			int firstScore = Integer.parseInt(scores[0]), secondScore = Integer
					.parseInt(scores[1]);
			int firstPoints = 0, secondPoints = 0;

			if (firstScore > secondScore) {
				firstPoints = 3;
			} else if (firstScore < secondScore) {
				secondPoints = 3;
			} else {
				firstPoints = secondPoints = 1;
			}

			addPoints(firstName, firstPoints, firstScore, secondScore, true);
			addPoints(secondName, secondPoints, secondScore, firstScore, true);
		}

		Team firstTeam = indexes.get("BERLAND"), secondTeam = null;

		for (Team team : teams) {
			if (team != firstTeam && team.matches == 2) {
				secondTeam = team;
			}
		}

		for(int diff = 1; diff <= 100; diff++) {
			for (int x = diff; x <= 100; x++) {
				int y = x - diff;

				addPoints(firstTeam.name, 3, x, y, true);
				addPoints(secondTeam.name, 0, y, x, true);

				if(getIndex(firstTeam) <= 1) {
					out.println(x + ":" + y);
					return;
				}

				addPoints(firstTeam.name, 3, x, y, false);
				addPoints(secondTeam.name, 0, y, x, false);
			}
		}

		out.println("IMPOSSIBLE");

	}

	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(42);
		}
	}

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null) {
				return null;
			}

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class C implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	Random rnd;

	class Team implements Comparable<Team> {
		String name;
		int matches, points, goalsFor, goalsAgainst;

		public Team(String name) {
			this.name = name;
		}

		public int goalsDiff() {
			return goalsFor - goalsAgainst;
		}

		public int compareTo(Team o) {
			if (points != o.points) {
				return -(points - o.points);
			}

			if (goalsDiff() != o.goalsDiff()) {
				return -(goalsDiff() - o.goalsDiff());
			}

			if (goalsFor != o.goalsFor) {
				return -(goalsFor - o.goalsFor);
			}

			return name.compareTo(o.name);
		}
	}

	Map<String, Team> indexes = new HashMap<String, Team>();
	List<Team> teams = new ArrayList<Team>();

	void addPoints(String teamName, int points, int goalsFor, int goalsAgainst,
			boolean add) {
		int matchInc = 1;

		if (!add) {
			points = -points;
			goalsFor = -goalsFor;
			goalsAgainst = -goalsAgainst;
			matchInc = -matchInc;
		}

		Team team = indexes.get(teamName);

		if (team == null) {
			team = new Team(teamName);
			indexes.put(teamName, team);
			teams.add(team);
		}

		team.points += points;
		team.goalsFor += goalsFor;
		team.goalsAgainst += goalsAgainst;
		team.matches += matchInc;
	}

	int getIndex(Team team) {
		Collections.sort(teams);

		// printTable();

		for (int i = 0; i < teams.size(); i++) {
			Team o = teams.get(i);

			if (o == team) {
				return i;
			}
		}

		throw new AssertionError();
	}

	void printTable() {
		out.println("Table:");

		for (Team team : teams) {
			out.println(team.name + " " + team.matches + " " + team.points
					+ " " + team.goalsFor + " " + team.goalsAgainst);

		}

		out.println("---");
	}

	boolean check(int diff, Team firstTeam, Team secondTeam, boolean flag) {
		for (int x = diff; x <= 100; x++) {
			int y = x - diff;

			addPoints(firstTeam.name, 3, x, y, true);
			addPoints(secondTeam.name, 0, y, x, true);

			int pos = getIndex(firstTeam);

			addPoints(firstTeam.name, 3, x, y, false);
			addPoints(secondTeam.name, 0, y, x, false);

			if (pos <= 1) {
				if (flag) {
					out.println(x + ":" + y);
				}
				return true;
			}
		}

		return false;
	}

	void solve() throws IOException {
		for (int i = 0; i < 5; i++) {
			String match = in.readLine().trim();
			String[] tokens = match.split(" ");
			String firstName = tokens[0], secondName = tokens[1];
			String[] scores = tokens[2].split("\\:");
			int firstScore = Integer.parseInt(scores[0]), secondScore = Integer
					.parseInt(scores[1]);
			int firstPoints = 0, secondPoints = 0;

			if (firstScore > secondScore) {
				firstPoints = 3;
			} else if (firstScore < secondScore) {
				secondPoints = 3;
			} else {
				firstPoints = secondPoints = 1;
			}

			addPoints(firstName, firstPoints, firstScore, secondScore, true);
			addPoints(secondName, secondPoints, secondScore, firstScore, true);
		}

		Team firstTeam = indexes.get("BERLAND"), secondTeam = null;

		for (Team team : teams) {
			if (team != firstTeam && team.matches == 2) {
				secondTeam = team;
			}
		}

		final int border = 128;
		int l = 0, r = border + 1;

		while (r - l > 1) {
			int diff = (l + r) / 2;

			boolean found = check(diff, firstTeam, secondTeam, false);

			if(found) {
				r = diff;
			} else {
				l = diff;
			}
		}

		if(r > border) {
			out.println("IMPOSSIBLE");
		} else {
			check(r, firstTeam, secondTeam, true);
		}

	}

	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(42);
		}
	}

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null) {
				return null;
			}

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.io.*;
import java.util.*;
import java.math.*;

public class C implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	Random rnd;

	final int border = 64;

	class Team implements Comparable<Team> {
		String name;
		int matches, points, goalsFor, goalsAgainst;

		public Team(String name) {
			this.name = name;
		}

		public int goalsDiff() {
			return goalsFor - goalsAgainst;
		}

		public int compareTo(Team o) {
			if (points != o.points) {
				return -(points - o.points);
			}

			if (goalsDiff() != o.goalsDiff()) {
				return -(goalsDiff() - o.goalsDiff());
			}

			if (goalsFor != o.goalsFor) {
				return -(goalsFor - o.goalsFor);
			}

			return name.compareTo(o.name);
		}
	}

	Map<String, Team> indexes = new HashMap<String, Team>();
	List<Team> teams = new ArrayList<Team>();

	void addPoints(String teamName, int points, int goalsFor, int goalsAgainst,
			boolean add) {
		int matchInc = 1;

		if (!add) {
			points = -points;
			goalsFor = -goalsFor;
			goalsAgainst = -goalsAgainst;
			matchInc = -matchInc;
		}

		Team team = indexes.get(teamName);

		if (team == null) {
			team = new Team(teamName);
			indexes.put(teamName, team);
			teams.add(team);
		}

		team.points += points;
		team.goalsFor += goalsFor;
		team.goalsAgainst += goalsAgainst;
		team.matches += matchInc;
	}

	int getIndex(Team team) {
		Collections.sort(teams);

		// printTable();

		for (int i = 0; i < teams.size(); i++) {
			Team o = teams.get(i);

			if (o == team) {
				return i;
			}
		}

		throw new AssertionError();
	}

	void printTable() {
		out.println("Table:");

		for (Team team : teams) {
			out.println(team.name + " " + team.matches + " " + team.points
					+ " " + team.goalsFor + " " + team.goalsAgainst);

		}

		out.println("---");
	}

	boolean check(int diff, Team firstTeam, Team secondTeam, boolean flag) {
		int l = diff - 1, r = border + 1;

		while(r - l > 1) {
			int x = (l + r) / 2, y = x - diff;

			addPoints(firstTeam.name, 3, x, y, true);
			addPoints(secondTeam.name, 0, y, x, true);

			int pos = getIndex(firstTeam);

			addPoints(firstTeam.name, 3, x, y, false);
			addPoints(secondTeam.name, 0, y, x, false);

			if (pos <= 1) {
				r = x;
			} else {
				l = x;
			}
		}

		if(r > border) {
			return false;
		} else {
			if(flag) {
				out.println(r + ":" + (r - diff));
			}
			return true;
		}
	}

	void solve() throws IOException {
		for (int i = 0; i < 5; i++) {
			String match = in.readLine().trim();
			String[] tokens = match.split(" ");
			String firstName = tokens[0], secondName = tokens[1];
			String[] scores = tokens[2].split("\\:");
			int firstScore = Integer.parseInt(scores[0]), secondScore = Integer
					.parseInt(scores[1]);
			int firstPoints = 0, secondPoints = 0;

			if (firstScore > secondScore) {
				firstPoints = 3;
			} else if (firstScore < secondScore) {
				secondPoints = 3;
			} else {
				firstPoints = secondPoints = 1;
			}

			addPoints(firstName, firstPoints, firstScore, secondScore, true);
			addPoints(secondName, secondPoints, secondScore, firstScore, true);
		}

		Team firstTeam = indexes.get("BERLAND"), secondTeam = null;

		for (Team team : teams) {
			if (team != firstTeam && team.matches == 2) {
				secondTeam = team;
			}
		}

		int l = 0, r = border + 1;

		while (r - l > 1) {
			int diff = (l + r) / 2;

			boolean found = check(diff, firstTeam, secondTeam, false);

			if(found) {
				r = diff;
			} else {
				l = diff;
			}
		}

		if(r > border) {
			out.println("IMPOSSIBLE");
		} else {
			check(r, firstTeam, secondTeam, true);
		}

	}

	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(42);
		}
	}

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null) {
				return null;
			}

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

// package CF;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class B {
	public static Team [] copyArray(Team [] org){
		Team [] newTeams = new Team[org.length];
		for (int i = 0; i < org.length; ++i) {
			newTeams[i] = new Team(org[i].name, org[i].goals, org[i].missedGoals);
			newTeams[i].points = org[i].points;
		}
		return newTeams;
	}
	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		Team [] teams = new Team[4];
		HashMap<String, Integer> names = new HashMap<>();
		HashSet<String> berlandTeams = new HashSet<>();
		berlandTeams.add("BERLAND");
		for (int i = 0; i < 5; ++i) {
			String [] teamNames = new String [] { sc.next(), sc.next() };
			String [] goals = sc.next().split(":");
			for (int j = 0; j < teamNames.length; ++j) {
				String teamName = teamNames[j];
				int idx = names.getOrDefault(teamName, names.size());
				names.put(teamName, idx);
				if (teams[idx] == null)
					teams[idx] = new Team(teamName, 0, 0);
				teams[idx].addMatchScores(Integer.parseInt(goals[j]), Integer.parseInt(goals[1-j]));
				if(teamName.equals("BERLAND")){
					berlandTeams.add(teamNames[1-j]);
				}
			}
		}
		int otherTeam = -1;
		int berlandTeam = names.get("BERLAND");
		for (int j = 0; j < teams.length; ++j) {
			if(!berlandTeams.contains(teams[j].name)){
				otherTeam = j;
			}
		}
		Team [] orgTeams = copyArray(teams);
		for (int k = 1; k < 50; ++k) {
			for (int i = 0; i < 50; ++i) {
				teams = copyArray(orgTeams);
				teams[berlandTeam].addMatchScores(i+k, i);
				teams[otherTeam].addMatchScores(i, i+k);
				Arrays.sort(teams);
				boolean can = false;
				for (int j = 0; j < 2 && !can; ++j) {
					if(teams[j].name.equals("BERLAND"))
						can = true;
				}
				if(can){
					out.println((i+k)+":"+i);
					out.flush();
					return;
				}
			}
		}
		out.println("IMPOSSIBLE");
		out.flush();
		out.close();
	}
	static class Team implements Comparable<Team> {
		String name;
		int points;
		int goals;
		int missedGoals;

		public Team(String n, int g, int mg){
			name = n;
			goals = g;
			missedGoals = mg;
		}

		public void addMatchScores(int myGoals, int otherGoals){
			goals += myGoals;
			missedGoals += otherGoals;

			if(myGoals > otherGoals)
				points += 3;
			else if(myGoals == otherGoals)
			{
				points += 1;
			}
		}

		@Override
		public int compareTo(Team o) {
			if(points != o.points)
				return o.points - points;
			else if(goals - missedGoals != o.goals - o.missedGoals)
				return (o.goals - o.missedGoals) - (goals - missedGoals);
			else if(goals != o.goals)
				return o.goals - goals;
			return name.compareTo(o.name);
		}

		public String toString(){
			return name + " " + points + " " + goals + " " + missedGoals;
		}

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s)
		{
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader)
		{
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
		public double nextDouble() throws IOException
		{
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException
		{
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException
		{
			return br.readLine();
		}

		public boolean ready() throws IOException
		{
			return br.ready();
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Collections;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nurlan Sofiyev
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public HashMap<String, Team> hm;
        public ArrayList<Team> teams;

        public void add(String name, int goal, int missed) {

            if (hm.containsKey(name)) {
                hm.get(name).update(goal, missed);
            } else {
                hm.put(name, new Team(name, goal, missed));
            }
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {

            hm = new HashMap<>();

            for (int i = 0; i < 5; ++i) {
                String A, B;
                int a, b;
                A = in.next();
                B = in.next();
                String[] temp = in.next().split(":");
                a = Integer.parseInt(temp[0]);
                b = Integer.parseInt(temp[1]);
                add(A, a, b);
                add(B, b, a);

            }
            teams = new ArrayList<>(hm.values());
            Collections.sort(teams);
            int current = 3;
            Team berland = teams.get(3);
            Team other = teams.get(3);
            String s_other;
            for (int i = 0; i < 3; ++i) {
                if (teams.get(i).name.equals("BERLAND")) {
                    current = i;
                    berland = teams.get(i);
                } else if (teams.get(i).played == 2) {
                    other = teams.get(i);
                }
            }

            s_other = other.name;

            if (berland.point + 3 < teams.get(1).point) {
                out.println("IMPOSSIBLE");
                return;
            }

            for (int diff = 1; diff <= 20; ++diff) {
                for (int goals = diff; goals <= 20; ++goals) {
                    int mis = goals - diff;
                    berland.update(goals, mis);
                    other.update(mis, goals);
                    Collections.sort(teams);
                    for (int i = 0; i < 2; ++i) {
                        if (teams.get(i).name.equals("BERLAND")) {
                            out.println(goals + ":" + mis);
                            return;
                        }

                    }
                    berland.backup();
                    other.backup();
                }
            }

            out.println("IMPOSSIBLE");

        }

        class Team implements Comparable<Team> {
            public String name;
            public int played;
            public int point;
            public int goals;
            public int missed;
            public int t_point;
            public int t_goals;
            public int t_missed;

            public void backup() {
                goals -= t_goals;
                missed -= t_missed;
                point -= t_point;
            }

            public String toString() {
                return (name + "   " + point + "   " + goals + "   " + missed);
            }

            public void update(int goals, int missed) {
                if (goals > missed) {
                    point += 3;
                    t_point = 3;
                } else if (goals == missed) {
                    point += 1;
                    t_point = 1;
                } else {
                    t_point = 0;
                }
                this.goals += goals;
                this.missed += missed;
                t_goals = goals;
                t_missed = missed;
                ++played;

            }

            public Team(String name, int goals, int missed) {
                this.name = name;
                update(goals, missed);
            }

            public Team() {

            }

            public int hashCode() {
                return name.hashCode();
            }

            public boolean equals(Object obj) {
                return name.equals(obj);
            }

            public int compareTo(Team o) {
                int temp = o.point - point;
                if (temp != 0) {
                    return temp;
                }
                temp = (o.goals - o.missed) - (goals - missed);
                if (temp != 0) {
                    return temp;
                }
                temp = (o.goals - goals);
                if (temp != 0) {
                    return temp;
                }

                return name.compareTo(o.name);

            }

        }

    }

}

import java.io.PrintWriter;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: vaibhav mittal
 * Date: 24/6/12
 * Time: 9:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int MAX_TEAMS = 4;
        final int LINES = 5;

        String[] data = new String[LINES];
        for (int i = 0; i < data.length; ++i)
            data[i] = in.nextLine();

        HashSet<String> teamNames = new HashSet<String>();
        for (int i = 0; i < data.length; ++i) {
            String[] tokens = data[i].split(" ");
            teamNames.add(tokens[0]);
            teamNames.add(tokens[1]);
        }

        Team[] teams = new Team[MAX_TEAMS];
        int idx = 0;
        for (String name : teamNames)
            teams[idx++] = new Team(name);

        for (int i = 0; i < data.length; ++i) {
            String[] tokens1 = data[i].split(" ");
            int idx1 = getIndex(tokens1[0], teams);
            int idx2 = getIndex(tokens1[1], teams);
            String[] tokens2 = tokens1[2].split(":");
            int x = Integer.parseInt(tokens2[0]);
            int y = Integer.parseInt(tokens2[1]);

            if (x > y) {
                teams[idx1].points += 3;
                teams[idx2].points += 0;
            }
            else if (x < y) {
                teams[idx1].points += 0;
                teams[idx2].points += 3;
            }
            else {
                teams[idx1].points += 1;
                teams[idx2].points += 1;
            }

            teams[idx1].scoredGoals += x;
            teams[idx1].missedGoals += y;
            teams[idx1].matches += 1;

            teams[idx2].scoredGoals += y;
            teams[idx2].missedGoals += x;
            teams[idx2].matches += 1;
        }

        String firstTeamName = "BERLAND";
        String otherTeamName = "";
        for (int i = 0; i < teams.length; ++i)
            if (teams[i].matches == 2 && teams[i].name.compareTo(firstTeamName) != 0)
                otherTeamName = teams[i].name;

        teams[getIndex(firstTeamName, teams)].points += 3;
        teams[getIndex(otherTeamName, teams)].points += 0;

        Arrays.sort(teams);

        int bestX = -1, bestY = -1;
        boolean done = false;
        for (int y = 0; y <= 100; ++y) {
            for (int x = y + 1; x <= 100; ++x) {
                teams[getIndex(firstTeamName, teams)].scoredGoals += x;
                teams[getIndex(firstTeamName, teams)].missedGoals += y;
                teams[getIndex(otherTeamName, teams)].scoredGoals += y;
                teams[getIndex(otherTeamName, teams)].missedGoals += x;

                Arrays.sort(teams);
                if (getIndex(firstTeamName, teams) <= 1) {
                    if (bestX == -1 || bestY == -1) {
                        bestX = x;
                        bestY = y;
                    }
                    else if ((x - y < bestX - bestY) || (x - y == bestX - bestY && y < bestY)) {
                        bestX = x;
                        bestY = y;
                    }
                    done = true;
                }

                teams[getIndex(firstTeamName, teams)].scoredGoals -= x;
                teams[getIndex(firstTeamName, teams)].missedGoals -= y;
                teams[getIndex(otherTeamName, teams)].scoredGoals -= y;
                teams[getIndex(otherTeamName, teams)].missedGoals -= x;
            }
        }
        if (!done) out.println("IMPOSSIBLE");
        else out.println(bestX + ":" + bestY);

        in.close();
        out.close();
    }

    public static int getIndex(String name, Team[] teams) {
        for (int idx = 0; idx < teams.length; ++idx)
            if (name.compareTo(teams[idx].name) == 0)
                return idx;
        return -1;
    }

    public static class Team implements Comparable<Team> {
        String name;
        int points;
        int scoredGoals;
        int missedGoals;
        int matches;

        public Team(String teamName) {
            this.name = teamName;
            this.points = 0;
            this.scoredGoals = 0;
            this.missedGoals = 0;
            this.matches = 0;
        }

        public int compareTo(Team team) {
            if (points != team.points) return team.points - points;
            if (scoredGoals - missedGoals != team.scoredGoals - team.missedGoals) return (team.scoredGoals - team.missedGoals) - (scoredGoals - missedGoals);
            if (scoredGoals != team.scoredGoals) return team.scoredGoals - scoredGoals;
            return name.compareTo(team.name);
        }

        public String toString() {
            return name + " " + points + " " + (scoredGoals - missedGoals) + " " + scoredGoals + " "  + missedGoals + " " + matches;
        }
    }
}

// practice with rainboy
import java.io.*;
import java.util.*;

public class CF200C extends PrintWriter {
	CF200C() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF200C o = new CF200C(); o.main(); o.flush();
	}

	String[] ss = new String[4];
	int n;
	int get(String s) {
		for (int i = 0; i < n; i++)
			if (ss[i].equals(s))
				return i;
		ss[n] = s;
		return n++;
	}
	void main() {
		int[] g1 = new int[4];
		int[] g0 = new int[4];
		int[] pp = new int[4];
		int[] dd = new int[4];
		for (int h = 0; h < 5; h++) {
			String s = sc.next();
			String t = sc.next();
			int i = get(s);
			int j = get(t);
			String z = sc.next();
			int x = z.charAt(0) - '0';
			int y = z.charAt(2) - '0';
			g1[i] += x; g0[j] += x;
			g0[i] += y; g1[j] += y;
			if (x > y)
				pp[i] += 3;
			else if (x < y)
				pp[j] += 3;
			else {
				pp[i]++;
				pp[j]++;
			}
			dd[i]++;
			dd[j]++;
		}
		int i = 0;
		while (!ss[i].equals("BERLAND"))
			i++;
		int j = 0;
		while (j == i || dd[j] != 2)
			j++;
		Integer[] ii = { 0, 1, 2, 3 };
		int x_ = 30, y_ = 0;
		for (int x = 1; x < 30; x++)
			for (int y = 0; y < x; y++) {
				g1[i] += x; g0[j] += x;
				g0[i] += y; g1[j] += y;
				if (x > y)
					pp[i] += 3;
				else if (x < y)
					pp[j] += 3;
				else {
					pp[i]++;
					pp[j]++;
				}
				Arrays.sort(ii, (i_, j_) -> {
					if (pp[i_] != pp[j_])
						return pp[j_] - pp[i_];
					int gi = g1[i_] - g0[i_];
					int gj = g1[j_] - g0[j_];
					if (gi != gj)
						return gj - gi;
					if (g1[i_] != g1[j_])
						return g1[j_] - g1[i_];
					return ss[i_].compareTo(ss[j_]);
				});
				int r = 0;
				while ((int) ii[r] != i)
					r++;
				if (r < 2) {
					if (x_ - y_ > x - y || x_ - y_ == x - y && y_ > y) {
						x_ = x;
						y_ = y;
					}
				}
				g1[i] -= x; g0[j] -= x;
				g0[i] -= y; g1[j] -= y;
				if (x > y)
					pp[i] -= 3;
				else if (x < y)
					pp[j] -= 3;
				else {
					pp[i]--;
					pp[j]--;
				}
			}
		if (x_ < 30)
			println(x_ + ":" + y_);
		else
			println("IMPOSSIBLE");
	}
}

import java.io.*;
import java.util.*;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class Code implements Runnable {

    public static void main(String[] args) throws IOException {
        new Thread(new Code()).start();
    }

    private void solve() throws IOException {
        Map relation = new HashMap<String, Integer>();
        Team[] teams = new Team[4];
        int k = 0;
        for(int i = 0; i < 5; ++i) {
            String target1 = nextToken(), target2 = nextToken();
            StringTokenizer tokenizer = new StringTokenizer(nextToken(), ":");
            int goals1 = Integer.parseInt(tokenizer.nextToken()), goals2 = Integer.parseInt(tokenizer.nextToken()), id = 0;
            if(relation.containsKey(target1)) {
                id = (Integer)relation.get(target1);
                teams[id].score += goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals1 - goals2;
                teams[id].goals += goals1;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target1, id);
                teams[id] = new Team(target1, goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals1 - goals2, goals1);
            }

            if(relation.containsKey(target2)) {
                id = (Integer)relation.get(target2);
                teams[id].score += goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals2 - goals1;
                teams[id].goals += goals2;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target2, id);
                teams[id] = new Team(target2, goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals2 - goals1, goals2);
            }
        }

        //for(Team team : teams)  writer.println(team.name + " " + team.score + " " + team.difference + " " + team.goals + " " + team.matches);

        int a = Integer.MAX_VALUE, b = 0;
        for(int i = 1; i <= 100; ++i) {
            for(int j = 0; j < i; ++j) {
                Arrays.sort(teams);
                Pair gamers = getGamers(teams);

                teams[gamers.first].score += i > j ? 3 : i == j ? 1 : 0;
                teams[gamers.first].difference += i - j;
                teams[gamers.first].goals += i;
                teams[gamers.second].score += i < j ? 3 : i == j ? 1 : 0;
                teams[gamers.second].difference += j - i;
                teams[gamers.second].goals += j;

                Arrays.sort(teams);
                gamers = getGamers(teams);
                if(gamers.first < 2) {
                    if(a - b > i - j || a - b == i - j && b > j) {
                        a = i;
                        b = j;
                    }
                }

                teams[gamers.first].score -= i > j ? 3 : i == j ? 1 : 0;
                teams[gamers.first].difference -= i - j;
                teams[gamers.first].goals -= i;
                teams[gamers.second].score -= i < j ? 3 : i == j ? 1 : 0;
                teams[gamers.second].difference -= j - i;
                teams[gamers.second].goals -= j;
            }
        }
        writer.println(a == Integer.MAX_VALUE ? "IMPOSSIBLE" : a + ":" + b);
    }

    private Pair getGamers(Team[] teams) {
        Pair res = new Pair(0, 0);
        for(int i = 0; i < 4; ++i) {
            if(teams[i].matches == 2)
                if(teams[i].name.equals("BERLAND")) res.first = i;
                else    res.second = i;
        }
        return res;
    }

    private class Team implements Comparable {
        private String name;
        private int score, difference, goals, matches;

        public Team(String name, int score, int difference, int goals) {
            this.name = name;
            this.score = score;
            this.goals = goals;
            this.difference = difference;
            this.matches = 1;
        }

        public Team(String name) {
            this.name = name;
        }

        @Override
        public int compareTo(Object other) {
            Team what = (Team)other;
            if(score != what.score) return what.score - score;
            if(difference != what.difference)   return what.difference - difference;
            if(goals != what.goals) return what.goals - goals;
            return name.compareTo(what.name);
        }

        @Override
        public boolean equals(Object other) {
            return name.equals(((Team)other).name);
        }
    }

    private class Pair {
        public Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object obj) {
            Pair other = (Pair)obj;
            return first == other.first && second == other.second;
        }

        public int first, second;
    }

    @Override
    public void run() {
        try {
            if(in.equals(""))   reader = new BufferedReader(new InputStreamReader(System.in));
            else    reader = new BufferedReader(new FileReader(in));

            if(out.equals(""))  writer = new PrintWriter(new OutputStreamWriter(System.out));
            else    writer = new PrintWriter(new FileWriter(out));
            solve();
        } catch(IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
                writer.close();
            } catch(IOException e) {
                e.printStackTrace();
            }
        }
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while(st == null || !st.hasMoreTokens())    st = new StringTokenizer(reader.readLine());
        return st.nextToken();
    }

    private String in = "", out = "";
    private BufferedReader reader;
    private PrintWriter writer;
    private StringTokenizer st;
}

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class CFRound126_Div1_C implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	public static void main(String[] args) {
		new Thread(null, new CFRound126_Div1_C(), "", 256 * (1L << 20)).start();
	}

	@Override
	public void run() {
		try {
			long startTime = System.currentTimeMillis();
			if (ONLINE_JUDGE) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			}
			Locale.setDefault(Locale.US);
			tok = new StringTokenizer("");
			solve();
			in.close();
			out.close();
			long freeMemory = Runtime.getRuntime().freeMemory();
			long totalMemory = Runtime.getRuntime().totalMemory();
			long endTime = System.currentTimeMillis();
			System.err.println("Time = " + (endTime - startTime));
			System.err.println("Memory = " + ((totalMemory - freeMemory) >> 10));
		} catch (Throwable t) {
			t.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken(" :");
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	void debug(Object... o) {
		if (!ONLINE_JUDGE) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	/** http://pastebin.com/j0xdUjDn */
	static class Utils {

		private Utils() {}

		public static void mergeSort(int[] a) {
			mergeSort(a, 0, a.length - 1);
		}

		private static final int MAGIC_VALUE = 50;

		private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
			if (leftIndex < rightIndex) {
				if (rightIndex - leftIndex <= MAGIC_VALUE) {
					insertionSort(a, leftIndex, rightIndex);
				} else {
					int middleIndex = (leftIndex + rightIndex) / 2;
					mergeSort(a, leftIndex, middleIndex);
					mergeSort(a, middleIndex + 1, rightIndex);
					merge(a, leftIndex, middleIndex, rightIndex);
				}
			}
		}

		private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
			int length1 = middleIndex - leftIndex + 1;
			int length2 = rightIndex - middleIndex;
			int[] leftArray = new int[length1];
			int[] rightArray = new int[length2];
			System.arraycopy(a, leftIndex, leftArray, 0, length1);
			System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
			for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
				if (i == length1) {
					a[k] = rightArray[j++];
				} else if (j == length2) {
					a[k] = leftArray[i++];
				} else {
					a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
				}
			}
		}

		private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
			for (int i = leftIndex + 1; i <= rightIndex; i++) {
				int current = a[i];
				int j = i - 1;
				while (j >= leftIndex && a[j] > current) {
					a[j + 1] = a[j];
					j--;
				}
				a[j + 1] = current;
			}
		}

	}

	// solution

	void inc(Map<String, Integer> map, String s, int x) {
		if (!map.containsKey(s)) map.put(s, 0);
		map.put(s, map.get(s) + x);
	}

	void solve() throws IOException {
		Map<String, Integer> scores = new TreeMap<String, Integer>();
		Map<String, Integer> plus = new TreeMap<String, Integer>();
		Map<String, Integer> minus = new TreeMap<String, Integer>();
		Map<String, Integer> matches = new TreeMap<String, Integer>();
		for (int i = 0; i < 5; i++) {
			String s = readString();
			String t = readString();
			inc(matches, s, 1);
			inc(matches, t, 1);
			int a = readInt();
			int b = readInt();
			inc(plus, s, a);
			inc(minus, s, b);
			inc(plus, t, b);
			inc(minus, t, a);
			if (a == b) {
				inc(scores, s, 1);
				inc(scores, t, 1);
			} else if (a > b) {
				inc(scores, s, 3);
				inc(scores, t, 0);
			} else {
				inc(scores, s, 0);
				inc(scores, t, 3);
			}
		}
		String opponent = null;
		for (String s : matches.keySet()) {
			if (!s.equals("BERLAND") && matches.get(s) == 2) {
				opponent = s;
			}
		}
		int bestX = -1, bestY = -1;
		for (int x = 1; x <= 100; x++) {
			for (int y = 0; y < x; y++) {
				Map<String, Integer> oldScores = new HashMap<String, Integer>(scores);
				Map<String, Integer> oldPlus = new HashMap<String, Integer>(plus);
				Map<String, Integer> oldMinus = new HashMap<String, Integer>(minus);
				inc(scores, "BERLAND", 3);
				inc(scores, opponent, 0);
				inc(plus, "BERLAND", x);
				inc(minus, "BERLAND", y);
				inc(plus, opponent, y);
				inc(minus, opponent, x);
				if (good(scores, plus, minus)) {
					if (bestX == -1 || x - y < bestX - bestY || x - y == bestX - bestY && y < bestY) {
						bestX = x;
						bestY = y;
					}
				}
				scores = oldScores;
				plus = oldPlus;
				minus = oldMinus;
			}
		}
		if (bestX == -1) {
			out.println("IMPOSSIBLE");
		} else {
			out.printf("%d:%d\n", bestX, bestY);
		}
	}

	private boolean good(final Map<String, Integer> scores, final Map<String, Integer> plus, final Map<String, Integer> minus) {
		String[] teams = scores.keySet().toArray(new String[]{});
		Arrays.sort(teams, new Comparator<String>() {

			@Override
			public int compare(String s, String t) {
				if (scores.get(s) > scores.get(t)) return -1;
				if (scores.get(s) < scores.get(t)) return 1;
				int ds = plus.get(s) - minus.get(s);
				int dt = plus.get(t) - minus.get(t);
				if (ds > dt) return -1;
				if (ds < dt) return 1;
				if (plus.get(s) > plus.get(t)) return -1;
				if (plus.get(s) < plus.get(t)) return 1;
				return s.compareTo(t);
			}
		});
		if (teams[0].equals("BERLAND") || teams[1].equals("BERLAND")) {
			return true;
		}
		return false;
	}

}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		HashMap<String, Integer> diff = new HashMap();
		HashMap<String, Integer> nom = new HashMap();
		for (int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if (val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			} else if (val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			} else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			diff.put(str1, diff.getOrDefault(str1, 0) + val1 - val2);
			diff.put(str2, diff.getOrDefault(str2, 0) + val2 - val1);
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
			nom.put(str1, nom.getOrDefault(str1, 0) + 1);
			nom.put(str2, nom.getOrDefault(str2, 0) + 1);
		}

		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for (String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st, goals.get(st), diff.get(st));
		}
		Arrays.sort(arr);

		idx = 0;
		String str1 = "BERLAND";
		for (int x = 0; x < 4; x++) {
			if ((arr[x].key).equals(str1)) {
				req = idx;
			}
			idx++;
		}
		if(req < 2) {
			System.out.println("1:0");
			return;
		}
		else if(arr[1].val - arr[req].val > 3) {
			System.out.println("IMPOSSIBLE");
			return;
		}
		String str2 = "";
		int idx2 = 0;
		for(String str : nom.keySet()) {
			if(nom.get(str) == 2 && !str.equals(str1)) {
				str2 = str;
				break;
			}

		}
		for(int x = 0; x < 4; x++) {
			if(arr[x].key.equals(str2)) {
				idx2 = x;
				break;
			}
		}
		String ans = "";
		int dif = 29;
		for(int x = 1; x < 29; x++) {
			for(int y = 0; y < x; y++) {
				arr[req].dif += x - y;
				arr[req].val += 3;
				arr[req].goals += x;
				arr[idx2].dif += y - x;
				arr[idx2].goals += y;
				pair[] arr1 = arr.clone();
				Arrays.sort(arr1);
				arr[req].dif -= (x - y);
				arr[req].val -= 3;
				arr[req].goals -= (x);
				arr[idx2].dif -= (y - x);
				arr[idx2].goals -= (y);
				if(x - y < dif && (arr1[1].key.equals(str1) || arr1[0].key.equals(str1))) {
					dif = x - y;
					ans = x+":"+y;
				}

			}
		}
		System.out.println(ans);
	}

	static class pair implements Comparable<pair> {
		int val;
		int goals;
		int dif;
		String key;

		pair(int val, String key, int points, int dif) {
			this.val = val;
			this.key = key;
			this.goals = points;
			this.dif = dif;
		}

		public int compareTo(pair obj) {
			if (obj.val == val) {
				if (obj.dif == dif) {
					if(obj.goals == goals) {
						return key.compareTo(obj.key);
					}
					return obj.goals - goals;
				} else
					return obj.dif - dif;
			}
			return obj.val - this.val;
		}
	}
}

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    static class Record implements Comparable<Record>{

        public int our, opp, pts;
        public String name;

        public Record(int our,int opp, int pts, String name) {
            this.our = our;
            this.opp = opp;
            this.pts = pts;
            this.name = name;
        }

        public int compareTo(Record o) {
            if (pts-o.pts!=0) return pts-o.pts;
            if (our-opp!=o.our-o.opp) return (our-opp)-(o.our-o.opp);
            if (our!=o.our) return (our-o.our);
            return o.name.compareTo(name);
        }

    }

    static class Score {

        public int our,opp, pts, gms;

        public Score() {
            our = 0;
            opp = 0;
            pts = 0;
            gms=0;
        }

        public void add(int ourGoals, int oppGoals){
            our += ourGoals;
            opp += oppGoals;
            gms++;
            if (ourGoals>oppGoals) {
                pts+=3;
            } else if (ourGoals==oppGoals) {
                pts+=1;
            }
        }

    }

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        Map<String, Score> t = new HashMap<String,Score>();

        for (int i=0; i<5; i++) {
            String[] cur = in.nextLine().split("[ |:]");
            int fg = Integer.parseInt(cur[2]), sg = Integer.parseInt(cur[3]);
            if (!t.containsKey(cur[0])) {
                t.put(cur[0], new Score());
            }
            if (!t.containsKey(cur[1])) {
                t.put(cur[1], new Score());
            }
            t.get(cur[0]).add(fg, sg);
            t.get(cur[1]).add(sg, fg);
        }

        List<Record> teams = new ArrayList<Record>();
        String secondTeam = "";
        for (String key : t.keySet()) {
            System.err.println(key);
            Score curScore = t.get(key);
            if (curScore.gms==2) {
                if (key.equals("BERLAND")) {
                    curScore.gms++;
                    curScore.pts+=3;
                } else {
                    secondTeam = key;
                }
            }
            teams.add(new Record(curScore.our,curScore.opp,curScore.pts,key));
            System.err.printf("our:%d opp:%d gms:%d pts:%d",curScore.our,curScore.opp,curScore.gms,curScore.pts);
            System.err.println();
        }

        for (int i=0; i<teams.size(); i++) {
            System.err.println((i+1)+teams.get(i).name);
        }

        boolean find = false;
        int left = 10000000, right = -10000;
        for (int i=1; i<50; i++) {
            for (int j=0; j<i; j++) {

                teams = new ArrayList<Record>();
                t.get("BERLAND").our += i;
                t.get("BERLAND").opp += j;
                t.get(secondTeam).our += j;
                t.get(secondTeam).opp += i;

                for (String key : t.keySet()) {
                    Score curScore = t.get(key);
                    teams.add(new Record(curScore.our,curScore.opp,curScore.pts,key));
                }
                Collections.sort(teams);
                if (teams.get(2).name.equals("BERLAND") || teams.get(3).name.equals("BERLAND")) {
                    find = true;
                    if (i-j<left-right) {
                        left = i;
                        right = j;
                    }
                }

                t.get("BERLAND").our -= i;
                t.get("BERLAND").opp -= j;
                t.get(secondTeam).our -= j;
                t.get(secondTeam).opp -= i;
            }
        }
        if (find) {
            out.printf("%d:%d",left,right);
            out.println();
        } else {
            out.println("IMPOSSIBLE");
        }
        in.close();
        out.close();

    }

}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.stream.Collectors;

public class FootballChampionship implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    private class Team implements Comparable<Team> {
        private String name;

        private int scored;
        private int conceded;
        private int points;

        private int games;

        private Team(String name) {
            this.name = name;
        }

        private Team(String name, int scored, int conceded, int points, int games) {
            this.name = name;
            this.points = points;
            this.scored = scored;
            this.conceded = conceded;
        }

        @Override
        public int compareTo(Team o) {
            int points = -Integer.compare(this.points, o.points);
            if (points != 0) return points;

            int diff = -Integer.compare(getDiff(), o.getDiff());
            if (diff != 0) return diff;

            int scored = -Integer.compare(this.scored, o.scored);
            if (scored != 0) return scored;

            return this.name.compareTo(o.name);
        }

        private int getDiff() {
            return this.scored - this.conceded;
        }

        private Team copy() {
            return new Team(name, scored, conceded, points, games);
        }
    }

    private List<Team> table = new ArrayList<>();

    public void solve() {
        for (int i = 0; i < 5; i++) {
            String a = in.next(), b = in.next(), score = in.next();
            String[] split = score.split(":");
            Team x = findOrCreate(a);
            x.games++;
            x.scored += Integer.parseInt(split[0]);
            x.conceded += Integer.parseInt(split[1]);

            Team y = findOrCreate(b);
            y.games++;
            y.scored += Integer.parseInt(split[1]);
            y.conceded += Integer.parseInt(split[0]);
            if (split[0].equals(split[1])) {
                x.points++;
                y.points++;
            } else if (Integer.parseInt(split[0]) < Integer.parseInt(split[1])) {
                y.points += 3;
            } else {
                x.points += 3;
            }
        }
        Collections.sort(table);
        if (isFirstOrSecond(table)) {
            out.println("1:0");
        } else {
            Team second = table.get(1);
            int berlandIdx = -1, otherIdx = -1;
            for (int i = 0; i < 4; i++) {
                Team team = table.get(i);
                if ("BERLAND".equals(team.name)) {
                    berlandIdx = i;
                } else if (team.games == 2) {
                    otherIdx = i;
                }
            }
            int diff = second.points - table.get(berlandIdx).points;
            if (diff < 3) {
                out.println("1:0");
            } else if (diff == 3) {
                int a = 60, b = -1;
                for (int score = 1; score <= 50; score++) {
                    for (int concede = 0; concede <= score - 1; concede++) {
                        List<Team> temp = new ArrayList<>();
                        for (int t = 0; t < 4; t++) {
                            temp.add(table.get(t).copy());
                        }
                        temp.get(berlandIdx).points += 3;
                        temp.get(berlandIdx).scored += score;
                        temp.get(berlandIdx).conceded += concede;
                        temp.get(otherIdx).scored += concede;
                        temp.get(otherIdx).conceded += score;
                        Collections.sort(temp);
                        if (isFirstOrSecond(temp)) {
                            if (a - b == score - concede) {
                                if (concede < b) {
                                    a = score;
                                    b = concede;
                                }
                            } else if (a - b > score - concede) {
                                a = score;
                                b = concede;
                            }
                        }
                    }
                }
                out.printf("%d:%d\n", a, b);
            } else {
                out.println("IMPOSSIBLE");
            }
        }
    }

    private Team findOrCreate(String name) {
        for (Team next : table) {
            if (next.name.equals(name)) return next;
        }
        Team result = new Team(name);
        table.add(result);
        return result;
    }

    private boolean isFirstOrSecond(List<Team> table) {
        return "BERLAND".equals(table.get(0).name) || "BERLAND".equals(table.get(1).name);
    }

    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (FootballChampionship instance = new FootballChampionship()) {
            instance.solve();
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {

    int get_c( Com[] c, String name ){
        for( int i = 0; i < 4; ++i ){
            if( c[i].name.equals(name) ){
                return i;
            }
        }
        return 0;
    }

    void solve() throws IOException {
        String s[] = new String[5];

        for( int i = 0; i < 5; ++i ){
            s[i] = nextLine();
        }

        int cur = 0;
        Com c[] = new Com[4];

        Map<String, Integer> pos = new HashMap<String, Integer>();
        Map<String, Integer> col = new HashMap<String, Integer>();

        for( int i = 0; i < 5; ++i ){
            String tmp[] = s[i].split( " " );
            if( !pos.containsKey(tmp[0]) ){
                pos.put( tmp[0], cur );
                col.put( tmp[0], 1 );
                c[cur] = new Com( tmp[0], 0, 0, 0 );
                cur++;
            } else {
                col.put( tmp[0], col.get(tmp[0])+1 );
            }
            if( !pos.containsKey(tmp[1]) ){
                pos.put( tmp[1], cur );
                col.put( tmp[1], 1 );
                c[cur] = new Com( tmp[1], 0, 0, 0 );
                cur++;
            } else {
                col.put( tmp[1], col.get(tmp[1])+1 );
            }
            int i1 = pos.get( tmp[0] );
            int i2 = pos.get( tmp[1] );
            String sc[] = tmp[2].split(":");
            int sc1 = Integer.valueOf( sc[0] );
            int sc2 = Integer.valueOf( sc[1] );
            c[i1].zab += sc1;
            c[i2].zab += sc2;
            c[i1].prop += sc2;
            c[i2].prop += sc1;
            if( sc1 == sc2 ){
                c[i1].p += 1;
                c[i2].p += 1;
            } else if( sc1 > sc2) {
                c[i1].p += 3;
            } else {
                c[i2].p += 3;
            }
        }

        String sec = "";
        for( String na : col.keySet() ){
            if( col.get(na) == 2 ){
                if( !na.equals("BERLAND") ){
                    sec = na;
                    break;
                }
            }
        }

        int todo = 500;
        int bX = 0;
        int bY = Integer.MAX_VALUE;
        int razn = Integer.MAX_VALUE-1000;
        boolean was = false;

        c[get_c(c, "BERLAND")].p += 3;

        Arrays.sort( c );

        for( int x = 1; x < todo; ++x ){
            for( int y = 0; y < x; ++y ){
                int b = get_c( c, "BERLAND" );
                int o = get_c( c, sec );
                c[b].zab += x;
                c[o].zab += y;
                c[b].prop += y;
                c[o].prop += x;
                Arrays.sort( c );
                if( c[2].name.equals("BERLAND") || c[3].name.equals("BERLAND") ){
                    int r = x-y;
                    if( razn > r ){
                        bX = x;
                        bY = y;
                        razn = r;
                        was = true;
                    } else if( razn == r ){
                        if( bY > y ){
                            bX = x;
                            bY = y;
                            razn = r;
                            was = true;
                        }
                    }
                }
                b = get_c( c, "BERLAND" );
                o = get_c( c, sec );
                c[b].zab -= x;
                c[o].zab -= y;
                c[b].prop -= y;
                c[o].prop -= x;
            }
        }

        if( !was ){
            out.println( "IMPOSSIBLE" );
        } else {
            out.println( bX + ":" + bY );
        }
    }

    private static final String INPUT_FILE = "inp.txt";

    public static void main(String[] args) throws IOException {
        if (new File(INPUT_FILE).exists())
            System.setIn(new FileInputStream(INPUT_FILE));
        new Main().solve();
        out.close();
    }

    private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    private static PrintWriter out = new PrintWriter(System.out);;
    private StringTokenizer st = new StringTokenizer("");

    String nextToken() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextLine() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

class Com implements Comparable<Com> {
    String name;
    int p;
    int zab;
    int prop;

    public Com(String name, int p, int zab, int prop) {
        this.name = name;
        this.p = p;
        this.zab = zab;
        this.prop = prop;
    }

    @Override
    public int compareTo(Com o) {
        if( p > o.p ){
            return 1;
        }
        if( p < o.p ){
            return -1;
        }
        if( zab-prop > o.zab-o.prop ){
            return 1;
        }
        if( zab-prop < o.zab-o.prop ){
            return -1;
        }
        if( zab > o.zab ){
            return 1;
        }
        if( zab < o.zab ){
            return -1;
        }
        return o.name.compareTo( name );
    }

}

import java.util.*;

public class Main {
	Scanner cin;
	String[] teamA, teamB, score;

	Boolean solve(int x, int y) {
		int cnt = 0;
		String[] teamName = new String[4];
		int[] winP = new int[4], db = new int[4], sg = new int[4];
		Arrays.fill(winP, 0);
		Arrays.fill(db, 0);
		Arrays.fill(sg, 0);

		Map<String, Integer> tn = new HashMap<String, Integer>();
		Map<String, Integer> counter = new HashMap<String, Integer>();

		for (int i = 0; i < 5; i++) {
			if (tn.containsKey(teamA[i]) == false) {
				teamName[cnt] = teamA[i];
				tn.put(teamA[i], cnt);
				cnt++;
			}
			if (tn.containsKey(teamB[i]) == false) {
				teamName[cnt] = teamB[i];
				tn.put(teamB[i], cnt);
				cnt++;
			}
		}
		for (int i = 0; i < 4; i++) {
			counter.put(teamName[i], 0);
		}

		for (int i = 0; i < 5; i++) {
			counter.put(teamA[i], counter.get(teamA[i]) + 1);
			counter.put(teamB[i], counter.get(teamB[i]) + 1);

			int X = Integer.parseInt(score[i].split(":")[0]);
			int Y = Integer.parseInt(score[i].split(":")[1]);
			if (X == Y) {
				winP[tn.get(teamA[i])] += 1;
				winP[tn.get(teamB[i])] += 1;
			} else if (X > Y) {
				winP[tn.get(teamA[i])] += 3;
				winP[tn.get(teamB[i])] += 0;
			} else {
				winP[tn.get(teamA[i])] += 0;
				winP[tn.get(teamB[i])] += 3;
			}
			db[tn.get(teamA[i])] += X - Y;
			db[tn.get(teamB[i])] -= X - Y;

			sg[tn.get(teamA[i])] += X;
			sg[tn.get(teamB[i])] += Y;
		}
		sg[tn.get("BERLAND")] += x;
		db[tn.get("BERLAND")] += x - y;
		winP[tn.get("BERLAND")] += 3;
		for (int i = 0; i < 4; i++) {
			if (teamName[i].equals("BERLAND"))
				continue;
			if (counter.get(teamName[i]) == 2) {
				db[i] += y - x;
				sg[i] += y;
			}
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				Boolean big = false;
				if (winP[j] != winP[j + 1]) {
					big = winP[j] < winP[j + 1];
				} else if (db[j] != db[j + 1]) {
					big = db[j] < db[j + 1];
				} else if (sg[j] != sg[j + 1]) {
					big = sg[j] < sg[j + 1];
				} else {
					big = teamName[j].compareTo(teamName[j + 1]) > 0;
				}
				if (big) {
					String tmp = teamName[j];
					teamName[j] = teamName[j + 1];
					teamName[j + 1] = tmp;
					int _tmp = winP[j];
					winP[j] = winP[j + 1];
					winP[j + 1] = _tmp;
					_tmp = db[j];
					db[j] = db[j + 1];
					db[j + 1] = _tmp;
					_tmp = sg[j];
					sg[j] = sg[j + 1];
					sg[j + 1] = _tmp;
				}
			}
		}

		for (int i = 0; i < 4; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
		}
		for (int i = 0; i < 2; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
			if (teamName[i].equals("BERLAND"))
				return true;
		}
		return false;
	}

	void run() {
		cin = new Scanner(System.in);
		teamA = new String[5];
		teamB = new String[5];
		score = new String[5];
		for (int i = 0; i < 5; i++) {
			teamA[i] = cin.next();
			teamB[i] = cin.next();
			score[i] = cin.next();
		}
		for (int x = 1; x <= 500; x++) {
			for (int y = 0; y <= 100; y++) {
				if (solve(x+y,y)) {
					System.out.printf("%d:%d", x+y,y);
					return;
				}
			}
		}

		System.out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

import java.io.*;
import java.util.*;

public class football {
  static BufferedReader cin;
  static StringTokenizer tk;
  public static String token () throws IOException {
    try {
      while (!tk.hasMoreTokens())
        tk = new StringTokenizer(cin.readLine(), " \t:\n");
      return tk.nextToken();
    }
    catch (Exception e) {
    }
    return null;
  }
  public static int gInt () throws IOException {
    return Integer.parseInt(token());
  }
  public static long gLong () throws IOException {
    return Long.parseLong(token());
  }
  public static double gDouble () throws IOException {
    return Double.parseDouble(token());
  }
  public static void init () {
    cin = new BufferedReader(new InputStreamReader(System.in));
    tk = new StringTokenizer("");
  }
  public static void quit () throws IOException {
    System.out.flush();
    System.exit(0);
  }
  public static void main (String [] args) throws IOException {
    init();
    int numTeams = 0;
    Team [] teams = new Team[4];
    for (int count = 0; count < 5; count ++) {
      String team1 = token(), team2 = token();
      int score1 = gInt(), score2 = gInt();
      boolean inleague1 = false, inleague2 = false;
      for (int count2 = 0; count2 < numTeams; count2 ++) {
        if (teams[count2].name.equals(team1)) {
          teams[count2].numGames ++;
          teams[count2].numGoals += score1;
          teams[count2].numOpp += score2;
          if (score1 > score2)
            teams[count2].numPoints += 3;
          else if (score1 == score2)
            teams[count2].numPoints ++;
          inleague1 = true;
          break;
        }
      }
      for (int count2 = 0; count2 < numTeams; count2 ++) {
        if (teams[count2].name.equals(team2)) {
          teams[count2].numGames ++;
          teams[count2].numGoals += score2;
          teams[count2].numOpp += score1;
          if (score2 > score1)
            teams[count2].numPoints += 3;
          else if (score1 == score2)
            teams[count2].numPoints ++;
          inleague2 = true;
          break;
        }
      }
      if (!inleague1) {
        teams[numTeams] = new Team(team1);
        teams[numTeams].numGames ++;
        teams[numTeams].numGoals += score1;
        teams[numTeams].numOpp += score2;
        if (score1 > score2)
          teams[numTeams].numPoints += 3;
        else if (score1 == score2)
          teams[numTeams].numPoints ++;
        numTeams ++;
      }
      if (!inleague2) {
        teams[numTeams] = new Team(team2);
        teams[numTeams].numGames ++;
        teams[numTeams].numGoals += score2;
        teams[numTeams].numOpp += score1;
        if (score2 > score1)
          teams[numTeams].numPoints += 3;
        else if (score1 == score2)
          teams[numTeams].numPoints ++;
        numTeams ++;
      }
    }
    //Arrays.sort(teams);
    //for (Team t : teams)
    //  System.err.printf("%s %d %d %d %d\n", t.name, t.numPoints, t.numGames, t.numGoals, t.numOpp);
    Team ber = null, other = null;
    for (Team t : teams) {
      if (t.name.equals("BERLAND"))
        ber = t;
      else if (t.numGames == 2)
        other = t;
    }
    int bests1 = 1000, bests2 = 0;
    for (int s1 = 0; s1 < 100; s1 ++) {
      for (int s2 = 0; s2 < s1; s2 ++) {
        ber.numPoints += 3;
        ber.numGoals += s1;
        ber.numOpp += s2;
        other.numGoals += s2;
        other.numOpp += s1;
        Arrays.sort(teams);
        if (teams[0].name.equals("BERLAND") || teams[1].name.equals("BERLAND")) {
          int diffbest = bests1 - bests2, diffcur = s1 - s2;
          if (diffcur < diffbest) {
            bests1 = s1;
            bests2 = s2;
          }
          else if (diffcur == diffbest && s2 < bests2) {
            bests1 = s1;
            bests2 = s2;
          }
        }
        ber.numPoints -= 3;
        ber.numGoals -= s1;
        ber.numOpp -= s2;
        other.numGoals -= s2;
        other.numOpp -= s1;
      }
    }
    if (bests1 == 1000)
      System.out.println("IMPOSSIBLE");
    else
      System.out.printf("%d:%d\n", bests1, bests2);
    quit();
  }
}

class Team implements Comparable <Team> {
  String name;
  int numPoints;
  int numGames;
  int numGoals;
  int numOpp;
  Team (String n) {
    name = n;
    numGames = numGoals = numOpp = 0;
  }
  public int compareTo (Team other) {
    if (numPoints > other.numPoints)
      return -1;
    if (numPoints < other.numPoints)
      return 1;
    int diff1 = numGoals - numOpp, diff2 = other.numGoals - other.numOpp;
    if (diff1 > diff2)
      return -1;
    if (diff1 < diff2)
      return 1;
    if (numGoals > other.numGoals)
      return -1;
    if (numGoals < other.numGoals)
      return 1;
    return name.compareTo(other.name);
  }
}

import java.io.*;
import java.util.*;

public class C implements Runnable {
    private MyScanner in;
    private PrintWriter out;

    Team[] teams;
    Map<String, Integer> byName;
    int curNum;

    void addTeam(String name) {
        if (!byName.containsKey(name)) {
            byName.put(name, curNum);
            teams[curNum++] = new Team(name);
        }
    }

    void addScore(Team a, Team b, int asc, int bsc) {
        a.addResult(asc, bsc);
        b.addResult(bsc, asc);
    }

    private void solve() {
        teams = new Team[4];
        byName = new HashMap<String, Integer>();
        curNum = 0;
        for (int i = 0; i < 5; ++i) {
            String a = in.next();
            String b = in.next();
            String sc = in.next();
            int asc = sc.charAt(0) - '0', bsc = sc.charAt(2) - '0';
            addTeam(a);
            addTeam(b);
            addScore(teams[byName.get(a)], teams[byName.get(b)], asc, bsc);
        }
        final String NAME = "BERLAND";
        Team our = teams[byName.get(NAME)];
        Team other = null;
        for (Team t : teams) {
            if (t != our && t.played == 2) {
                other = t;
                break;
            }
        }
        for (int d = 1; d < 50; ++d) {
            for (int miss = 0; miss < 50; ++miss) {
                int asc = miss + d, bsc = miss;
                our.addResult(asc, bsc);
                other.addResult(bsc, asc);
                Arrays.sort(teams);
                for (int i = 0; i < 2; ++i) {
                    if (teams[i] == our) {
                        out.println(asc + ":" + bsc);
                        return;
                    }
                }
                our.rollBackResult(asc, bsc);
                other.rollBackResult(bsc, asc);
            }
        }
        out.println("IMPOSSIBLE");
    }

    @Override
    public void run() {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    public static void main(String[] args) {
        new C().run();
    }

    class Team implements Comparable<Team> {
        public String name;
        public int scored, missed, points, played;

        public Team(String name) {
            this.name = name;
            this.scored = this.missed = this.points = this.played = 0;
        }

        public void addResult(int scored, int missed) {
            this.played++;
            this.scored += scored;
            this.missed += missed;
            if (scored > missed) {
                points += 3;
            } else if (scored == missed) {
                points++;
            }
        }

        public void rollBackResult(int scored, int missed) {
            this.played--;
            this.scored -= scored;
            this.missed -= missed;
            if (scored > missed) {
                points -= 3;
            } else if (scored == missed) {
                points--;
            }
        }

        @Override
        public int compareTo(Team o) {
            if (points != o.points) {
                return o.points - points;
            }
            if (scored - missed != o.scored - o.missed) {
                return (o.scored - o.missed) - (scored - missed);
            }
            if (scored != o.scored) {
                return o.scored - scored;
            }
            return name.compareTo(o.name);
        }
    }

    class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public boolean hasNext() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String s = br.readLine();
                    if (s == null) {
                        return false;
                    }
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    return false;
                }
            }
            return st != null && st.hasMoreTokens();
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String s = br.readLine();
                    if (s == null) {
                        return null;
                    }
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            try {
                st = null;
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.io.*;
import java.util.*;

public class Solution {

	public static List<Team> listTeams=Collections.synchronizedList(new ArrayList<Team>(4));
	public static Team BERLAND=null;
	public static TeamComparator teamComparator=null;

	public class Team{
		public String name;
		public Map<String,Integer> selfScores=Collections.synchronizedMap(new HashMap<String,Integer>());
		public Map<String,Integer> oppScores=Collections.synchronizedMap(new HashMap<String,Integer>());

		public Integer points=0;
		public Integer goalDiff=0;
		public Integer goalFor=0;

		public Team(String name){
			this.name=name;
		}
	}
	public Team newTeam(String name){
		return new Team(name);
	}

	public static Team getTeam(String name){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			if(team.name.equals(name))
				return team;
		}
		return null;
	}

	public static int getBerlandRanking(){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			team.points=team.goalDiff=team.goalFor=0;
			Iterator<String> iterOpp=team.selfScores.keySet().iterator();
			while(iterOpp.hasNext()){
				String oppName=iterOpp.next();
				int selfScore=team.selfScores.get(oppName);
				int oppScore=team.oppScores.get(oppName);
				team.points+=(selfScore>oppScore)?3:(selfScore==oppScore)?1:0;
				team.goalDiff+=(selfScore-oppScore);
				team.goalFor+=selfScore;
				}}
		Collections.sort(listTeams,teamComparator);
		return listTeams.indexOf(BERLAND);
	}

	public class TeamComparator implements Comparator<Team>{

		@Override
		public int compare(Team team1, Team team2) {
			if(team1.points.equals(team2.points)){
				if(team1.goalDiff.equals(team2.goalDiff)){
					if(team1.goalFor.equals(team2.goalFor))
						return team2.name.compareTo(team1.name);
					return team1.goalFor.compareTo(team2.goalFor);
				}
				return team1.goalDiff.compareTo(team2.goalDiff);
			}
			return team1.points.compareTo(team2.points);
		}}
	public TeamComparator newTeamComparator(){
		return new TeamComparator(); }

	/**
	 * @param args
	 */
	public static void main(String[] args){
	    try {

	    	BufferedReader reader =new BufferedReader( new InputStreamReader( System.in)); // STDIN

	    	// Teams
	    	Solution solution=new Solution();
	    	listTeams.add(solution.newTeam("BERLAND"));
	    	BERLAND=getTeam("BERLAND");
	    	teamComparator=solution.newTeamComparator();

	    	//
	    	for(int i=0;i!=5;i++){
	    		String[] result=reader.readLine().trim().split(" ",3);
	    		// Team1
	    		String name1=result[0].trim();
	    		Team team1=getTeam(name1);
	    		if(team1==null){
	    			listTeams.add(solution.newTeam(name1));
	    			team1=getTeam(name1);
	    		}
	    		// Team2
	    		String name2=result[1].trim();
	    		Team team2=getTeam(name2);
	    		if(team2==null){
	    			listTeams.add(solution.newTeam(name2));
	    			team2=getTeam(name2);
	    		}
	    		String[] score=result[2].trim().split(":",2);
	    		Integer score1=Integer.valueOf(score[0].trim());
	    		Integer score2=Integer.valueOf(score[1].trim());
	    		team1.selfScores.put(team2.name,score1);
	    		team1.oppScores.put(team2.name,score2);
	    		team2.selfScores.put(team1.name,score2);
	    		team2.oppScores.put(team1.name,score1);
	    	}

	    	String oppName="";
	    	Iterator<Team> iterTeam=listTeams.iterator();
	    	while(iterTeam.hasNext()&&(oppName=="")){
	    		Team team=iterTeam.next();
	    		if((team.oppScores.size()==2)&&(team.name!="BERLAND"))
	    			oppName=team.name; }

	    	//
	    	boolean bPossible=false;
	    	for(int diff=1;diff<=30;diff++){
	    		for(int opp=0;opp<=30;opp++){
	    			int selfScore=diff+opp;
	    			Team oppTeam=getTeam(oppName);
	    			oppTeam.selfScores.put(BERLAND.name,opp);
	    			oppTeam.oppScores.put(BERLAND.name,selfScore);
	    			BERLAND.selfScores.put(oppName,selfScore);
	    			BERLAND.oppScores.put(oppName,opp);
	    			if(getBerlandRanking()>=2){
	    				System.out.println(selfScore+":"+opp);
	    				bPossible=true;
	    				break;
	    			}
	    		}
	    		if(bPossible)
	    			break;
	    	}
	    	if(!bPossible)
	    		System.out.println("IMPOSSIBLE");

		    }catch(Exception e){
		    	e.printStackTrace(System.err);
		}
	}
}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else {aa=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1], bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb, p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; continue;}
	  if(!g.equals("BERLAND"))que.add(map.get(g));

	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	for(int i=0;i<4;i++)
	{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<50;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3, bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , opp.v ,opp.m+t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();
/*	dd(r);
	dd(rr);
	while(!que.isEmpty())dd(que.poll());
	db(i,t);
	*/
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		//
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m,p.mm);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? -1:1;
		   }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.TreeMap;

public class FootballChampionship {
    class Team implements Comparable<Team> {
        String name;
        int gamesPlayed, gs, gm, pts, diff;
        public Team(String name, int gamesPlayed, int gs, int gm, int pts, int diff) {
            this.name = name;
            this.gamesPlayed = gamesPlayed;
            this.gs = gs;
            this.gm = gm;
            this.pts = pts;
            this.diff = gs - gm;
        }
        @Override
        public int compareTo(Team o) {
            if(this.pts != o.pts)
                return -(this.pts-o.pts);
            if(this.diff != o.diff)
                return -(this.diff-o.diff);
            if(this.gs!=o.gs)
                return -(this.gs-o.gs);
            return this.name.compareTo(o.name);
        }

    }

    void run() {
        try {
            BufferedReader bfd = new BufferedReader(new InputStreamReader(
                    System.in));
            int i, lines=5;
            String[] sp, sp2;
            int arr[][] = new int[4][5]; // [teams][for each: gamesPlayed,scoared,missed,pts,diff]
            TreeMap<String, Integer> teams = new TreeMap<String, Integer>();
            int id = 0, gs, gm;
            while(lines-->0){
                sp = bfd.readLine().split(" +");
                sp2 = sp[2].split(":");
                gs = Integer.parseInt(sp2[0]);
                gm = Integer.parseInt(sp2[1]);
                if(teams.keySet().contains(sp[0])){
                    int ind = teams.get(sp[0]);
                    ++arr[ind][0];
                    arr[ind][1]+=gs;
                    arr[ind][2]+=gm;
                    if(gs>gm)
                        arr[ind][3]+=3;
                    else if(gs==gm)
                        arr[ind][3]+=1;
                } else {
                    teams.put(sp[0], id);
                    int ind = id;
                    ++arr[ind][0];
                    arr[ind][1]+=gs;
                    arr[ind][2]+=gm;
                    if(gs>gm)
                        arr[ind][3]+=3;
                    else if(gs==gm)
                        arr[ind][3]+=1;
                    ++id;
                }
                if(teams.keySet().contains(sp[1])){
                    int ind = teams.get(sp[1]);
                    ++arr[ind][0];
                    arr[ind][1]+=gm;
                    arr[ind][2]+=gs;
                    if(gm>gs)
                        arr[ind][3]+=3;
                    else if(gs==gm)
                        arr[ind][3]+=1;
                } else {
                    teams.put(sp[1], id);
                    int ind = id;
                    ++arr[ind][0];
                    arr[ind][1]+=gm;
                    arr[ind][2]+=gs;
                    if(gm>gs)
                        arr[ind][3]+=3;
                    else if(gs==gm)
                        arr[ind][3]+=1;
                    ++id;
                }
            }
            for(i=0; i<arr.length; ++i)
                arr[i][4] = arr[i][1]-arr[i][2];
            // start of soln
            int berId = teams.get("BERLAND");
            int oppId = -1;
            for(i=0; i<arr.length; ++i)
                if(i!= berId && arr[i][0]==2)
                    oppId = i;
            for(int diff = 1; diff<100; ++diff)
            for(int x=1; x<100; ++x){
                ArrayList<Team> list = new ArrayList<Team>();
                int y = x-diff;
                if(x>y && y>=0){
                for(i=0; i<arr.length; ++i){
                    Iterator itr = teams.keySet().iterator();
                    String s1="";
                    while(itr.hasNext()){
                        String ss = (String)itr.next();
                        int h = teams.get(ss);
                        if(h==i){
                            s1 = ss;
                            break;
                        }
                    }
                    if(teams.get(s1)==berId)
                        list.add(new Team(s1, arr[i][0], arr[i][1]+x, arr[i][2]+y, arr[i][3]+3, arr[i][4]));
                    else if(teams.get(s1)==oppId)
                        list.add(new Team(s1, arr[i][0], arr[i][1]+y, arr[i][2]+x, arr[i][3], arr[i][4]));
                    else
                        list.add(new Team(s1, arr[i][0], arr[i][1], arr[i][2], arr[i][3], arr[i][4]));
                }
                Collections.sort(list);
                if(list.get(0).name.equals("BERLAND") || list.get(1).name.equals("BERLAND")){
                    System.out.println(x+":"+y);
                    return;
                }
                }
            }
            System.out.println("IMPOSSIBLE");
        } catch (Exception e) {
        }
    }

    public static void main(String[] args) {
        new FootballChampionship().run();
    }

}

import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.Vector;

public class Main {

    public static class team{
        public String name;
        public int goals;
        public int left;
        public int points;
        public int games;
        public team(){
            goals=0;
            left=0;
            points=0;
            games=0;
            name="";
        }
        public team(team t1){
            goals=t1.goals;
            left=t1.left;
            points=t1.points;
            games=t1.games;
            name=t1.name;
        }
    }

    public static class pair{
        public int a;
        public int b;
        public pair(int a, int b){
            this.a=a;
            this.b=b;
        }
    }

    public static void main(String[] args) {
        Scanner in=new Scanner(new InputStreamReader(System.in));
        PrintWriter out=new PrintWriter(System.out);
        Hashtable<String,team> mas=new Hashtable<String,team>();
        for(int i=0; i<5; i++){
            String[] cur=in.nextLine().split(" ");
            String name1=cur[0];
            String name2=cur[1];
            String[] cur2=cur[2].split(":");
            int goal1=Integer.parseInt(cur2[0]);
            int goal2=Integer.parseInt(cur2[1]);
            team team1=mas.get(name1);
            if(team1==null)
                team1=new team();
            team team2=mas.get(name2);
            if(team2==null)
                team2=new team();
            team1.name=name1;
            team2.name=name2;
            team1.goals+=goal1;
            team1.left+=goal2;
            team2.goals+=goal2;
            team2.left+=goal1;
            team1.games++;
            team2.games++;
            if(goal1>goal2) team1.points+=3;
            else if(goal1<goal2) team2.points+=3;
            else {
                team1.points++;
                team2.points++;
            }
            mas.put(name1, team1);
            mas.put(name2,team2);
        }
        Enumeration<String> keys=mas.keys();
        Vector<team> vect=new Vector<Main.team>();
        String secTeam="";
        while(keys.hasMoreElements())
        {
            String name=keys.nextElement();
            if(mas.get(name).games==2 && name.compareTo("BERLAND")!=0) {
                secTeam=name;
            }
            vect.add(mas.get(name));
        }
        Collections.sort(vect,new Comparator<team>(){
            public int compare(team a, team b){
                if(a.points>b.points) return 1;
                else if(a.points<b.points) return -1;
                else{
                    if(a.goals-a.left>b.goals-b.left){
                        return 1;
                    }
                    else if(a.goals-a.left<b.goals-b.left){
                        return -1;
                    }
                    else{
                        if(a.goals>b.goals) return 1;
                        else if(a.goals<b.goals) return -1;
                        else{
                            return -a.name.compareTo(b.name);
                        }
                    }
                }
            }
        });
        PriorityQueue<pair> p=new PriorityQueue<Main.pair>(2500,new Comparator<pair>(){
            public int compare(pair a,pair b){
                if(a.a-a.b>b.a-b.b) return 1;
                else if(a.a-a.b<b.a-b.b) return -1;
                else if(a.a>b.a) return 1;
                else if(a.a<b.a) return -1;
                else return 0;
            }
        });
        for(int left1=0; left1<=50; left1++){
            for(int goal1=left1+1; goal1<=50; goal1++){

                int t1=-1;
                int t2=-1;
                for(int i=0; i<4; i++){
                    if(vect.get(i).name.compareTo(secTeam)==0) t1=i;
                }
                vect.remove(t1);
                team team1=new team(mas.get(secTeam));
                team1.goals+=left1;
                team1.left+=goal1;
                vect.add(team1);

                for(int i=0; i<4; i++){
                    if(vect.get(i).name.compareTo("BERLAND")==0) t2=i;
                }
                vect.remove(t2);
                team team2=new team(mas.get("BERLAND"));
                team2.left+=left1;
                team2.goals+=goal1;
                team2.points+=3;
                vect.add(team2);

                Collections.sort(vect,new Comparator<team>(){
                    public int compare(team a, team b){
                        if(a.points>b.points) return 1;
                        else if(a.points<b.points) return -1;
                        else{
                            if(a.goals-a.left>b.goals-b.left){
                                return 1;
                            }
                            else if(a.goals-a.left<b.goals-b.left){
                                return -1;
                            }
                            else{
                                if(a.goals>b.goals) return 1;
                                else if(a.goals<b.goals) return -1;
                                else{
                                    return -a.name.compareTo(b.name);
                                }
                            }
                        }
                    }
                });
                if(vect.get(2).name.compareTo("BERLAND")==0 || vect.get(3).name.compareTo("BERLAND")==0){
                    p.add(new pair(goal1,left1));
                }
            }
        }
        if(p.isEmpty()) out.println("IMPOSSIBLE");
        else out.print(p.peek().a+":"+p.peek().b);
        out.close();
    }

}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class C {

    class R implements Comparable<R>{
        String name;
        int score, win, lose;
        public R(String name) {
            this.name = name;
            score = win = lose = 0;
        }
        public int compareTo(R o) {
            if(score!=o.score)return o.score-score;
            if(win-lose!=o.win-o.lose)return (o.win-o.lose) - (win-lose);
            if(win!=o.win)return o.win-win;
            return name.compareTo(o.name);
        }
    }

    int ID = 0;
    Map<String, Integer> ref = new HashMap<String, Integer>();

    int reg(String s){
        if(ref.containsKey(s))return ref.get(s);
        ref.put(s, ID);
        return ID++;
    }

    void run(){
        Scanner sc = new Scanner(System.in);
        R[] teams = new R[4], temp = new R[4];
        int[] c = new int[4];
        for(int i=0;i<5;i++){
            String s = sc.next(), t = sc.next();
            int id1 = reg(s), id2 = reg(t);
            c[id1]++; c[id2]++;
            if(teams[id1]==null)teams[id1] = new R(s);
            if(teams[id2]==null)teams[id2] = new R(t);
            String[] p = sc.next().split(":");
            int p1 = Integer.parseInt(p[0]), p2 = Integer.parseInt(p[1]);
            R r1 = teams[id1], r2 = teams[id2];
            r1.win+=p1; r2.win+=p2;
            r1.lose+=p2; r2.lose+=p1;
            if(p1>p2)r1.score+=3;
            else if(p2>p1)r2.score+=3;
            else {
                r1.score++; r2.score++;
            }
        }
        int B = reg("BERLAND");
        int N = -1;
        for(int i=0;i<4;i++){
            if(i==B)continue;
            if(c[i]==2)N=i;
        }
        int X = -1, Y = -1;
        for(int p1=0;p1<=100;p1++)for(int p2=0;p2<p1;p2++){
            if(p1<=p2)continue;
            for(int i=0;i<4;i++){
                temp[i] = new R(teams[i].name);
                temp[i].score = teams[i].score;
                temp[i].win = teams[i].win;
                temp[i].lose = teams[i].lose;
            }
            temp[B].win+=p1; temp[B].lose+=p2;
            temp[N].win+=p2; temp[N].lose+=p1;
            if(p1>p2)temp[B].score+=3;
            else if(p2>p1)temp[N].score++;
            else{
                temp[B].score++; temp[N].score++;
            }
            Arrays.sort(temp);
            if(temp[0].name.equals("BERLAND")||temp[1].name.equals("BERLAND")){
                if(X==-1){
                    X = p1; Y = p2;
                    continue;
                }
                if(p1-p2<X-Y){
                    X = p1; Y = p2;
                }
                else if(p1-p2==X-Y && p2 < Y){
                    X = p1; Y = p2;
                }
            }
        }
        System.out.println(X==-1?"IMPOSSIBLE":(X+":"+Y));
    }

    void debug(Object...o){
        System.out.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) {
        new C().run();
    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class P200C {

    public static void main(String[] args) {
        Scanner inScanner = new Scanner(System.in);
        Map<String, Team> teams = new HashMap<String, Team>();
        for (int i = 0; i < 5; i++) {
            String team1 = inScanner.next();
            String team2 = inScanner.next();
            String score = inScanner.next();
            int goals1 = Integer.parseInt(score.split(":")[0]);
            int goals2 = Integer.parseInt(score.split(":")[1]);
            if (!teams.containsKey(team1)) {
                teams.put(team1, new Team(team1));
            }
            if (!teams.containsKey(team2)) {
                teams.put(team2, new Team(team2));
            }
            teams.get(team1).goalsFor += goals1;
            teams.get(team2).goalsFor += goals2;
            teams.get(team1).goalsAgainst += goals2;
            teams.get(team2).goalsAgainst += goals1;
            if (goals1 > goals2) {
                teams.get(team1).victories++;
            }
            else if (goals2 > goals1) {
                teams.get(team2).victories++;
            }
            else {
                teams.get(team1).draws++;
                teams.get(team2).draws++;
            }
            teams.get(team1).played++;
            teams.get(team2).played++;
        }
        Team berland = teams.get("BERLAND");
        berland.victories++;
        Team otherTeam = null;
        for (Team team : teams.values()) {
            if (team != berland && team.played == 2) {
                otherTeam = team;
            }
        }
        List<Team> ranked = new ArrayList<Team>();
        for (Team team : teams.values()) {
            ranked.add(team);
        }
        for (int diff = 1; diff < 100; diff++) {
            for (int low = 0; low < 100; low++) {
                berland.goalsFor += low + diff;
                berland.goalsAgainst += low;
                otherTeam.goalsFor += low;
                otherTeam.goalsAgainst += low + diff;
                Collections.sort(ranked);
                if (ranked.get(2) == berland || ranked.get(3) == berland) {
                    System.out.println((low + diff) + ":" + low);
                    return;
                }
                berland.goalsFor -= low + diff;
                berland.goalsAgainst -= low;
                otherTeam.goalsFor -= low;
                otherTeam.goalsAgainst -= low + diff;
            }
        }
        System.out.println("IMPOSSIBLE");
    }

    private static class Team implements Comparable<Team> {

        String name;
        int goalsFor;
        int goalsAgainst;
        int victories;
        int draws;
        int played;

        public Team(String name) {
            this.name = name;
            goalsAgainst = 0;
            goalsFor = 0;
            victories = 0;
            draws = 0;
            played = 0;
        }

        @Override
        public int compareTo(Team o) {
            if (victories * 3 + draws != o.victories * 3 + o.draws) {
                return victories * 3 + draws - (o.victories * 3 + o.draws);
            }
            if (goalsFor - goalsAgainst != o.goalsFor - o.goalsAgainst) {
                return goalsFor - goalsAgainst - (o.goalsFor - o.goalsAgainst);
            }
            if (goalsFor != o.goalsFor)
                return goalsFor - o.goalsFor;
            return o.name.compareTo(name);
        }
    }
}

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {
	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException	{
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		String[] data = new String[5];
		for(int i = 0; i < data.length; i++)	{
			data[i] = nextToken() + " " + nextToken() + " " + nextToken();
		}
		TreeSet<String> teamName = new TreeSet<String>();
		for(int i = 0; i < 5; i++)	{
			StringTokenizer su = new StringTokenizer(data[i]);
			teamName.add(su.nextToken());
			teamName.add(su.nextToken());
		}

		Team[] list = new Team[4];
		int c = 0;
		HashMap<String, Integer> fastAccess = new HashMap<String, Integer>();
		for(String out: teamName)	{
			fastAccess.put(out, c);
			list[c++] = new Team(out, 0, 0, 0);
		}
		HashMap<String, Integer> game = new HashMap<String, Integer>();
		for(String out: teamName)
			game.put(out, 0);
		for(int i = 0; i < 5; i++)	{
			StringTokenizer su = new StringTokenizer(data[i]);
			int first = fastAccess.get(su.nextToken());
			int second = fastAccess.get(su.nextToken());
			game.put(list[first].name, 1 + game.get(list[first].name));
			game.put(list[second].name, 1 + game.get(list[second].name));
			String score = su.nextToken();
			list[first].scored += score.charAt(0) - '0';
			list[first].lost += score.charAt(2) - '0';
			list[second].scored += score.charAt(2) - '0';
			list[second].lost += score.charAt(0) - '0';
			if(score.charAt(0) > score.charAt(2)){
				list[first].points += 3;
			}
			if(score.charAt(0) < score.charAt(2)){
				list[second].points += 3;
			}
			if(score.charAt(0) == score.charAt(2)){
				list[first].points++;
				list[second].points++;
			}
		}
		int berland = -1;
		int notBerland = -1;
		for(String out: game.keySet())	{
			if(game.get(out) == 2)	{
				if(out.equals("BERLAND"))
					berland = fastAccess.get(out);
				else
					notBerland = fastAccess.get(out);
			}
		}
		int ret1 = 10000000;
		int ret2 = 1000000;
		for(int a = 1; a < 100; a++)	{
			for(int b = a-1; b > -1; b--)	{
				Team[] temp = copy(list);
				temp[berland].scored += a;
				temp[notBerland].scored += b;
				temp[berland].lost += b;
				temp[notBerland].lost += a;
				temp[berland].points += 3;
				Arrays.sort(temp);
				if(temp[0].name.equals("BERLAND") || temp[1].name.equals("BERLAND"))	{
					if(a-b < ret1 - ret2)	{
						ret1 = a;
						ret2 = b;
					}
					else if(a-b == ret1 - ret2 && b < ret2)	{
						ret1 = a;
						ret2 = b;
					}
				}
			}
		}
		if(ret1 == 10000000)
			pw.println("IMPOSSIBLE");
		else
			pw.println(ret1 + ":" + ret2);
		pw.close();
	}

	public static Team[] copy(Team[] team)	{
		Team[] ret = new Team[team.length];
		for(int i = 0; i < ret.length; i++)	{
			ret[i] = new Team(team[i]);
		}
		return ret;
	}

	static class Team implements Comparable<Team> {
		public String name;
		public int points;
		public int scored;
		public int lost;
		public Team(String a, int b, int c, int d)	{
			name = a;
			points = b;
			scored = c;
			lost = d;
		}
		public Team(Team team)	{
			name = team.name;
			points = team.points;
			scored = team.scored;
			lost = team.lost;
		}
		public int compareTo(Team team)	{
			if(points != team.points)
				return team.points - points;
			if(scored - lost != team.scored - team.lost)
				return (team.scored-team.lost) - (scored-lost);
			if(scored != team.scored)
				return team.scored - scored;
			return name.compareTo(team.name);
		}
	}

	public static long readLong() throws IOException	{
		return Long.parseLong(nextToken());
	}
	public static double readDouble() throws IOException	{
		return Double.parseDouble(nextToken());
	}
	public static int readInt() throws IOException	{
		return Integer.parseInt(nextToken());
	}
	public static short readShort() throws IOException	{
		return Short.parseShort(nextToken());
	}
	public static String nextToken() throws IOException	{
		while(st == null || !st.hasMoreTokens())	{
			if(!br.ready())	{
				pw.close();
				System.exit(0);
			}
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}
}

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class FootballChampionship {
    static class Team implements Comparable<Team> {
        String name;
        int scored, missed, points;

        public Team(String n) {
            name = n;
        }

        @Override
        public int compareTo(Team t2) {
            if (points == t2.points) {
                int ad = scored - missed;
                int bd = t2.scored - t2.missed;
                if (ad == bd)
                    if (scored == t2.scored)
                        return -(t2.name.compareTo(name));
                    else
                        return t2.scored - scored;
                else
                    return bd - ad;

            }
            return t2.points - points;
        }

    }

    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        HashMap<String, Team> map = new HashMap<String, Team>();
        HashMap<String, Integer> count = new HashMap<String, Integer>();
        for (int i = 0; i < 5; i++) {
            String str = r.readLine();
            str = str.replace(":", " ");
            String[] sp = str.split("[ ]+");
            String a = sp[0];
            String b = sp[1];
            int as = new Integer(sp[2]);
            int bs = new Integer(sp[3]);
            Team t1, t2;
            if (!map.containsKey(a))
                map.put(a, new Team(a));
            if (!map.containsKey(b))
                map.put(b, new Team(b));
            t1 = map.get(a);
            t2 = map.get(b);
            if (as > bs) {
                t1.points += 3;
            } else if (as < bs) {
                t2.points += 3;
            } else {
                t1.points++;
                t2.points++;
            }
            t1.scored += as;
            t2.missed += as;

            t1.missed += bs;
            t2.scored += bs;
            if (!count.containsKey(a))
                count.put(a, 0);
            if (!count.containsKey(b))
                count.put(b, 0);
            int c1 = count.remove(a) + 1, c2 = count.remove(b) + 1;
            count.put(a, c1);
            count.put(b, c2);
        }
        String team2="";
        for (Entry<String, Integer> e : count.entrySet()) {
            if (e.getValue() == 2 && !e.getKey().equals("BERLAND")) {
                team2 = e.getKey();
            }
        }
        Team[] teams = new Team[4];
        Team[] copy = new Team[4];
        int berlandIndex=-1,otherIndex=-1;
        int k = 0;
        for (Entry<String, Team> e : map.entrySet()) {
            teams[k] = e.getValue();
            if(e.getKey().equals("BERLAND"))berlandIndex=k;
            if(e.getKey().equals(team2))otherIndex=k;
            k++;

        }
        for(int dif=1;dif<300;dif++){
        for (int X = 1; X < 300; X++) {
                for (k = 0; k < 4; k++) {
                    copy[k] = new Team(teams[k].name);
                    copy[k].points = teams[k].points;
                    copy[k].scored = teams[k].scored;
                    copy[k].missed = teams[k].missed;
                }
                int Y=X-dif;
                if(X<=Y||Y<0)continue;
                copy[berlandIndex].points+=3;
                copy[berlandIndex].scored+=X;
                copy[berlandIndex].missed+=Y;

                copy[otherIndex].scored+=Y;
                copy[otherIndex].missed+=X;
                Arrays.sort(copy);
                if(copy[0].name.equals("BERLAND")||copy[1].name.equals("BERLAND")){
                    System.out.println(X+":"+Y);
                    return;
                }
            }
        }
        System.out.println("IMPOSSIBLE");
    }
}

import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;

public class C {
	private static void solve() throws IOException {
		HashMap<String, Info> a = new HashMap<String, Info>();
		ArrayList<String> p = new ArrayList<String>();
		for(int i = 0; i < 5; i++) {
			String n1 = nextToken(), n2 = nextToken(), n3 = nextToken();
			String[] b = n3.split(":");
			if(n1.compareTo("BERLAND") == 0)
				p.add(n2);
			if(n2.compareTo("BERLAND") == 0)
				p.add(n1);
			int s1 = Integer.parseInt(b[0]);
			int s2 = Integer.parseInt(b[1]);
			int w1 = 1, w2 = 1;
			if(s1 > s2) {
				w1 = 3;
				w2 = 0;
			}
			else if(s1 < s2) {
				w1 = 0;
				w2 = 3;
			}
			if(a.containsKey(n1)) {
				a.get(n1).gf += s1;
				a.get(n1).go += s2;
				a.get(n1).w += w1;
			}
			else
				a.put(n1, new Info(s1, s2, w1));

			if(a.containsKey(n2)) {
				a.get(n2).gf += s2;
				a.get(n2).go += s1;

				a.get(n2).w += w2;
			}
			else
				a.put(n2, new Info(s2, s1, w2));
		}
		boolean f = false;

		a.get("BERLAND").w += 3;
		for(int d = 1; d < 200 && !f; d++) {
			for(int y = 0; y < 200 && !f; y++) {

				Iterator<String> it1 = a.keySet().iterator();
				while(it1.hasNext()) {

					int x = d + y;
					String op = it1.next();
					if(op.compareTo("BERLAND") == 0)
						continue;
					if(p.contains(op))
						continue;
					a.get(op).gf += y;
					a.get(op).go += x;
					a.get("BERLAND").gf += x;
					a.get("BERLAND").go += y;
					Iterator<String> it = a.keySet().iterator();
					int num = 0;
					while(it.hasNext()) {
						String cur = it.next();
						if(cur.equals("BERLAND"))
							continue;
						Info o = a.get(cur);
						if(o.compareTo(a.get("BERLAND")) > 0)
							num++;
						else if(o.compareTo(a.get("BERLAND")) == 0)
							if(cur.compareTo("BERLAND") < 0)
								num++;
					}

					a.get(op).gf -= y;
					a.get(op).go -= x;
					a.get("BERLAND").gf -= x;
					a.get("BERLAND").go -= y;
					if(num <= 1) {
						out.println(x + ":" + y);
						f = true;
						break;
					}
				}
			}
		}

		if(!f)
			out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
class Info implements Comparable<Info>{
	int gf, go, w;
	Info(int f, int o, int w) {
		gf = f;
		go = o;
		this.w = w;
	}
	public int compareTo(Info o) {
		if(this.w > o.w)
			return 1;
		else if(this.w < o.w)
			return -1;
		else if(this.gf - this.go < o.gf - o.go)
			return -1;
		else if(this.gf - this.go > o.gf - o.go)
			return 1;
		else if(this.gf < o.gf)
			return -1;
		else if(this.gf > o.gf)
			return 1;
		else
			return 0;
	}
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class C {

	static class Sort implements Comparable<Sort> {
		String name;
		int point, gol, otkaz;
		public int compareTo(Sort arg0) {
			if (this.point < arg0.point || this.point==arg0.point && this.gol-this.otkaz < arg0.gol-arg0.otkaz || this.point==arg0.point && this.gol-this.otkaz ==arg0.gol-arg0.otkaz && this.gol < arg0.gol || this.point==arg0.point && this.gol-this.otkaz ==arg0.gol-arg0.otkaz && this.gol == arg0.gol && this.name.compareTo(arg0.name) > 0)
				return 1;
			return 0;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[]name = new String[5];
		int[]point = new int[5],gol = new int[5], otkaz = new int[5], oyin = new int[5];
		Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("BERLAND", 1);
		int cnt = 1;
		name[1] = "BERLAND";
		for (int i = 1; i <= 5; i++) {
			String[]s = sc.nextLine().split(" ");
			String[]ss = s[2].split(":");
			int k1 = Integer.parseInt(ss[0]), k2 = Integer.parseInt(ss[1]);
			String s1 = s[0], s2 = s[1];
			int ind1 = 0, ind2 = 0;
			if (map.containsKey(s1))
				ind1 = map.get(s1);
			else {
				map.put(s1, ++cnt);
				name[cnt] = s1;
				ind1 = cnt;
			}
			if (map.containsKey(s2))
				ind2 = map.get(s2);
			else {
				map.put(s2, ++cnt);
				name[cnt] = s2;
				ind2 = cnt;
			}
			gol[ind1] += k1;
			gol[ind2] += k2;
			otkaz[ind1] += k2;
			otkaz[ind2] += k1;
			if (k1 > k2)
				point[ind1] += 3;
			else {
				if (k1 < k2)
					point[ind2] += 3;
				else {
					point[ind1]++;
					point[ind2]++;
				}
			}
			oyin[ind1]++;
			oyin[ind2]++;
		}
		int raqib = 0;
		for (int i = 2; i <= 4; i++) {
			if (oyin[i]==2) {
				raqib = i;
				break;
			}
		}
		boolean found = false;
		int k1 = 0, k2 = 0;
		for (int i = 1; i <= 100; i++) {
			for (int j = 0; j < i; j++) {
				point[1] += 3;
				gol[1] += i;
				gol[raqib] += j;
				otkaz[1] += j;
				otkaz[raqib] += i;
				Sort[]a = new Sort[5];
				for (int k = 1; k <= 4; k++) {
					a[k] = new Sort();
					a[k].name = name[k];
					a[k].gol = gol[k];
					a[k].point = point[k];
					a[k].otkaz = otkaz[k];
				}
				Arrays.sort(a, 1, 5);
				int ind = 0;
				for (int k = 1; k <= 2; k++) {
					if (a[k].name.equals("BERLAND")) {
						ind = k;
						break;
					}
				}
				if (ind > 0) {
					if (!found) {
						found = true;
						k1 = i;
						k2 = j;
					}
					else {
						if (i-j < k1-k2 || i-j==k1-k2 && j < k2) {
							k1 = i;
							k2 = j;
						}
					}
				}
				gol[1] -= i;
				gol[raqib] -= j;
				point[1] -= 3;
				otkaz[1] -= j;
				otkaz[raqib] -= i;
			}
		}
		if (!found)
			System.out.println("IMPOSSIBLE");
		else
			System.out.println(k1+":"+k2);
	}

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int m,n;

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			input();
			solve();
		}
	}

	void solve()
	{
		node[] arr = new node[4];
		String en="";
		int i =0;
		int mind=1000000;
		int minj=1000000;
		int mina=1;
		int minb=1;
		for(String x:hm2.keySet())
		{
			if(hm2.get(x)==2 && !x.equals(ber))
				en = x;
		}
		boolean b = false;
		for(i =0;i<1000;i++)
			for(int j =i-1;j>=0;j--)
			{
				arr = new node[4];
				int l = 0;
				for(String x:hm.keySet())
				{
					node t = hm.get(x);
					node n = new node(t.name,t.score,t.goals,t.opp);
					if(x.equals(en))
					{
						n.goals+=j;
						n.opp+=i;
					}
					if(x.equals(ber))
					{
						n.goals+=i;
						n.score+=3;
						n.opp+=j;
					}
					arr[l++] = n;
				}
				Arrays.sort(arr);
				//debug(i,j,arr);
				if(arr[2].name.equals(ber)||arr[3].name.equals(ber))
				{
					if(i-j<mind)
					{
						mina = i;
						minb = j;
						mind = i-j;
					}
					if(i-j==mind && j<minj)
					{
						mina = i;
						minb = j;
						minj = j;
					}
					b = true;
				}
			}
		if(!b)
		System.out.println("IMPOSSIBLE");
		else System.out.println(mina+":"+minb);
	}
	class node implements Comparable<node>
	{
		String name;
		int score;
		int goals;
		int opp;

		node(String _name, int _s, int _g, int _opp)
		{
			name = _name;
			score = _s;
			goals = _g;
			opp = _opp;
		}

		public int compareTo(node x)
		{
			if(score>x.score)
				return 1;
			else if(score==x.score)
			{
				if(goals-opp>x.goals-x.opp)
					return 1;
				else if(goals-opp ==x.goals-x.opp)
				{
					if(goals>x.goals)
						return 1;
					else if(goals==x.goals)
						return -name.compareTo(x.name);
					else
						return -1;
				}
				else
					return -1;
			}
			else
				return -1;
		}

		public String toString()
		{
			return "("+name+","+score+","+goals+","+opp+")";
		}
	}
	String a,b,c;
	String ber;
	int index;
	HashMap<String,node> hm;
	HashMap<String,Integer> hm2;
	boolean input() throws IOException
	{
		ber = "BERLAND";
		index = 0;
		hm = new HashMap<String,node>();
		hm2 = new HashMap<String,Integer>();
		for(int k =0;k<5;k++)
		{
			a = ns();
			b = ns();
			c = ns();
			if(hm2.containsKey(a))
				hm2.put(a,hm2.get(a)+1);
			else
				hm2.put(a,1);

			if(hm2.containsKey(b))
				hm2.put(b,hm2.get(b)+1);
			else
				hm2.put(b,1);
			String[] sc = c.split(":");
			int sa = Integer.parseInt(sc[0]);
			int sb = Integer.parseInt(sc[1]);
			if(!hm.containsKey(a))
				hm.put(a, new node(a,0,0,0));
			if(!hm.containsKey(b))
				hm.put(b, new node(b,0,0,0));
			node i = hm.get(a);
			node j = hm.get(b);
			if(sa>sb)
				i.score+=3;
			else if(sa==sb)
			{
				i.score+=1;
				j.score+=1;
			}
			else
				j.score+=3;

			i.goals+=sa;
			j.opp+=sa;
			j.goals+=sb;
			i.opp+=sb;
		}
	//	debug(hm);
		return true;
	}
}

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import java.io.*;
import java.math.*;
import java.util.*;

@SuppressWarnings("unused")
public class C {
	public static void main(String[] args) throws Exception {
		Scanner in = new Scanner(System.in);
		String[] T1 = new String[6];
		String[] T2 = new String[6];
		int[] G1 = new int[6];
		int[] G2 = new int[6];
		HashMap<String, Integer> map = new HashMap<String, Integer>();
		for (int i = 0; i < 5; i++) {
			String[] s = in.nextLine().replace(":", " ").split(" ");
			T1[i] = s[0];
			T2[i] = s[1];
			G1[i] = Integer.parseInt(s[2]);
			G2[i] = Integer.parseInt(s[3]);
			map.put(T1[i], 0);
			map.put(T2[i], 0);
		}

		for (int i = 0; i < 5; i++) {
			map.put(T1[i], map.get(T1[i]) + 1);
			map.put(T2[i], map.get(T2[i]) + 1);
		}
		T1[5] = "BERLAND";
		String[] Teams = new String[4];
		int n = 0;
		for (Map.Entry<String, Integer> e : map.entrySet()) {
			Teams[n++] = e.getKey();
			if (!e.getKey().equals("BERLAND") && e.getValue() == 2) {
				T2[5] = e.getKey();
			}
		}
		HashMap<String, Integer> index = new HashMap<String, Integer>();
		for (int i = 0; i < 4; i++) {
			index.put(Teams[i], i);
		}
		int X = -1, Y = -1;
		for (int x = 0; x < 100; x++) {
			for (int y = 0; y < x; y++) {
				G1[5] = x;
				G2[5] = y;
				if (ok(T1, T2, G1, G2, Teams, index)) {
					if (X == -1 && Y == -1) {
						X = x;
						Y = y;
					}
					if (x - y < X - Y || (x - y == X - Y && y < Y)) {
						X = x;
						Y = y;
					}
				}
			}
		}
		if (X == -1 && Y == -1) {
			System.out.println("IMPOSSIBLE");
		} else {
			System.out.println(X + ":" + Y);
		}
	}

	static boolean ok(String[] T1, String[] T2, int[] G1, int[] G2, String[] Teams, HashMap<String, Integer> index) {
		Team[] T = new Team[4];
		for (int i = 0; i < 4; i++) {
			T[i] = new Team(Teams[i], 0, 0, 0);
		}
		for (int i = 0; i < 6; i++) {
			if (G1[i] == G2[i]) {
				T[index.get(T1[i])].points += 1;
				T[index.get(T2[i])].points += 1;
			}
			if (G1[i] > G2[i]) {
				T[index.get(T1[i])].points += 3;
			}
			if (G1[i] < G2[i]) {
				T[index.get(T2[i])].points += 3;
			}
			T[index.get(T1[i])].diff += G1[i] - G2[i];
			T[index.get(T2[i])].diff += G2[i] - G1[i];
			T[index.get(T1[i])].scored += G1[i];
			T[index.get(T2[i])].scored += G2[i];
		}
		sort(T);
		if (T[0].name.equals("BERLAND") || T[1].name.equals("BERLAND")) {
			return true;
		}
		return false;
	}

	static class Team implements Comparable<Team> {
		String name;
		int points, diff, scored;

		public Team(String n, int p, int d, int s) {
			name = n;
			points = p;
			diff = d;
			scored = s;
		}

		public int compareTo(Team T) {
			if (points != T.points) {
				return -(points - T.points);
			}
			if (diff != T.diff) {
				return -(diff - T.diff);
			}
			if (scored != T.scored) {
				return -(scored - T.scored);
			}
			return name.compareTo(T.name);
		}
	}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Erik Odenman
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

    static HashMap<String, Integer> teamNames;
    static int index;
    static Team[] teams;

	public void solve(int testNumber, InputReader in, OutputWriter out) {
        int[] occ = new int[4];
        teamNames = new HashMap<String, Integer>();
        index = 0;
        teams = new Team[4];
        for (int i = 0; i < 5; i++) {
            String t1 = in.next();
            String t2 = in.next();
            String sc = in.next();
            int p1 = sc.charAt(0) - '0';
            int p2 = sc.charAt(2) - '0';
            int i1 = getIndex(t1);
            int i2 = getIndex(t2);
            occ[i1]++;
            occ[i2]++;
            if (p1 > p2) {
                teams[i1].score += 3;
            } else if (p2 > p1) {
                teams[i2].score += 3;
            } else {
                teams[i1].score++;
                teams[i2].score++;
            }
            teams[i1].x += p1;
            teams[i1].y += p2;
            teams[i2].x += p2;
            teams[i2].y += p1;
        }
        int bi = getIndex("BERLAND");
        int opp = -1;
        for (int i = 0; i < 4; i++) {
            if (i != bi && occ[i] < 3) opp = i;
        }
        teams[bi].score += 3;
        int bx = -1;
        int by = -1;
        for (int x = 1; x < 100; x++) {
            for (int y = 0; y < x; y++) {
                teams[bi].x += x;
                teams[bi].y += y;
                teams[opp].x += y;
                teams[opp].y += x;
                Team[] scoreBoard = Arrays.copyOf(teams, 4);
                Arrays.sort(scoreBoard);
                if (scoreBoard[0].name.equals("BERLAND") || scoreBoard[1].name.equals("BERLAND")) {
                    int oldDiff = bx - by;
                    int newDiff = x - y;
                    if (bx == -1 || oldDiff > newDiff || (oldDiff == newDiff && by > y)) {
                        bx = x;
                        by = y;
                    }
                }
                teams[bi].x -= x;
                teams[bi].y -= y;
                teams[opp].x -= y;
                teams[opp].y -= x;
            }
        }
        if (bx == -1) {
            out.println("IMPOSSIBLE");
        } else {
            out.println(bx+":"+by);
        }
	}

    static int getIndex(String s) {
        if (teamNames.containsKey(s)) return teamNames.get(s);
        teamNames.put(s, index);
        teams[index] = new Team(s);
        index++;
        return index-1;
    }

    static class Team implements Comparable<Team> {
        public String name;
        public int score, x, y;
        public Team(String n) {
            name = n;
            score = 0;
            x = 0;
            y = 0;
        }
        public int compareTo(Team t) {
            if (score > t.score) return -1;
            if (t.score > score) return 1;
            if (x - y > t.x - t.y) return -1;
            if (t.x - t.y > x - y) return 1;
            if (x > t.x) return -1;
            if (t.x > x) return 1;
            return name.compareTo(t.name);
        }
        public String toString() {
            return name+" "+score+" "+x+" "+y;
        }
    }
}

class InputReader {
    private BufferedReader in;
    private StringTokenizer st;
    String token;

    public InputReader(InputStream inStream) {
        in = new BufferedReader(new InputStreamReader(inStream));
    }

    public String next() {
        String res = peekToken();
        token = null;
        return res;
    }

    public String peekToken() {
        if (token != null) return token;
        while (st == null || !st.hasMoreTokens()) {
            String line = null;
            try {
                line = in.readLine();
            } catch (IOException e) {
                throw new RuntimeException("No more tokens was found");
            }
            if (line == null) return null;
            st = new StringTokenizer(line);
        }
        return token = st.nextToken();
    }

    }

class OutputWriter  {

    PrintWriter out;

    public OutputWriter(OutputStream outStream) {
        out = new PrintWriter(outStream);
    }

    public OutputWriter(Writer writer) {
        out = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) out.print(' ');
            out.print(objects[i]);
        }
    }

    public void println(Object... objects) {
        print(objects);
        out.println();
    }

    public void close() {
        out.close();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class C implements Runnable {

	class Team implements Comparable<Team> {
		String name;
		int points, goals, missed, matches;

		Team(String name, int points, int goals, int missed, int matches) {
			this.name = name;
			this.points = points;
			this.goals = goals;
			this.missed = missed;
			this.matches = matches;
		}

		@Override
		public int compareTo(Team t) {
			if (points != t.points)
				return t.points - points;
			if (goals - missed != t.goals - t.missed)
				return t.goals - t.missed - goals + missed;
			if (goals != t.goals)
				return t.goals - goals;
			return name.compareTo(t.name);
		}

		public String toString() {
			return name + " " + points + " " + goals + " " + missed + " "
					+ matches;
		}
	}

	final String berl = "BERLAND";

	private void Solution() throws IOException {
		ArrayList<Team> mas = new ArrayList<Team>();
		for (int i = 0; i < 5; i++) {
			String t1 = next(), t2 = next(), res = next();
			int g1 = res.charAt(0) - '0', g2 = res.charAt(2) - '0';
			int p1 = 0, p2 = 0;
			if (g1 == g2) {
				p1 = 1;
				p2 = 1;
			} else if (g1 > g2)
				p1 = 3;
			else
				p2 = 3;
			if (mas.isEmpty()) {
				mas.add(new Team(t1, p1, g1, g2, 1));
				mas.add(new Team(t2, p2, g2, g1, 1));
			} else {
				boolean found = false;
				for (int j = 0; j < mas.size(); j++)
					if (t1.equals(mas.get(j).name)) {
						found = true;
						mas.get(j).points += p1;
						mas.get(j).goals += g1;
						mas.get(j).missed += g2;
						mas.get(j).matches++;
					}
				if (!found)
					mas.add(new Team(t1, p1, g1, g2, 1));
				found = false;
				for (int j = 0; j < mas.size(); j++)
					if (t2.equals(mas.get(j).name)) {
						found = true;
						mas.get(j).points += p2;
						mas.get(j).goals += g2;
						mas.get(j).missed += g1;
						mas.get(j).matches++;
					}
				if (!found)
					mas.add(new Team(t2, p2, g2, g1, 1));
			}
		}
		int ber = 0, op = 0;
		for (int i = 0; i < mas.size(); i++)
			if (mas.get(i).name.equals(berl))
				ber = i;
		for (int i = 0; i < mas.size(); i++)
			if (mas.get(i).matches == 2 && !mas.get(i).name.equals(berl))
				op = i;
		for (int i = 1; i < 30; i++) {
			for (int j = i; j < 30; j++) {
				ArrayList<Team> tmp = new ArrayList<Team>();
				for (int k = 0; k < mas.size(); k++) {
					Team cur = mas.get(k);
					tmp.add(new Team(cur.name, cur.points, cur.goals,
							cur.missed, cur.matches));
				}
				tmp.get(ber).points += 3;
				tmp.get(ber).goals += j;
				tmp.get(ber).missed += j - i;
				tmp.get(ber).matches++;
				tmp.get(op).goals += j - i;
				tmp.get(op).missed += j;
				tmp.get(op).matches++;
				Collections.sort(tmp);
				if (tmp.get(0).name.equals(berl)
						|| tmp.get(1).name.equals(berl)) {
					print(j);
					print(":");
					print(j - i);
					return;
				}
				tmp.clear();
			}
		}
		print("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new C().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			Solution();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(0);
		}
	}

	void print(Object... obj) {
		for (int i = 0; i < obj.length; i++) {
			if (i != 0)
				out.print(" ");
			out.print(obj[i]);
		}
	}

	void println(Object... obj) {
		print(obj);
		print("\n");
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(next());
	}

	String nextLine() throws IOException {
		return in.readLine();
	}

	String next() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(nextLine());
		return tokenizer.nextToken();
	}
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);

        int idx = 0;
        HashMap<String, Integer> mp = new HashMap<String, Integer>();

        T[] a = new T[4];
        for(int i = 0; i < 4; i++)
            a[i] = new T("", 0, 0, 0);

        String[][] b = new String[5][2];

        for(int i = 0; i < 5; i++){
            String x = r.next();
            String y = r.next();

            b[i][0] = x;
            b[i][1] = y;

            if(!mp.containsKey(x))mp.put(x, idx++);
            if(!mp.containsKey(y))mp.put(y, idx++);

            String[] res = r.next().split("[:]+");
            int xx = Integer.parseInt(res[0]);
            int yy = Integer.parseInt(res[1]);

            if(xx > yy)a[mp.get(x)].p += 3;
            else if(xx == yy){a[mp.get(x)].p++; a[mp.get(y)].p++;}
            else a[mp.get(y)].p += 3;

            a[mp.get(x)].g += xx;
            a[mp.get(x)].m += yy;

            a[mp.get(y)].g += yy;
            a[mp.get(y)].m += xx;
        }
        for(String x : mp.keySet())
            a[mp.get(x)].n = x;

        boolean[] v = new boolean[4];
        v[mp.get("BERLAND")] = true;
        for(int i = 0; i < 5; i++){
            if(b[i][0].equals("BERLAND")){
                v[mp.get(b[i][1])] = true;
            }else if(b[i][1].equals("BERLAND")){
                v[mp.get(b[i][0])] = true;
            }
        }
        int xo = -1;
        for(int i = 0; i < 4; i++)
            if(!v[i])xo = i;
//      System.out.println(mp.get("BERLAND") + ", " +  xo);

        boolean can = false;
        int rx = 1000, ry = 0;
        for(int xx = 1; xx <= 100; xx++)
        for(int yy = xx - 1; yy >= 0; yy--){
            T[] c = new T[4];
            for(int i = 0; i < 4; i++)
                c[i] = new T(a[i].n, a[i].p, a[i].g, a[i].m);

            int me = mp.get("BERLAND");
            int you = xo;

            if(xx > yy)c[me].p += 3;
            else if(xx == yy){c[me].p++; c[you].p++;}
            else c[you].p += 3;

            c[me].g += xx;
            c[me].m += yy;

            c[you].g += yy;
            c[you].m += xx;

            Arrays.sort(c);

//          for(int i = 0; i < 4; i++)
//              System.out.println(c[i].n + " " + c[i].p + " " + c[i].g + " " + (c[i].g - c[i].m));

            if(c[0].n.equals("BERLAND")){
                can = true;

                if(xx - yy < rx - ry){
                    rx = xx;
                    ry = yy;
                }else if(xx - yy == rx - ry && yy < ry){
                    rx = xx;
                    ry = yy;
                }
            }else if(c[1].n.equals("BERLAND")){
                can = true;

                if(xx - yy < rx - ry){
                    rx = xx;
                    ry = yy;
                }else if(xx - yy == rx - ry && yy < ry){
                    rx = xx;
                    ry = yy;
                }
            }
        }

        if(!can)System.out.println("IMPOSSIBLE");
        else{
            System.out.printf("%d:%d\n", rx, ry);
        }

    }
}
class T implements Comparable<T>{
    String n;
    int p, g, m;
    public T(String ni, int pi, int gi, int mi){
        n = ni;
        p = pi;
        g = gi;
        m = mi;
    }
    @Override
    public int compareTo(T b) {
        if(p > b.p)return -1;
        else if(p == b.p){
            if(g - m > b.g - b.m)return -1;
            else if(g - m == b.g - b.m){
                if(g > b.g)return -1;
                else if(g == b.g){
                    return n.compareTo(b.n);
                }else return 1;
            }
            else return 1;
        }else return 1;
    }
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class FootballChampionship200C {
	private static final String B_TEAM_NAME = "BERLAND";
	private static final int MAX_GOAL = 100;

	public static void main(String[] args) {
		HashMap<String, Team> map = new HashMap<String, Team>();
		Scanner in = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			String team1 = in.next();
			String team2 = in.next();
			String result = in.next();
			int g1 = Integer.parseInt(result.substring(0, 1));
			int g2 = Integer.parseInt(result.substring(2));
			Team t1 = map.get(team1);
			if (t1 == null) {
				t1 = new Team(team1);
				map.put(team1, t1);
			}
			Team t2 = map.get(team2);
			if (t2 == null) {
				t2 = new Team(team2);
				map.put(team2, t2);
			}
			t1.goal += g1;
			t2.goal += g2;
			t1.miss += g2;
			t2.miss += g1;
			t1.matches++;
			t2.matches++;
			if (g1 > g2)
				t1.score += 3;
			if (g1 < g2)
				t2.score += 3;
			if (g1 == g2) {
				t1.score++;
				t2.score++;
			}
		}
		Team[] teams = new Team[4];
		int i = 0;
		Team tb, to = null;
		tb = map.get(B_TEAM_NAME);
		for (Team t : map.values()) {
			teams[i++] = t;
			if (t != tb && t.matches == 2)
				to = t;
		}
		int rx, ry;
		rx = ry = -1;
		for (int x = 0; x < MAX_GOAL; x++)
			for (int y = 0; y < MAX_GOAL; y++) {
				if (x <= y)
					continue;
				int g1 = x;
				int g2 = y;
				tb.goal += g1;
				to.goal += g2;
				tb.miss += g2;
				to.miss += g1;
				if (g1 > g2)
					tb.score += 3;
				if (g1 < g2)
					to.score += 3;
				if (g1 == g2) {
					tb.score++;
					to.score++;
				}
				Arrays.sort(teams);
				if (teams[0] == tb || teams[1] == tb) {
					if (rx == -1) {
						rx = x;
						ry = y;
					} else if (x - y < rx - ry) {
						rx = x;
						ry = y;
					} else if (x - y == rx - ry && y < ry) {
						rx = x;
						ry = y;
					}
				}
				tb.goal -= g1;
				to.goal -= g2;
				tb.miss -= g2;
				to.miss -= g1;
				if (g1 > g2)
					tb.score -= 3;
				if (g1 < g2)
					to.score -= 3;
				if (g1 == g2) {
					tb.score--;
					to.score--;
				}
			}
		if (rx == -1)
			System.out.println("IMPOSSIBLE");
		else
			System.out.printf("%d:%d\n", rx, ry);
	}

	static class Team implements Comparable<Team> {
		int goal, miss, score;
		String name;
		int matches;

		public Team(String _name) {
			this.name = _name;
			matches = goal = miss = score = 0;
		}

		private int diff() {
			return goal - miss;
		}

		@Override
		public int compareTo(Team other) {
			if (this.score > other.score)
				return -1;
			if (this.score < other.score)
				return 1;
			if (this.diff() > other.diff())
				return -1;
			if (this.diff() < other.diff())
				return 1;
			if (this.goal > other.goal)
				return -1;
			if (this.goal < other.goal)
				return 1;
			if (this.name.compareTo(other.name) < 0)
				return -1;
			if (this.name.compareTo(other.name) > 0)
				return 1;
			return 0;
		}
	}
}

import java.util.Map;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.util.Set;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Egor Kulikov (egor@egork.net)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		Counter<String> played = new Counter<String>();
		Counter<String> points = new Counter<String>();
		Counter<String> difference = new Counter<String>();
		Counter<String> goals = new Counter<String>();
		for (int i = 0; i < 5; i++) {
			String first = in.readString();
			String second = in.readString();
			String score = in.readString();
			int firstGoals = Integer.parseInt(score.split(":")[0]);
			int secondGoals = Integer.parseInt(score.split(":")[1]);
			played.add(first);
			played.add(second);
			if (firstGoals > secondGoals)
				points.add(first, 3);
			else if (firstGoals < secondGoals)
				points.add(second, 3);
			else {
				points.add(first);
				points.add(second);
			}
			difference.add(first, firstGoals - secondGoals);
			difference.add(second, secondGoals - firstGoals);
			goals.add(first, firstGoals);
			goals.add(second, secondGoals);
		}
		points.add("BERLAND", 3);
		String other = null;
		for (Map.Entry<String, Long> entry : played.entrySet()) {
			if (entry.getValue() == 2 && !"BERLAND".equals(entry.getKey()))
				other = entry.getKey();
		}
		for (int i = 1; i < 100; i++) {
			for (int j = 0; j <= 100; j++) {
				difference.add("BERLAND", i);
				difference.add(other, -i);
				goals.add("BERLAND", i + j);
				goals.add(other, j);
				int place = 0;
				for (String key : played.keySet()) {
					if (points.get(key) > points.get("BERLAND") || points.get(key).equals(points.get("BERLAND")) &&
						(difference.get(key) > difference.get("BERLAND") || difference.get(key).equals(difference.get("BERLAND")) &&
						(goals.get(key) > goals.get("BERLAND") || goals.get(key).equals(goals.get("BERLAND")) && key.compareTo("BERLAND") <= 0)))
					{
						place++;
					}
				}
				if (place <= 2) {
					out.printLine((i + j) + ":" + j);
					return;
				}
				difference.add("BERLAND", -i);
				difference.add(other, i);
				goals.add("BERLAND", -i - j);
				goals.add(other, -j);
			}
		}
		out.printLine("IMPOSSIBLE");
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuffer res = new StringBuffer();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}

	}

class Counter<K> extends HashMap<K, Long> {
	public Counter() {
		super();
	}

	public void add(K key) {
		put(key, get(key) + 1);
	}

	public void add(K key, long delta) {
		put(key, get(key) + delta);
	}

	public Long get(Object key) {
		if (containsKey(key))
			return super.get(key);
		return 0L;
	}
}

import java.util.*;
public class Main {

    class C implements Comparable<C>{
        String name;
        int score, diff,goal,match;
        public C(String name, int score, int diff, int goal, int match) {
            this.name = name;
            this.score = score;
            this.diff = diff;
            this.goal = goal;
            this.match = match;
        }
        public int compareTo(C o) {
            if(this.score < o.score) return 1;
            if(this.score > o.score) return -1;
            if(this.diff < o.diff) return 1;
            if(this.diff > o.diff) return -1;
            if(this.goal < o.goal) return 1;
            if(this.goal > o.goal) return -1;
            int res = this.name.compareTo(o.name);
            return res;
        }
        @Override
        public String toString() {
            return "C [name=" + name + ", score=" + score + ", diff=" + diff
                    + ", goal=" + goal + ", match=" + match + "]";
        }

    }

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            HashMap<String,Integer>map = new HashMap<String,Integer>();
            C [] data = new C[4];
            for(int i = 0; i < 5;i++){
                String line = sc.nextLine();
                String [] linearr = line.split(" |:");
                int id1 = -1, id2 = -1;
                if(map.containsKey(linearr[0])){
                    id1 = map.get(linearr[0]);
                }
                else{
                    int res = map.size();
                    id1 = res;
                    map.put(linearr[0], res);
                    data[id1] = new C(linearr[0], 0,0,0,0);
                }
                if(map.containsKey(linearr[1])){
                    id2 = map.get(linearr[1]);
                }
                else{
                    int res = map.size();
                    id2 = res;
                    map.put(linearr[1], res);
                    data[id2] = new C(linearr[1], 0,0,0,0);
                }
                //score
                int goal1 = Integer.parseInt(linearr[2]);
                int goal2 = Integer.parseInt(linearr[3]);
                if(goal1 > goal2){
                    data[id1].score += 3;
                }
                else if(goal1 < goal2){
                    data[id2].score += 3;
                }
                else{
                    data[id1].score++;
                    data[id2].score++;
                }
                //diff
                data[id1].diff += goal1 - goal2;
                data[id2].diff += goal2 - goal1;
                //goal
                data[id1].goal += goal1;
                data[id2].goal += goal2;
                //match
                data[id1].match++;
                data[id2].match++;
            }

            Arrays.sort(data);
            //find a myteam
            int myid = -1,op = -1;
            for(int i = 0; i < 4; i++){
                if(data[i].name.equals("BERLAND")){
                    myid = i;
                    break;
                }
            }
            for(int i=0; i < 4; i++){
                if(i == myid) continue;
                if(data[i].match == 2){
                    op = i;
                    break;
                }
            }
            if(myid == 0 || myid == 1){
                System.out.println("1:0");
            }
            else{
                boolean flg = false;
                C [] work = new C[4];
                int ansx = -1, ansy = -1;
                for(int diff = 1; diff < 100; diff++){
                    for(int x = diff; x < 100; x++){
                        for(int i = 0; i < 4; i++){
                            work[i] = new C(data[i].name, 0,0,0,0);
                            work[i].diff = data[i].diff;
                            work[i].goal = data[i].goal;
                            work[i].match = data[i].match;
                            work[i].score = data[i].score;
                        }
                        int y = x - diff;
                        work[myid].score += 3;
                        work[myid].diff += x - y;
                        work[op].diff += y - x;
                        work[myid].goal += x;
                        work[op].goal += y;
                        Arrays.sort(work);
                        if(work[0].name.equals("BERLAND") || work[1].name.equals("BERLAND")){
                            ansx = x;
                            ansy = y;
                            flg = true;
                            break;
                        }
                    }
                    if(flg)break;
                }
                if(flg){
                    System.out.println(ansx + ":" + ansy);
                }
                else{
                    System.out.println("IMPOSSIBLE");
                }
            }
        }
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.io.*;
import java.util.*;

public class Main {

   static class Assertion {
      static void check(boolean e) {
         if (!e) {
            throw new Error();
         }
      }
   }

   // class Scanner {
   // StreamTokenizer in;
   //
   // Scanner(InputStream s) {
   // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(s)));
   // in.resetSyntax();
   // in.whitespaceChars(0, 32);
   // in.wordChars(33, 255);
   // }
   //
   // String next() {
   // try {
   // in.nextToken();
   // return in.sval;
   // } catch (Exception e) {
   // throw new Error();
   // }
   // }
   //
   // int nextInt() {
   // return Integer.parseInt(next());
   // }
   //
   // long nextLong() {
   // return Long.parseLong(next());
   // }
   //
   // double nextDobule() {
   // return Double.parseDouble(next());
   // }
   // }

   Scanner in;
   PrintWriter out;

   class Team implements Comparable<Team> {
      int nGoals;
      int nleaves;
      String name;
      int nPoints;
      int nMatches;

      public Team(String name) {
         this.name = name;
      }

      @Override
      public int compareTo(Team second) {
         if (this.nPoints != second.nPoints) {
            return this.nPoints - second.nPoints;
         } else if (this.nGoals - this.nleaves != second.nGoals - second.nleaves) {
            return (this.nGoals - this.nleaves) - (second.nGoals - second.nleaves);
         } else if (this.nGoals != second.nGoals) {
            return this.nGoals - second.nGoals;
         } else {
            return -this.name.compareTo(second.name);

         }
      }
   }

   void solve() {
      TreeMap<String, Team> teams = new TreeMap<String, Main.Team>();
      for (int i = 0; i < 5; i++) {
         String first = in.next();
         String second = in.next();
         if (!teams.containsKey(first)) {
            teams.put(first, new Team(first));
         }
         if (!teams.containsKey(second)) {
            teams.put(second, new Team(second));
         }
         Team fTeam = teams.get(first);
         Team sTeam = teams.get(second);
         fTeam.nMatches++;
         sTeam.nMatches++;
         String score = in.next();
         int fTeamGoals = Integer.parseInt(score.substring(0, 1));
         int sTeamGoals = Integer.parseInt(score.substring(2, 3));
         Assertion.check(score.length()==3);
         if (fTeamGoals == sTeamGoals) {
            fTeam.nPoints++;
            fTeam.nGoals+=fTeamGoals;
            fTeam.nleaves+=sTeamGoals;
            sTeam.nPoints++;
            sTeam.nGoals+=sTeamGoals;
            sTeam.nleaves+=fTeamGoals;
         } else if (fTeamGoals > sTeamGoals) {
            fTeam.nPoints += 3;
            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;

            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;
         } else {
            sTeam.nPoints += 3;
            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;

            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;
         }
         teams.put(first, fTeam);
         teams.put(second, sTeam);
      }
      String berTeamSt = "BERLAND";
      Team berTeam = teams.get(berTeamSt);
      ArrayList<Team> teamList = new ArrayList<Main.Team>();
      for (String teamSt : teams.keySet()) {
         teamList.add(teams.get(teamSt));
      }
      Collections.sort(teamList);
      Team fTeam = berTeam;
      ArrayList<Team> teamBackUp = copy(teamList);
      boolean found = false;
      int bestNGoals = 0;
      int bestNLeaves = 100;
      for (Team sTeam : teamList) {
         if (!sTeam.name.equals(berTeam.name) && sTeam.nMatches==2) {
            for (int nG = 1; nG < 40; nG++) {
               for (int nL = 0; nL < nG; nL++) {
                  int fTeamGoals = nG;
                  int sTeamGoals = nL;
                  int tt = 0;
                  if (fTeamGoals == sTeamGoals) {
                     fTeam.nPoints++;
                     fTeam.nGoals+=fTeamGoals;
                     fTeam.nleaves+=sTeamGoals;
                     sTeam.nPoints++;
                     sTeam.nGoals+=sTeamGoals;
                     sTeam.nleaves+=fTeamGoals;
                     tt = 1;
                  } else if (fTeamGoals > sTeamGoals) {
                     fTeam.nPoints += 3;
                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;

                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;
                     tt = 2;
                  } else {
                     sTeam.nPoints += 3;
                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;

                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;
                     tt = 3;
                  }
                  Collections.sort(teamBackUp);
                  if (teamBackUp.get(2).name.equals(berTeamSt) || teamBackUp.get(3).name.equals(berTeamSt)) {
                     if (!found) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                     found = true;

                     if (nG - nL < bestNGoals - bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     } else if (nG - nL == bestNGoals - bestNLeaves && nL < bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                  }
                  if (tt == 1) {
                     fTeam.nPoints--;
                     fTeam.nGoals-=fTeamGoals;
                     fTeam.nleaves-=sTeamGoals;
                     sTeam.nPoints--;
                     sTeam.nGoals-=sTeamGoals;
                     sTeam.nleaves-=fTeamGoals;
                  } else if (tt == 2) {
                     fTeam.nPoints -= 3;
                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;

                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;
                  } else if (tt == 3) {
                     sTeam.nPoints -= 3;
                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;

                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;
                  }
               }
            }
         }
      }
      if (found) {
         Assertion.check(bestNGoals>0 && bestNLeaves<bestNGoals);
         out.print(bestNGoals + ":" + bestNLeaves);
      } else {
         out.println("IMPOSSIBLE");
      }
   }

   ArrayList<Team> copy(ArrayList<Team> from) {
      ArrayList<Team> copyList = new ArrayList<Main.Team>();
      for (Team team : from) {
         copyList.add(team);
      }
      return copyList;
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();
   }
}

import java.util.*;

public class Football {

    static Map<String, Integer> ids = new HashMap<String, Integer>();
    static String[] names = new String[4];

    static int id = 0;
    public static int getId(String name){
        if(!ids.containsKey(name)){
            ids.put(name, id);
            names[id] = name;
            return id++;
        }
        return ids.get(name);
    }

    static int[] games = new int[4];
    static int[] goals = new int[4];
    static int[] missed = new int[4];
    static int[] points = new int[4];

    private static boolean ok(Integer[] integers) {
        int berid = getId("BERLAND");
        int oid = -1;
        for(int i = 0; i<4; i++){
           if(games[i] == 2 && i != berid){
               oid = i;
               break;
           }
        }
        points[berid] += 3;
        goals[berid] += integers[0];
        missed[oid] += integers[0];
        goals[oid] += integers[1];
        missed[berid] += integers[1];
        Integer[] ids = new Integer[]{0,1,2,3};
        Arrays.sort(ids, new Comparator<Integer>(){

            @Override
            public int compare(Integer teamA, Integer teamB) {
                if(points[teamA] > points[teamB]) return -1;
                if(points[teamB] > points[teamA]) return 1;
                int gdiff = goals[teamA] - missed[teamA];
                int gdiff2 = goals[teamB] - missed[teamB];
                if(gdiff > gdiff2) return -1;
                if(gdiff < gdiff2) return 1;
                if(goals[teamA] > goals[teamB]) return -1;
                if(goals[teamB] > goals[teamA]) return 1;
                return names[teamA].compareTo(names[teamB]);
            }
        });
        points[berid] -= 3;
        goals[berid] -= integers[0];
        missed[oid] -= integers[0];
        goals[oid] -= integers[1];
        missed[berid] -= integers[1];
        return ids[0] == berid || ids[1] == berid;

    }

    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        for(int i = 0; i<5; i++){
            String a = sc.next();
            String b = sc.next();
            int aid = getId(a);
            int bid = getId(b);
            String[] score = sc.next().split(":");
            int asc = Integer.parseInt(score[0]);
            int bsc = Integer.parseInt(score[1]);
            goals[aid] += asc;
            missed[bid] += asc;
            goals[bid] += bsc;
            missed[aid] += bsc;
            games[aid]++;
            games[bid]++;
            if(asc > bsc){
                points[aid] += 3;
            } else if(asc == bsc){
                points[aid]++;
                points[bid]++;
            } else {
                points[bid] += 3;
            }
        }
        List<Integer[]> possible = new ArrayList<Integer[]>();
        for(int i = 0; i<100; i++){
            for(int j = 0; j<i; j++){
                possible.add(new Integer[]{i, j});
            }
        }
        for(int i = 0; i<possible.size(); i++){
            if(!ok(possible.get(i))){
                possible.remove(i);
                i--;
            }
        }
        if(possible.isEmpty()){
            System.out.println("IMPOSSIBLE");
            return;
        }
        Collections.sort(possible, new Comparator<Integer[]>() {
            @Override
            public int compare(Integer[] integers, Integer[] integers1) {
                int da = integers[0]-integers[1];
                int db = integers1[0]-integers1[1];
                if(da < db) return -1;
                if(db < da) return 1;
                return ((Integer)integers[1]).compareTo(integers1[1]);
            }
        });
        System.out.println(possible.get(0)[0]+":"+possible.get(0)[1]);
    }

}

import java.io.*;
import java.util.*;

public class Main {
  BufferedReader br;
  HashMap<String, Integer> hm;
  String[] ss, line;
  Country[] c;
  int ida, idb;
  int[] played;

  public boolean ok() {
    Country[] tmp = c.clone();
    Arrays.sort(tmp);
    return tmp[0].name.equals("BERLAND") || tmp[1].name.equals("BERLAND");
  }

  public class Country implements Comparable<Country> {
    int id, goal, miss, point;
    String name;

    public Country(int id, String name) {
      this.id = id;
      this.goal = 0;
      this.miss = 0;
      this.point = 0;
      this.name = name;
    }

    public void update(int goal, int miss, int point) {
      this.goal += goal;
      this.miss += miss;
      this.point += point;
    }

    public int compareTo(Country c) {
      if (this.point > c.point)
        return -1;
      if (this.point < c.point)
        return 1;
      if (this.goal - this.miss > c.goal - c.miss)
        return -1;
      if (this.goal - this.miss < c.goal - c.miss)
        return 1;
      if (this.goal > c.goal)
        return -1;
      if (this.goal < c.goal)
        return 1;
      if (this.name.compareTo(c.name) < 0)
        return -1;
      if (this.name.compareTo(c.name) > 0)
        return 1;
      return 0;
    }
  }

  public void go() throws Exception {
    String name1, name2;
    int g1, g2, id, id1, id2, p1, p2;

    br = new BufferedReader(new InputStreamReader(System.in));
    hm = new HashMap<String, Integer>();
    line = new String[5];
    c = new Country[4];
    played = new int[4];

    id = 0;
    Arrays.fill(played, 0);
    for (int i = 0; i < 5; i++) {
      line[i] = br.readLine();
      ss = line[i].split(" ");
      name1 = ss[0];
      name2 = ss[1];
      g1 = Integer.parseInt(ss[2].split(":")[0]);
      g2 = Integer.parseInt(ss[2].split(":")[1]);

      if (!hm.containsKey(name1)) {
        hm.put(name1, id);
        c[id] = new Country(id, name1);
        id++;
      }
      if (!hm.containsKey(name2)) {
        hm.put(name2, id);
        c[id] = new Country(id, name2);
        id++;
      }

      id1 = hm.get(name1);
      id2 = hm.get(name2);

      p1 = p2 = 1;
      if (g1 > g2) {
        p1 = 3;
        p2 = 0;
      }
      if (g1 < g2) {
        p1 = 0;
        p2 = 3;
      }

      c[id1].update(g1, g2, p1);
      c[id2].update(g2, g1, p2);
      played[id1]++;
      played[id2]++;
    }

    ida = idb = -1;
    for (int i = 0; i < 4; i++)
      if (played[i] == 2)
        if (c[i].name.equals("BERLAND"))
          ida = i;
        else
          idb = i;

    for (int gd = 1; gd < 85; gd++)
      for (int y = 0; y < 85; y++) {
        int x = y + gd;
        c[ida].update(x, y, 3);
        c[idb].update(y, x, 0);
        if (ok()) {
          System.out.println(x + ":" + y);
          return;
        }
        c[ida].update(-x, -y, -3);
        c[idb].update(-y, -x, 0);
      }

    System.out.println("IMPOSSIBLE");
  }

  public static void main(String[] args) throws Exception {
    new Main().go();
  }
}

import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.System.*; import static java.util.Arrays.*;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class C {
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintStream out = System.out;

    static int m = 0, n = 0;
    static int result = 0;
    static String[] a;

    static class Team implements Comparable<Team> {

    	public String name;
    	public int matches, points, goalFor, goalAgainst;

		public Team(String name) {
			this.name = name;
			matches = 0;
			points = 0;
			goalFor = 0;
			goalAgainst = 0;
		}

		public void addMatch (int co, int u, int v) {
			if (u==v) points +=1 * co;
			if (u>v) points +=3 * co;
			goalFor += u * co;
			goalAgainst += v * co;
			matches += co;
		}

		public int compareTo(Team t) {
			if (points!= t.points) return t.points - points;
			if (goalFor-goalAgainst!= t.goalFor-t.goalAgainst) return (t.goalFor-t.goalAgainst) - (goalFor-goalAgainst);
			if (goalFor!= t.goalFor) return t.goalFor - goalFor;
			return name.compareTo(t.name);
		}

		void debug () {
			C.debug(name, matches, points, goalFor, goalAgainst);
		}
	}

    static ArrayList<Team> list;

	static void readInput() throws IOException {
		list = new ArrayList<C.Team> ();
		a = new String[5];
		for (int i = 0; i < 5; i++) {
			a[i] = in.readLine().trim();
			add (a[i]);
		}
	}

	static void add (String s) {
		String [] teams = s.split("[ ]+");
		String [] scores = teams[2].split(":");
		int u = -1, v = -1;
		int su = new Integer(scores[0]), sv = new Integer(scores[1]);
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).name .equals(teams[0])) u = i;
			if (list.get(i).name .equals(teams[1])) v = i;
		}
		if (u==-1) {
			list.add(new Team(teams[0]));
			u = list.size()-1;
		}
		if (v==-1) {
			list.add(new Team(teams[1]));
			v = list.size()-1;
		}

		list.get(u).addMatch(1, su, sv);
		list.get(v).addMatch(1, sv, su);
	}

	static int ru = -1, rv = -1;
	static void process() {
		ru = -1;
		rv = -1;
		Team berland = new Team(""), other = new Team("");
		for(Team team:list) if(team.matches ==2 && !team.name.equals("BERLAND")) other = team;
		for(Team team:list) if(team.name.equals("BERLAND")) berland = team;

		for (int i = 0; i < 50; i++) for (int j = 0; j < 50; j++) if (i>j) {
			berland.addMatch(1, i, j);
			other.addMatch(1, j,i);

			Collections.sort(list);
			if(list.get(0).name.equals("BERLAND") || list.get(1).name.equals("BERLAND")) {
				debug(i,j);
				update( i, j);
				debug(ru,rv);
			}

			berland.addMatch(-1, i, j);
			other.addMatch(-1, j,i);
		}

		if(ru==-1) out.println("IMPOSSIBLE");
		else out.println(ru+":"+rv);
	}

	private static void update(int u, int v) {
		if (ru==-1) {
			ru = u; rv = v; return;
		}
		if (ru-rv > u-v) {
			ru = u;rv = v;return;
		}
		if (ru-rv == u-v && rv > v) {
			ru = u;rv = v;return;
		}
	}

	public static void main(String[] args) throws IOException {
		readInput();
		process();
	}

	public static void debug(Object...os) {
		System.err.println(Arrays.deepToString(os));
	}

	static int[] readArrInt() throws IOException {
		return parseArrInt(in.readLine());
	}

	static int readInt() throws IOException {
		return new Integer(in.readLine());
	}

	static int[] parseArrInt(String s) {
		StringTokenizer st = new StringTokenizer(s);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (st.hasMoreTokens()) {
			list.add(Integer.parseInt(st.nextToken()));
		}
		Integer[] temp = list.toArray(new Integer[]{});
		int[] res = new int[temp.length];
		for (int i = 0; i < temp.length; i++) {
			res[i] = temp[i];
		}
		return (res);
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[4];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        Score other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = map.get(name);
                }

            } else {
                ber = map.get(name);
            }
            data[index++] = map.get(name);
        }
        ber.score += 1;
        ber.point += 3;

        other.miss += 1;
        Arrays.sort(data);
      //  System.out.println(ber.score + " "+ data[2].score);
        if (ber.point < data[2].point) {
            out.println("IMPOSSIBLE");
        } else {
            int left = 1;
            int right = 0;
       //     System.out.println(data[2].name + " ");
            while (!data[2].name.equals("BERLAND") && !data[3].name.equals("BERLAND")) {
                ber.score += 1;
                left ++;
                other.miss += 1;
                Arrays.sort(data);
            }
            while(true && right + 1 < left){
                ber.miss +=1;
                other.score += 1;
                Arrays.sort(data);
                if(data[2].name.equals("BERLAND") || data[3].name.equals("BERLAND")){
                    right++;

                }else{
                    int difSe = data[2].score - data[2].miss;
                    int difBer = ber.score - ber.miss;
                    if(difSe == difBer && !data[2].name.equals(other.name)){
                        right++;
                        while(!data[2].name.equals("BERLAND") && !data[3].name.equals("BERLAND")){
                            left++;
                            right++;
                            ber.score++;
                            other.miss++;
                            other.score++;
                            ber.miss++;
                            Arrays.sort(data);
                        }
                    }
                    break;
                }
            }
            out.println(left + ":" + right);

        }
        // System.out.println(second.point);

        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static Pair cal(ArrayList<Integer>[] map, HashSet<Integer> result, HashSet<Pair> check, int pa, int node) {
        boolean taken = false;
        if (check.contains(new Pair(pa, node)) || check.contains(new Pair(node, pa))) {
            taken = true;
        }
        boolean leaf = true;

        ArrayList<Integer> list = new ArrayList();
        Pair store = null;
        for (int next : map[node]) {
            if (next != pa) {
                leaf = false;

                Pair p = cal(map, result, check, node, next);
                if (p.y == 1) {
                    store = p;
                    taken = false;

                } else {
                    if (store == null) {
                        store = p;
                    }
                }
            }
        }
        if (leaf) {
            if (taken) {
                result.add(node);
                return new Pair(node, 1);
            } else {
                return new Pair(node, 0);
            }
        }
        if (taken) {
            result.add(store.x);
            return new Pair(store.x, 1);
        }
        return store;

    }

    public static class Pair {

        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair other = (Pair) o;
                return x == other.x && y == other.y;
            }
            return false;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 29 * hash + this.x;
            hash = 29 * hash + this.y;
            return hash;
        }
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            d = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);

    }

    static class Line {

        double a, b, c;

        Line(double x1, double y1, double x2, double y2) {
            if (Math.abs(x1 - x2) < Epsilon && Math.abs(y1 - y2) < Epsilon) {
                throw new RuntimeException("Two point are the same");
            }
            a = y1 - y2;
            b = x2 - x1;
            c = -a * x1 - b * y1;
        }

        Line(Point x, Point y) {
            this(x.x, x.y, y.x, y.y);
        }

        public Line perpendicular(Point p) {
            return new Line(p, new Point(p.x + a, p.y + b));
        }

        public Point intersect(Line l) {
            double d = a * l.b - b * l.a;
            if (d == 0) {
                throw new RuntimeException("Two lines are parallel");
            }

            return new Point((l.c * b - c * l.b) / d, (l.a * c - l.c * a) / d);
        }
    }

    static void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {
        for (int i = 0; i < 4; i++) {
            int m = (i + index) % 4;
            int j = (i + 1 + index) % 4;
            Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));
            if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {
                Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);
                p.add(add(val, a));
                // System.out.println(a + " " + b + " " + rec[i] + " " + rec[j]);
                // System.out.println(add(val, a));
            }
        }
    }

    static Point intersect(Point a, Point b, Point c) {
        double D = cross(a, b);
        if (D != 0) {
            return new Point(cross(c, b) / D, cross(a, c) / D);
        }
        return null;
    }

    static Point convert(Point a, double angle) {
        double x = a.x * cos(angle) - a.y * sin(angle);
        double y = a.x * sin(angle) + a.y * cos(angle);
        return new Point(x, y);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;

    }

    static class Point {

        double x, y;

        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.util.*;
public class Main {

    class C implements Comparable<C>{
        String name;
        int score, diff,goal,match;
        public C(String name, int score, int diff, int goal, int match) {
            this.name = name;
            this.score = score;
            this.diff = diff;
            this.goal = goal;
            this.match = match;
        }
        public int compareTo(C o) {
            if(this.score < o.score) return 1;
            if(this.score > o.score) return -1;
            if(this.diff < o.diff) return 1;
            if(this.diff > o.diff) return -1;
            if(this.goal < o.goal) return 1;
            if(this.goal > o.goal) return -1;
            int res = this.name.compareTo(o.name);
            return res;
        }
        @Override
        public String toString() {
            return "C [name=" + name + ", score=" + score + ", diff=" + diff
                    + ", goal=" + goal + ", match=" + match + "]";
        }

    }

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            HashMap<String,Integer>map = new HashMap<String,Integer>();
            C [] data = new C[4];
            for(int i = 0; i < 5;i++){
                String line = sc.nextLine();
                String [] linearr = line.split(" |:");
                int id1 = -1, id2 = -1;
                if(map.containsKey(linearr[0])){
                    id1 = map.get(linearr[0]);
                }
                else{
                    int res = map.size();
                    id1 = res;
                    map.put(linearr[0], res);
                    data[id1] = new C(linearr[0], 0,0,0,0);
                }
                if(map.containsKey(linearr[1])){
                    id2 = map.get(linearr[1]);
                }
                else{
                    int res = map.size();
                    id2 = res;
                    map.put(linearr[1], res);
                    data[id2] = new C(linearr[1], 0,0,0,0);
                }
                //score
                int goal1 = Integer.parseInt(linearr[2]);
                int goal2 = Integer.parseInt(linearr[3]);
                if(goal1 > goal2){
                    data[id1].score += 3;
                }
                else if(goal1 < goal2){
                    data[id2].score += 3;
                }
                else{
                    data[id1].score++;
                    data[id2].score++;
                }
                //diff
                data[id1].diff += goal1 - goal2;
                data[id2].diff += goal2 - goal1;
                //goal
                data[id1].goal += goal1;
                data[id2].goal += goal2;
                //match
                data[id1].match++;
                data[id2].match++;
            }
            Arrays.sort(data);
            //find a myteam
            int myid = -1,op = -1;
            for(int i = 0; i < 4; i++){
                if(data[i].name.equals("BERLAND")){
                    myid = i;
                    break;
                }
            }
            for(int i=0; i < 4; i++){
                if(i == myid) continue;
                if(data[i].match == 2){
                    op = i;
                    break;
                }
            }

            if(myid == 0 || myid == 1){
                System.out.println("1:0");
            }
            else{
                boolean flg = false;
                C [] work = new C[4];
                int ansx = -1, ansy = -1;
                for(int diff = 0; diff < 100; diff++){
                    for(int x = diff; x < 100; x++){
                        for(int i = 0; i < 4; i++){
                            work[i] = new C(data[i].name, 0,0,0,0);
                            work[i].diff = data[i].diff;
                            work[i].goal = data[i].goal;
                            work[i].match = data[i].match;
                            work[i].score = data[i].score;
                        }
                        int y = x - diff;
                        if(diff == 0){
                            work[myid].score += 1;
                            work[op].score += 1;
                        }
                        else{
                            work[myid].score += 3;
                        }
                        work[myid].diff += x - y;
                        work[op].diff += y - x;
                        work[myid].goal += x;
                        work[op].goal += y;
                        Arrays.sort(work);
                        if(work[0].name.equals("BERLAND") || work[1].name.equals("BERLAND")){
                            ansx = x;
                            ansy = y;
                            flg = true;
                            break;
                        }
                    }
                    if(flg)break;
                }
                if(flg){
                    System.out.println(ansx + ":" + ansy);
                }
                else{
                    System.out.println("IMPOSSIBLE");
                }
            }
        }
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.io.*;
import java.util.*;

public class Main {

   static class Assertion {
      static void check(boolean e) {
         if (!e) {
            throw new Error();
         }
      }
   }

   // class Scanner {
   // StreamTokenizer in;
   //
   // Scanner(InputStream s) {
   // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(s)));
   // in.resetSyntax();
   // in.whitespaceChars(0, 32);
   // in.wordChars(33, 255);
   // }
   //
   // String next() {
   // try {
   // in.nextToken();
   // return in.sval;
   // } catch (Exception e) {
   // throw new Error();
   // }
   // }
   //
   // int nextInt() {
   // return Integer.parseInt(next());
   // }
   //
   // long nextLong() {
   // return Long.parseLong(next());
   // }
   //
   // double nextDobule() {
   // return Double.parseDouble(next());
   // }
   // }

   Scanner in;
   PrintWriter out;

   class Team implements Comparable<Team> {
      int nGoals;
      int nleaves;
      String name;
      int nPoints;

      public Team(String name) {
         this.name = name;
      }

      @Override
      public int compareTo(Team second) {
         if (this.nPoints != second.nPoints) {
            return this.nPoints - second.nPoints;
         } else if (this.nGoals - this.nleaves != second.nGoals - second.nleaves) {
            return (this.nGoals - this.nleaves) - (second.nGoals - second.nleaves);
         } else if (this.nGoals != second.nGoals) {
            return this.nGoals - second.nGoals;
         } else {
            return -this.name.compareTo(second.name);

         }
      }
   }

   void solve() {
      TreeMap<String, Team> teams = new TreeMap<String, Main.Team>();
      for (int i = 0; i < 5; i++) {
         String first = in.next();
         String second = in.next();
         if (!teams.containsKey(first)) {
            teams.put(first, new Team(first));
         }
         if (!teams.containsKey(second)) {
            teams.put(second, new Team(second));
         }
         Team fTeam = teams.get(first);
         Team sTeam = teams.get(second);
         String score = in.next();
         int fTeamGoals = Integer.parseInt(score.substring(0, 1));
         int sTeamGoals = Integer.parseInt(score.substring(2, 3));
         if (fTeamGoals == sTeamGoals) {
            fTeam.nPoints++;
            fTeam.nGoals++;
            fTeam.nleaves++;
            sTeam.nPoints++;
            sTeam.nGoals++;
            sTeam.nleaves++;
         } else if (fTeamGoals > sTeamGoals) {
            fTeam.nPoints += 3;
            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;

            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;
         } else {
            sTeam.nPoints += 3;
            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;

            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;
         }
         teams.put(first, fTeam);
         teams.put(second, sTeam);
      }
      String berTeamSt = "BERLAND";
      Team berTeam = teams.get(berTeamSt);
      ArrayList<Team> teamList = new ArrayList<Main.Team>();
      for (String teamSt : teams.keySet()) {
         teamList.add(teams.get(teamSt));
      }
      Team fTeam = berTeam;
      ArrayList<Team> teamBackUp = copy(teamList);
      boolean found = false;
      int bestNGoals = 0;
      int bestNLeaves = 100;
      for (Team sTeam : teamList) {
         if (!sTeam.name.equals(berTeam.name)) {
            for (int nG = 1; nG < 40; nG++) {
               for (int nL = 0; nL < nG; nL++) {
                  int fTeamGoals = nG;
                  int sTeamGoals = nL;
                  int tt = 0;
                  if (fTeamGoals == sTeamGoals) {
                     berTeam.nPoints++;
                     berTeam.nGoals++;
                     berTeam.nleaves++;
                     sTeam.nPoints++;
                     sTeam.nGoals++;
                     sTeam.nleaves++;
                     tt = 1;
                  } else if (fTeamGoals > sTeamGoals) {
                     fTeam.nPoints += 3;
                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;

                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;
                     tt = 2;
                  } else {
                     sTeam.nPoints += 3;
                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;

                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;
                     tt = 3;
                  }
                  Collections.sort(teamBackUp);
                  if (teamBackUp.get(2).name.equals(berTeamSt) || teamBackUp.get(3).name.equals(berTeamSt)) {
                     found = true;
                     if (nG - nL < bestNGoals - bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     } else if (nL < bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                  }
                  if (tt == 1) {
                     berTeam.nPoints--;
                     berTeam.nGoals--;
                     berTeam.nleaves--;
                     sTeam.nPoints--;
                     sTeam.nGoals--;
                     sTeam.nleaves--;
                  } else if (tt == 2) {
                     fTeam.nPoints -= 3;
                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;

                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;
                  } else if (tt == 3) {
                     sTeam.nPoints -= 3;
                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;

                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;
                  }
               }
            }
         }
      }
      if (found) {
         out.print(bestNGoals + ":" + bestNLeaves);
      } else {
         out.println("IMPOSSIBLE");
      }
   }

   ArrayList<Team> copy(ArrayList<Team> from) {
      ArrayList<Team> copyList = new ArrayList<Main.Team>();
      for (Team team : from) {
         copyList.add(team);
      }
      return copyList;
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();
   }
}

import java.io.*;
import java.util.*;

public class Main {
    class Team implements Comparable< Team > {
        int scored, missed;
        String name;
        int points;

        public Team( int s, int m, String n, int p ) {
            scored = s;
            missed = m;
            name = n;
            points = p;

        }

        public String toString( ) { return name + " " + points + " " + scored + " " + missed; }
        public int compareTo( Team t ) {
            if ( t.points != points ) {
                return -points + t.points;
            }
            if ( ( scored - missed ) != ( t.scored - t.missed ) ) {
                return -( scored - missed ) + ( t.scored - t.missed ) ;
            }
            if ( scored != t.scored ) {
                return -scored + t.scored;
            }
            return name.compareTo( t.name );
        }
    }

    public void solve( ) throws Throwable {
        Map< String, Team > names = new HashMap< String, Team >( );
        Map< String, Integer > played = new HashMap< String, Integer >( );
        for ( int i = 0; i < 5; ++i ) {
            StringTokenizer st = new StringTokenizer( in.nextLine( ), ": " );
            String f = st.nextToken( ), s = st.nextToken( );
            int nf = Integer.parseInt( st.nextToken( ) ), ns = Integer.parseInt( st.nextToken( ) );
            Team get1 = names.get( f );
            Integer t1 = played.get( f );
            if ( get1 == null ) {
                get1 =  new Team( 0, 0, f, 0 ) ;
                t1 = 0;
            }
            Team get2 = names.get( s );
            Integer t2 = played.get( s );
            if ( get2 == null ) {
                get2 = new Team( 0, 0, s, 0 );
                t2 = 0;
            }
            if ( nf == ns ) {
                get1.points++;
                get2.points++;
            } else {
                if ( nf > ns ) {
                    get1.points += 3;
                } else {
                    get2.points += 3;
                }
            }
            get1.scored += nf;
            get1.missed += ns;

            get2.scored += ns;
            get2.missed += nf;

            names.put( f, get1 );
            names.put( s, get2 );

            played.put( f, t1 + 1 );
            played.put( s, t2 + 1 );
        }

        PriorityQueue< Team > pq = new PriorityQueue< Team >( );
        for ( String t : names.keySet( ) ) {
            pq.add( names.get( t ) );
        }

        //debug( pq );
        for ( String s : played.keySet( ) ) {
            if ( !s.equals( "BERLAND" ) && played.get( s ) == 2 ) {
                Team t1 = names.get( "BERLAND" ), t2 = names.get( s );
                for ( int y = 0; y < 200; ++y ) {
                    pq.remove( t2 );
                    t2.scored += y;
                    for ( int x = y + 1 ;x < 200; ++x ) {
                        pq.remove( t1 );
                        t1.points += 3;
                        t1.scored += x;
                        t1.missed += y;

                        t2.missed += x;
                        pq.add( t2 );

                        pq.add( t1 );

                        //debug( x, y, pq );

                        Team first = pq.poll(  ), second = pq.poll(  );

                        if ( first.name.equals( "BERLAND" ) || second.name.equals( "BERLAND" ) ) {
                            out.println( x + ":" + y );
                            return;
                        }
                        pq.add( first );
                        pq.add( second );

                        t2.missed -= x;
                        pq.remove( t2 );

                        pq.remove( t1 );
                        t1.missed -= y;
                        t1.scored -= x;
                        t1.points -= 3;
                        pq.add( t1 );
                    }
                    t2.scored -= y;
                    pq.add( t2 );
                }
            }
        }
        out.println( "IMPOSSIBLE" );
    }

    public void run( ) {
        in = new FastScanner( System.in );
        out = new PrintWriter( new PrintStream( System.out ), true );

        try {
            solve( );
            out.close( );
            System.exit( 0 );
        } catch( Throwable e ) {
            e.printStackTrace( );
            System.exit( -1 );
        }
    }

    public void debug( Object...os ) {
        System.err.println( Arrays.deepToString( os ) );
    }

    public static void main( String[ ] args ) {
        ( new Main( ) ).run( );
    }

    private FastScanner in;
    private PrintWriter out;

    private static class FastScanner {
        private int charsRead;
        private int currentRead;
        private byte buffer[ ] = new byte[ 0x1000 ];
        private InputStream reader;

        public FastScanner( InputStream in ) {
            reader = in;
        }

        public int read( ) {
            if ( charsRead == -1 ) {
                throw  new InputMismatchException( );
            }

            if ( currentRead >= charsRead ) {
                currentRead = 0;
                try {
                    charsRead = reader.read( buffer );

                } catch( IOException e ) {
                    throw new InputMismatchException(  );
                }

                if ( charsRead <= 0 ) {
                    return -1;
                }
            }

            return buffer[ currentRead++ ];
        }

        public int nextInt( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public long nextLong( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            long ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public boolean isWhitespace( int c ) {
            return  c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;
        }

        public String next( ) {
            int c = read( );
            StringBuffer ans = new StringBuffer( );

            while ( isWhitespace( c ) && c != -1 ) {
                c  = read( );
            }

            if ( c == -1 ) {
                return null;
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public String nextLine( ) {
            String ans = nextLine0( );

            while ( ans.trim( ).length( ) == 0 ) {
                ans = nextLine0( );
            }

            return ans;
        }

        private String nextLine0( ) {
            int c = read( );
            if ( c == -1 ) {
                return null;
            }
            StringBuffer ans = new StringBuffer( );
            while ( c != '\n' && c != '\r' && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public double nextDouble( ) {
            int c = read( );
            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '.' && c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( c == '-' ) {
                c = read( );
            }
            double ans = 0;
            while ( c != -1 && c != '.' && !isWhitespace( c ) ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }

                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            if ( !isWhitespace( c ) && c != -1 && c != '.' ) {
                throw new InputMismatchException( );
            }

            double pow10 = 1.0;

            if ( c == '.' ) {
                c = read( );
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                pow10 *= 10.0;

                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            return ans * sign / pow10;
        }
    }

}

import java.io.FileNotFoundException;
import java.util.*;

import static java.lang.System.out;

public class Main {
    private static void debug(Object...os) {
        out.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) throws FileNotFoundException {
        Scanner cin = new Scanner(System.in);
        Map<String, Integer> occurrence = new HashMap<String, Integer>();
        Set<String> names = new HashSet<String>();
        String[] scoreBoard = new String[5];
        for (int i = 0; i < 5; ++i) {
            scoreBoard[i] = cin.nextLine();
            String[] parts = scoreBoard[i].split(" ");
            Integer value = occurrence.get(parts[0]);
            if (value == null)
                occurrence.put(parts[0], 1);
            else
                occurrence.put(parts[0], value + 1);
            value = occurrence.get(parts[1]);
            if (value == null)
                occurrence.put(parts[1], 1);
            else
                occurrence.put(parts[1], value + 1);
            names.add(parts[0]);
            names.add(parts[1]);
        }
        Team[] teams = new Team[names.size()];
        int index = 0;
        for (String name : names) {
            teams[index++] = new Team(name);
        }
        for (int i = 0; i < scoreBoard.length; ++i) {
            String[] parts = scoreBoard[i].split(" ");
            int teamOneIndex = getIndex(teams, parts[0]);
            int teamTwoIndex = getIndex(teams, parts[1]);
            int teamOneGoals = parts[2].charAt(0) - '0';
            int teamTwoGoals = parts[2].charAt(2) - '0';
            teams[teamOneIndex].outGoals += teamOneGoals;
            teams[teamTwoIndex].inMeGoals += teamOneGoals;
            teams[teamOneIndex].inMeGoals += teamTwoGoals;
            teams[teamTwoIndex].outGoals += teamTwoGoals;
            if (teamOneGoals > teamTwoGoals) {
                teams[teamOneIndex].points += 3;
            } else if (teamTwoGoals > teamOneGoals) {
                teams[teamTwoIndex].points += 3;
            } else {
                ++teams[teamOneIndex].points;
                ++teams[teamTwoIndex].points;
            }
        }
        String secondTeamName = "";
        for (Map.Entry<String, Integer> entry : occurrence.entrySet())
            if (!entry.getKey().equals("BERLAND") && entry.getValue() == 2) {
                secondTeamName = entry.getKey();
                break;
            }
        int teamOneIndex = getIndex(teams, "BERLAND");
        int teamTwoIndex = getIndex(teams, secondTeamName);
        int resX = -1;
        int resY = -1;
        for (int x = 0; x <= 1000; ++x) {
            for (int y = x - 1; y >= 0; --y) {
                Team oneTemp = new Team(teams[teamOneIndex].name, teams[teamOneIndex].points, teams[teamOneIndex].outGoals, teams[teamOneIndex].inMeGoals);
                Team twoTemp = new Team(teams[teamTwoIndex].name, teams[teamTwoIndex].points, teams[teamTwoIndex].outGoals, teams[teamTwoIndex].inMeGoals);
                teams[teamOneIndex].outGoals += x;
                teams[teamTwoIndex].inMeGoals += x;
                teams[teamOneIndex].inMeGoals += y;
                teams[teamTwoIndex].outGoals += y;
                teams[teamOneIndex].points += 3;
                Arrays.sort(teams);
                if (teams[0].name.equals("BERLAND") || teams[1].name.equals("BERLAND")) {
                    resX = x;
                    resY = y;
                    break;
                }
                teamOneIndex = getIndex(teams, "BERLAND");
                teamTwoIndex = getIndex(teams, secondTeamName);
                teams[teamOneIndex].name = oneTemp.name;
                teams[teamOneIndex].inMeGoals = oneTemp.inMeGoals;
                teams[teamOneIndex].outGoals = oneTemp.outGoals;
                teams[teamOneIndex].points = oneTemp.points;
                teams[teamTwoIndex].name = twoTemp.name;
                teams[teamTwoIndex].inMeGoals = twoTemp.inMeGoals;
                teams[teamTwoIndex].outGoals = twoTemp.outGoals;
                teams[teamTwoIndex].points = twoTemp.points;
            }
            if (resX != -1) break;
        }
        if (resX == -1)
            out.println("IMPOSSIBLE");
        else
            out.printf("%d:%d\n", resX, resY);
    }

    private static void printTeams(Team[] teams) {
        for (Team team : teams)
            debug(team.name, team.points, team.outGoals, team.inMeGoals, team.outGoals - team.inMeGoals);
    }

    private static int getIndex(Team[] teams, String teamName) {
        for (int i = 0; i < teams.length; ++i)
            if (teams[i].name.equals(teamName))
                return i;
        return -1;
    }

    static class Team implements Comparable<Team> {
        String name;
        int inMeGoals;
        int outGoals;
        int points;

        Team(String name) {
            this.name = name;
            this.inMeGoals = 0;
            this.outGoals = 0;
            this.points = 0;
        }

        Team(String name, int points, int outGoals, int inGoals) {
            this.name = name;
            this.points = points;
            this.outGoals = outGoals;
            this.inMeGoals = inGoals;
        }

        public int compareTo(Team team) {
            if (team.points != points)
                return team.points - points;
            int teamDiff = Math.abs(team.outGoals - team.inMeGoals);
            int thisDiff = Math.abs(outGoals - inMeGoals);
            if (teamDiff != thisDiff)
                return thisDiff - teamDiff;
            if (team.outGoals != outGoals)
                return team.outGoals - outGoals;
            return name.compareTo(team.name);
        }
    }
}

import java.io.*;
import java.rmi.server.UID;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Q200C implements Runnable {
    Map<String, Data> table = new HashMap<String, Data>();
    static String BERLAND = "BERLAND";
    private void solve() throws IOException {
        //solve

        for (int i = 0; i < 5; i++) {
            String t1 = nextToken();
            String t2 = nextToken();
            String score = nextToken();
            int s1 = Integer.parseInt(score.substring(0, score.indexOf(":")));
            int s2 = Integer.parseInt(score.substring(score.indexOf(":") + 1));
            addRes(t1, t2, s1, s2);
        }
        Data[] t = new Data[4];
        int i = 1;
        int other =0;
        t[0]=table.remove(BERLAND);
        for (Data d : table.values()) {
            t[i++] = d;
            if(d.games==2)other = i-1;
        }

        int x1=-1;
        int x2=-1;
        t[0].points+=3;
        for (int s1 = 1; s1 < 50; s1++) {
            for (int s2 = 0; s2 < s1; s2++) {
                int betterThen=0;
                t[0].s+=s1;
                t[0].m+=s2;
                t[other].s+=s2;
                t[other].m+=s1;

                for (int j = 0; j < 3; j++) {
                    if(t[0].compareTo(t[1+j])>0)betterThen++;
                }
                t[0].s-=s1;
                t[0].m-=s2;
                t[other].s-=s2;
                t[other].m-=s1;

                if(betterThen>=2 && (x1==-1 || (s1-s2)<(x1-x2) || ((s1-s2)==(x1-x2) && s2<x2))){
                    x1=s1;x2=s2;
                }
            }
        }

        if(x1==-1)writer.println("IMPOSSIBLE");
        else{
            writer.println(x1+":"+x2);
        }
    }

    private void addRes(String t1, String t2, int s1, int s2) {
        if (!table.containsKey(t1)) {
            table.put(t1, new Data(t1));
        }
        if (!table.containsKey(t2)) {
            table.put(t2, new Data(t2));
        }

        Data d1 = table.get(t1);
        Data d2 = table.get(t2);
        d1.s += s1;
        d1.m += s2;
        d2.s += s2;
        d2.m += s1;
        d1.points += s1 > s2 ? 3 : s1 == s2 ? 1 : 0;
        d2.points += s2 > s1 ? 3 : s2 == s1 ? 1 : 0;

        d1.games++;
        d2.games++;
    }

    private static class Data implements Comparable<Data>{
        int games;
        String name;
        int points;
        int s;
        int m;

        public Data(String t1) {
            name = t1;
        }

        public int compareTo(Data o) {
            if(points>o.points)return 1;
            else if(points<o.points)return -1;
            else{
                if(s-m>o.s-o.m)return 1;
                else if(s-m<o.s-o.m)return -1;
                else{
                    if(s>o.s)return 1;
                    else if(s<o.s)return -1;
                    else{
                        return name.compareTo(o.name);
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        new Q200C().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            boolean oj = System.getProperty("ONLINE_JUDGE") != null;
            reader = oj ? new BufferedReader(new InputStreamReader(System.in)) :
                    new BufferedReader(new FileReader(new File("input.txt")));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            long start = System.currentTimeMillis();
            solve();
            reader.close();
            if (!oj) writer.print("\nTime: " + (System.currentTimeMillis() - start) + "\n");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

import java.util.*;

public class C {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Map<String, Integer> X = new HashMap<String, Integer>();
		int ber = -1;
		final int[] points = new int[5];
		final int[] scored = new int[5];
		final int[] let_in = new int[5];
		final int[] count = new int[5];
		final String[] names = new String[5];
		for(int i=0; i<5; i++) {
			String t1 = in.next();
			String t2 = in.next();
			String[] scores = in.next().split(":");

			if(!X.containsKey(t1)) X.put(t1, X.size());
			if(!X.containsKey(t2)) X.put(t2, X.size());
			int x1 = X.get(t1);
			int x2 = X.get(t2);
			names[x1] = t1;
			names[x2] = t2;
			if(t1.equals("BERLAND")) ber = x1;
			if(t2.equals("BERLAND")) ber = x2;
			int s1 = Integer.parseInt(scores[0]);
			int s2 = Integer.parseInt(scores[1]);

			count[x1]++; count[x2]++;
			if(s1 > s2) { points[x1]+=3; }
			else if(s1 == s2) { points[x1]++; points[x2]++; }
			else { points[x2]++; }
			scored[x1] += s1; scored[x2]+=s2;
			let_in[x1] += s2; let_in[x2]+=s1;
		}
		int opp = -1;
		for(int i=0; i<5; i++)
			if(count[i]==2 && i!=ber)
				opp = i;

		int best_x = 10000;
		int best_y = 0;
		points[ber]+=3;
		for(int x=0; x<100; x++)
			for(int y=0; y<100; y++) {
				if(x <= y) continue;
				scored[ber] += x; scored[opp] += y;
				let_in[ber] += y; let_in[opp] += x;

				Integer[] sort = new Integer[5];
				for(int i=0; i<5; i++) sort[i] = i;
				Arrays.sort(sort, new Comparator<Integer>() {
					public int compare(Integer A, Integer B) {
						if(points[A] > points[B]) return 1;
						if(points[A] < points[B]) return -1;

						int s1 = scored[A]-let_in[A];
						int s2 = scored[B]-let_in[B];
						if(s1 > s2) return 1;
						if(s1 < s2) return -1;

						if(scored[A] > scored[B]) return 1;
						if(scored[A] < scored[B]) return -1;

						return -names[A].compareTo(names[B]);
					}
				});
				if(ber == sort[4] || ber==sort[3]) { // OK
					int diff = x-y;
					int best_diff = best_x-best_y;
					if(diff < best_diff || (diff==best_diff && y < best_y)) {
						best_x = x;
						best_y = y;
					}
				}

				scored[ber]-=x; scored[opp]-=y;
				let_in[ber]-=y; let_in[opp]-=x;
			}

		if(best_x == 10000 && best_y==0)
			System.out.println("IMPOSSIBLE");
		else System.out.println(best_x+":"+best_y);

		/*
		int more = 0;
		for(int i=0; i<5; i++)
			if(i != ber && points[i]>points[ber])
				more++;
		if(more >= 2) { System.out.println("IMPOSSIBLE"); return; }

		List<Integer> diff = new ArrayList<Integer>();
		int ix = 0;
		for(int i=0; i<5; i++)
			if(points[i]==points[ber] && i!=ber)
				diff.add(scored[i]-let_in[i]);
		Collections.sort(diff);

		int need = more==1 ? diff.get(diff.size()-1) : diff.get(diff.size()-2);
		int diff_needed = need - (scored[ber]-let_in[ber]);

		if(more == 0 && diff.get(
		*/
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class First
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class Team
{
    String teamName;
    int score;
    int goalFor;
    int goalAgainst;
    int matchPlayed;

    public Team(String teamName, int score, int goalFor, int goalAgainst, int matchPlayed)
    {
        super();
        this.teamName = teamName;
        this.score = score;
        this.goalFor = goalFor;
        this.goalAgainst = goalAgainst;
        this.matchPlayed = matchPlayed;
    }
}

class MyComparator implements Comparator<Team>
{
    @Override
    public int compare(Team t1, Team t2)
    {

        if(t1.score < t2.score) return 1;
        if(t1.score > t2.score) return -1;
        if(t1.goalFor - t1.goalAgainst < t2.goalFor - t2.goalAgainst) return 1;
        if(t1.goalFor - t1.goalAgainst > t2.goalFor - t2.goalAgainst) return -1;
        if(t1.goalFor < t2.goalFor) return 1;
        if(t1.goalFor > t2.goalFor) return -1;
        return t1.teamName.compareTo(t2.teamName);
    }
}

class TaskA
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        Set <String> hset = new HashSet <String> ();
        String[] inputStr = new String[5];
        for(int i = 0; i < 5; i++)
        {
            inputStr[i] = in.nextLine();
        }

        Team[] team = new Team[4];
        for(int i = 0; i < 5; i++)
        {
            String str = inputStr[i];
            str = str.replace(":", " ");
            String[] ans = str.split("[ ]+");
            hset.add(ans[0]); hset.add(ans[1]);
        }
        int index = 0;
        for(String str : hset)
        {
            int myScore = 0;
            int myGoalFor = 0;
            int myGoalAgainst = 0;
            int matchPlayed = 0;
            for(int i = 0; i < 5; i++)
            {
                String current = inputStr[i];
                current = current.replace(":", " ");
                String[] ans = current.split("[ ]+");
                String firstTeam = ans[0];
                String secondTeam = ans[1];
                int firstScoreGoal = Integer.parseInt(ans[2]);
                int secondScoreGoal = Integer.parseInt(ans[3]);

                if(firstTeam.equals(str))
                {
                    myGoalFor += firstScoreGoal;
                    myGoalAgainst += secondScoreGoal;
                    if(firstScoreGoal > secondScoreGoal)
                    {
                        myScore += 3;
                    }
                    if(firstScoreGoal == secondScoreGoal)
                        myScore++;
                    matchPlayed++;
                }
                if(secondTeam.equals(str))
                {
                    myGoalFor += secondScoreGoal;
                    myGoalAgainst += firstScoreGoal;
                    if(secondScoreGoal > firstScoreGoal) myScore += 3;
                    if(secondScoreGoal == firstScoreGoal) myScore++;
                    matchPlayed++;
                }
            }
            team[index++] = new Team(str, myScore, myGoalFor, myGoalAgainst, matchPlayed);
        }
        Arrays.sort(team, new MyComparator());

        index = 0; int i = 0;
        for(Team item : team)
        {   if(item.teamName.equals("BERLAND"))
                index = i;
            i++;
            //System.out.println(item.teamName + " " + item.score + "  " + item.goalFor + "  " + item.goalAgainst + " " + item.matchPlayed);
        }
        if(team[0].teamName.equals("BERLAND") || team[1].teamName.equals("BERLAND"))
            out.println("1:0:");

        else
        {
            String secondTeamName = team[1].teamName;
            int secondScore = team[1].score;
            int secondGoalFor = team[1].goalFor;
            int secondGoalAgainst = team[1].goalAgainst;
            int differenceSecond = secondGoalFor - secondGoalAgainst;

            int berlandScore = team[index].score;
            int berlandGoalFor = team[index].goalFor;
            int berlandGoalAgainst = team[index].goalAgainst;
            int differenceBerland = berlandGoalFor - berlandGoalAgainst;
            if(secondScore <= berlandScore + 2)
            {
                out.println("1:0");
            }
            else if (secondScore > berlandScore + 3)
            {
                out.println("IMPOSSIBLE");
            }
            else
            {
                int kk = 0;
                for(int k = 1; k < 4; k++)
                {
                    if(team[k].teamName.equals("BERLAND") == false && team[k].matchPlayed == 2)
                    {
                        kk = k;
                        break;
                    }
                }
                Team[] tempTeam = new Team[4];

                for(int goals = 1; ; goals++)
                {
                    for(int step = 0; step < 4; step++)
                    {
                        tempTeam[step] = new Team(team[step].teamName, team[step].score, team[step].goalFor , team[step].goalAgainst, team[step].matchPlayed);
                    }

                    tempTeam[index].score += 3;
                    tempTeam[index].goalFor += goals;

                    tempTeam[kk].goalAgainst += goals;

                    Arrays.sort(tempTeam, new MyComparator());
                    if(tempTeam[0].teamName.equals("BERLAND") || tempTeam[1].teamName.equals("BERLAND"))
                    {
                        out.println(goals + ":0");
                        break;
                    }
                }
            }
        }
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next()
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
        {
            try
            {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public String nextLine()
    {
        String inputLine = "";
        try
        {
            inputLine = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return inputLine;
    }
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class FootballChampionship200C {
	private static final String B_TEAM_NAME = "BERLAND";
	private static final int MAX_GOAL = 100;

	public static void main(String[] args) {
		String[] teams = new String[4];
		int[] goals = new int[4];
		int[] misses = new int[4];
		int[] scores = new int[4];
		int[] matches = new int[4];
		HashMap<String, Integer> teamMap = new HashMap<String, Integer>();
		Scanner in = new Scanner(System.in);
		int index = 0;
		for (int i = 0; i < 5; i++) {
			String team1 = in.next();
			if (teamMap.get(team1) == null) {
				teamMap.put(team1, index);
				teams[index++] = team1;
			}
			String team2 = in.next();
			if (teamMap.get(team2) == null) {
				teamMap.put(team2, index);
				teams[index++] = team2;
			}
			String score = in.next();
			int g1 = Integer.parseInt(score.substring(0, 1));
			int g2 = Integer.parseInt(score.substring(2));
			int t1 = teamMap.get(team1);
			int t2 = teamMap.get(team2);
			goals[t1] += g1;
			misses[t2] += g1;
			goals[t2] += g2;
			misses[t1] += g2;
			if (g1 == g2) {
				scores[t1]++;
				scores[t2]++;
			} else if (g1 > g2) {
				scores[t1] += 3;
			} else {
				scores[t2] += 3;
			}
			matches[t1]++;
			matches[t2]++;
		}
		int tb = teamMap.get("BERLAND");
		int to = 0;
		for (int i = 0; i < 4; i++)
			if (matches[i] != 3 && i != tb)
				to = i;
		int rx = -1, ry = -1;
		for (int x = 0; x <= MAX_GOAL; x++)
			for (int y = 0; y <= MAX_GOAL; y++) {
				int[] gs = goals.clone();
				int[] ms = misses.clone();
				int[] ss = scores.clone();
				gs[tb] += x;
				ms[to] += x;
				gs[to] += y;
				ms[tb] += y;
				if (x == y) {
					ss[tb]++;
					ss[to]++;
				} else if (x > y)
					ss[tb] += 3;
				else
					ss[to] += 3;
				if (satisfied(gs, ms, ss, teams, tb)) {
					if (rx == -1) {
						rx = x;
						ry = y;
					} else if (x - y < rx - ry) {
						rx = x;
						ry = y;
					} else if (x - y == rx - ry && y < ry) {
						rx = x;
						ry = y;
					}
				}
			}
		if (rx != -1 && ry != -1) {
			System.out.printf("%d:%d\n", rx, ry);
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	private static boolean satisfied(int[] gs, int[] ms, int[] ss, String[] ts,
			int tb) {
		Team[] teams = new Team[4];
		for (int i = 0; i < 4; i++) {
			Team t = new Team();
			t.id = i;
			t.goal = gs[i];
			t.miss = ms[i];
			t.score = ss[i];
			t.name = ts[i];
			teams[i] = t;
		}
		Arrays.sort(teams);
		if (teams[0].name.equalsIgnoreCase(B_TEAM_NAME)
				|| teams[1].name.equalsIgnoreCase(B_TEAM_NAME))
			return true;
		else
			return false;
	}

	static class Team implements Comparable<Team> {
		int goal, miss, score, id;
		String name;

		private int diff() {
			return goal - miss;
		}

		@Override
		public int compareTo(Team other) {
			if (this.score > other.score)
				return -1;
			if (this.score < other.score)
				return 1;
			if (this.diff() > other.diff())
				return -1;
			if (this.diff() < other.diff())
				return 1;
			if (this.goal > other.goal)
				return -1;
			if (this.goal < other.goal)
				return 1;
			if (this.name.compareTo(other.name) < 0)
				return -1;
			if (this.name.compareTo(other.name) > 0)
				return 1;
			return 0;
		}
	}
}

import java.io.*;
import java.util.*;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class Code implements Runnable {

    String in = "", out = "";
    BufferedReader reader;
    PrintWriter writer;
    StringTokenizer st;

    public static void main(String[] args) throws IOException {
        new Thread(new Code()).start();
    }

    class Pair {
        public int first, second;
        Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object obj) {
            Pair other = (Pair)obj;
            return first == other.first && second == other.second;
        }
    }

    class Team implements Comparable {
        private String name;
        private int score, difference, goals, matches;

        public Team(String name, int score, int difference, int goals) {
            this.name = name;
            this.score = score;
            this.goals = goals;
            this.difference = difference;
            this.matches = 1;
        }

        public Team(String name) {
            this.name = name;
        }

        @Override
        public int compareTo(Object other) {
            Team what = (Team)other;
            if(score != what.score) return score - what.score;
            if(difference != what.difference)   return difference - what.difference;
            if(goals != what.goals) return goals - what.goals;
            return what.name.compareTo(name);
        }

        @Override
        public boolean equals(Object other) {
            return name.equals(((Team)other).name);
        }
    }

    void solve() throws IOException {
        Map relation = new HashMap<String, Integer>();
        Team[] teams = new Team[4];
        int k = 0;
        for(int i = 0; i < 5; ++i) {
            String target1 = nextToken(), target2 = nextToken();
            StringTokenizer tokenizer = new StringTokenizer(nextToken(), ":");
            int goals1 = Integer.parseInt(tokenizer.nextToken()), goals2 = Integer.parseInt(tokenizer.nextToken()), id = 0;
            if(relation.containsKey(target1)) {
                id = (Integer)relation.get(target1);
                teams[id].score += goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals1 - goals2;
                teams[id].goals += goals1;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target1, id);
                teams[id] = new Team(target1, goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals1 - goals2, goals1);
            }

            if(relation.containsKey(target2)) {
                id = (Integer)relation.get(target2);
                teams[id].score += goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals2 - goals1;
                teams[id].goals += goals2;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target2, id);
                teams[id] = new Team(target2, goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals2 - goals1, goals2);
            }
        }

        Arrays.sort(teams);
        //for(Team team : teams)  writer.println(team.name + " " + team.score + " " + team.difference + " " + team.goals + " " + team.matches);

        int berland = 0, otherland = 0;
        for(int i = 0; i < 4; ++i) {
            if(teams[i].matches == 2)
                if(teams[i].name.equals("BERLAND")) berland = i;
                else    otherland = i;
        }

        if(berland > 1) writer.println("1:0");
        else if(teams[2].score <= teams[berland].score + 3) {
            if(teams[2].score - 3 < teams[berland].score)   writer.println("1:0");
            else    writer.println(teams[2].difference - teams[berland].difference + 1 + ":0");
        } else  writer.println("IMPOSSIBLE");
    }

    public void run() {
        try {
            if(in.equals(""))   reader = new BufferedReader(new InputStreamReader(System.in));
            else    reader = new BufferedReader(new FileReader(in));

            if(out.equals(""))  writer = new PrintWriter(new OutputStreamWriter(System.out));
            else    writer = new PrintWriter(new FileWriter(out));
            solve();
        } catch(IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
                writer.close();
            } catch(IOException e) {
                e.printStackTrace();
            }
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while(st == null || !st.hasMoreTokens())    st = new StringTokenizer(reader.readLine());
        return st.nextToken();
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[3];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        String other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = name;
                }
                data[index++] = map.get(name);
            } else {
                ber = map.get(name);
            }
        }

        // System.out.println(second.point);
        ber.point += 3;
        ber.score += 1;
        map.get(other).miss += 1;
        Arrays.sort(data);
        Score second = data[1];

        if (ber.point < second.point) {
            out.println("IMPOSSIBLE");
        } else {
            int total = 1;

            while (second.compareTo(ber) >= 0) {
                ber.score += 1;
                total++;

                map.get(other).miss += 1;

                Arrays.sort(data);
                second = data[1];

            }
            int left = 0;
            while (left + 1 < total) {

                ber.miss += 1;
                map.get(other).score += 1;

                Arrays.sort(data);
                second = data[1];

                if (second.compareTo(ber) < 0) {
                    left++;
                } else {
                    break;
                }
            }
            out.println(total + ":" + left);
        }
        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static Pair cal(ArrayList<Integer>[] map, HashSet<Integer> result, HashSet<Pair> check, int pa, int node) {
        boolean taken = false;
        if (check.contains(new Pair(pa, node)) || check.contains(new Pair(node, pa))) {
            taken = true;
        }
        boolean leaf = true;

        ArrayList<Integer> list = new ArrayList();
        Pair store = null;
        for (int next : map[node]) {
            if (next != pa) {
                leaf = false;

                Pair p = cal(map, result, check, node, next);
                if (p.y == 1) {
                    store = p;
                    taken = false;

                } else {
                    if (store == null) {
                        store = p;
                    }
                }
            }
        }
        if (leaf) {
            if (taken) {
                result.add(node);
                return new Pair(node, 1);
            } else {
                return new Pair(node, 0);
            }
        }
        if (taken) {
            result.add(store.x);
            return new Pair(store.x, 1);
        }
        return store;

    }

    public static class Pair {

        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair other = (Pair) o;
                return x == other.x && y == other.y;
            }
            return false;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 29 * hash + this.x;
            hash = 29 * hash + this.y;
            return hash;
        }
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            d = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);

    }

    static class Line {

        double a, b, c;

        Line(double x1, double y1, double x2, double y2) {
            if (Math.abs(x1 - x2) < Epsilon && Math.abs(y1 - y2) < Epsilon) {
                throw new RuntimeException("Two point are the same");
            }
            a = y1 - y2;
            b = x2 - x1;
            c = -a * x1 - b * y1;
        }

        Line(Point x, Point y) {
            this(x.x, x.y, y.x, y.y);
        }

        public Line perpendicular(Point p) {
            return new Line(p, new Point(p.x + a, p.y + b));
        }

        public Point intersect(Line l) {
            double d = a * l.b - b * l.a;
            if (d == 0) {
                throw new RuntimeException("Two lines are parallel");
            }

            return new Point((l.c * b - c * l.b) / d, (l.a * c - l.c * a) / d);
        }
    }

    static void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {
        for (int i = 0; i < 4; i++) {
            int m = (i + index) % 4;
            int j = (i + 1 + index) % 4;
            Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));
            if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {
                Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);
                p.add(add(val, a));
                // System.out.println(a + " " + b + " " + rec[i] + " " + rec[j]);
                // System.out.println(add(val, a));
            }
        }
    }

    static Point intersect(Point a, Point b, Point c) {
        double D = cross(a, b);
        if (D != 0) {
            return new Point(cross(c, b) / D, cross(a, c) / D);
        }
        return null;
    }

    static Point convert(Point a, double angle) {
        double x = a.x * cos(angle) - a.y * sin(angle);
        double y = a.x * sin(angle) + a.y * cos(angle);
        return new Point(x, y);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;

    }

    static class Point {

        double x, y;

        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.FileNotFoundException;
import java.util.*;

import static java.lang.System.out;

public class Main {
    private static void debug(Object...os) {
        out.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) throws FileNotFoundException {
        Scanner cin = new Scanner(System.in);
        Map<String, Integer> occurrence = new HashMap<String, Integer>();
        Set<String> names = new HashSet<String>();
        String[] scoreBoard = new String[5];
        for (int i = 0; i < 5; ++i) {
            scoreBoard[i] = cin.nextLine();
            String[] parts = scoreBoard[i].split(" ");
            Integer value = occurrence.get(parts[0]);
            if (value == null)
                occurrence.put(parts[0], 1);
            else
                occurrence.put(parts[0], value + 1);
            value = occurrence.get(parts[1]);
            if (value == null)
                occurrence.put(parts[1], 1);
            else
                occurrence.put(parts[1], value + 1);
            names.add(parts[0]);
            names.add(parts[1]);
        }
        Team[] teams = new Team[names.size()];
        int index = 0;
        for (String name : names) {
            teams[index++] = new Team(name);
        }
        for (int i = 0; i < scoreBoard.length; ++i) {
            String[] parts = scoreBoard[i].split(" ");
            int teamOneIndex = getIndex(teams, parts[0]);
            int teamTwoIndex = getIndex(teams, parts[1]);
            int teamOneGoals = parts[2].charAt(0) - '0';
            int teamTwoGoals = parts[2].charAt(2) - '0';
            teams[teamOneIndex].outGoals += teamOneGoals;
            teams[teamTwoIndex].inMeGoals += teamOneGoals;
            teams[teamOneIndex].inMeGoals += teamTwoGoals;
            teams[teamTwoIndex].outGoals += teamTwoGoals;
            if (teamOneGoals > teamTwoGoals) {
                teams[teamOneIndex].points += 3;
            } else if (teamTwoGoals > teamOneGoals) {
                teams[teamTwoIndex].points += 3;
            } else {
                ++teams[teamOneIndex].points;
                ++teams[teamTwoIndex].points;
            }
        }
        String secondTeamName = "";
        for (Map.Entry<String, Integer> entry : occurrence.entrySet())
            if (!entry.getKey().equals("BERLAND") && entry.getValue() == 2) {
                secondTeamName = entry.getKey();
                break;
            }
        int teamOneIndex = getIndex(teams, "BERLAND");
        int teamTwoIndex = getIndex(teams, secondTeamName);
        List<Point> list = new ArrayList<Point>();
        for (int x = 0; x <= 100; ++x)
            for (int y = x - 1; y >= 0; --y) {
                Team oneTemp = new Team(teams[teamOneIndex].name, teams[teamOneIndex].points, teams[teamOneIndex].outGoals, teams[teamOneIndex].inMeGoals);
                Team twoTemp = new Team(teams[teamTwoIndex].name, teams[teamTwoIndex].points, teams[teamTwoIndex].outGoals, teams[teamTwoIndex].inMeGoals);
                teams[teamOneIndex].outGoals += x;
                teams[teamTwoIndex].inMeGoals += x;
                teams[teamOneIndex].inMeGoals += y;
                teams[teamTwoIndex].outGoals += y;
                teams[teamOneIndex].points += 3;
                Arrays.sort(teams);
                if ((teams[0].name.equals("BERLAND") || teams[1].name.equals("BERLAND"))) {
                    list.add(new Point(x, y));
                }
                teamOneIndex = getIndex(teams, "BERLAND");
                teamTwoIndex = getIndex(teams, secondTeamName);
                teams[teamOneIndex].name = oneTemp.name;
                teams[teamOneIndex].inMeGoals = oneTemp.inMeGoals;
                teams[teamOneIndex].outGoals = oneTemp.outGoals;
                teams[teamOneIndex].points = oneTemp.points;
                teams[teamTwoIndex].name = twoTemp.name;
                teams[teamTwoIndex].inMeGoals = twoTemp.inMeGoals;
                teams[teamTwoIndex].outGoals = twoTemp.outGoals;
                teams[teamTwoIndex].points = twoTemp.points;
            }
        if (list.size() == 0)
            out.println("IMPOSSIBLE");
        else {
            Collections.sort(list);
            out.printf("%d:%d\n", list.get(0).x, list.get(0).y);
        }
    }

    private static void printTeams(Team[] teams) {
        for (Team team : teams)
            debug(team.name, team.points, team.outGoals, team.inMeGoals, team.outGoals - team.inMeGoals);
    }

    static class Point implements Comparable<Point> {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Point point) {
            if (point.x - point.y == x - y)
                return y - point.y;
            return (x - y) - (point.x - point.y);
        }
    }

    private static int getIndex(Team[] teams, String teamName) {
        for (int i = 0; i < teams.length; ++i)
            if (teams[i].name.equals(teamName))
                return i;
        return -1;
    }

    static class Team implements Comparable<Team> {
        String name;
        int inMeGoals;
        int outGoals;
        int points;

        Team(String name) {
            this.name = name;
            this.inMeGoals = 0;
            this.outGoals = 0;
            this.points = 0;
        }

        Team(String name, int points, int outGoals, int inGoals) {
            this.name = name;
            this.points = points;
            this.outGoals = outGoals;
            this.inMeGoals = inGoals;
        }

        public int compareTo(Team team) {
            if (team.points != points)
                return team.points - points;
            int teamDiff = Math.abs(team.outGoals - team.inMeGoals);
            int thisDiff = Math.abs(outGoals - inMeGoals);
            if (teamDiff != thisDiff)
                return thisDiff - teamDiff;
            if (team.outGoals != outGoals)
                return team.outGoals - outGoals;
            return name.compareTo(team.name);
        }
    }
}

// practice with rainboy
import java.io.*;
import java.util.*;

public class CF200C extends PrintWriter {
	CF200C() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF200C o = new CF200C(); o.main(); o.flush();
	}

	String[] ss = new String[4];
	int n;
	int get(String s) {
		for (int i = 0; i < n; i++)
			if (ss[i].equals(s))
				return i;
		ss[n] = s;
		return n++;
	}
	void main() {
		int[] g1 = new int[4];
		int[] g0 = new int[4];
		int[] pp = new int[4];
		int[] dd = new int[4];
		for (int h = 0; h < 5; h++) {
			String s = sc.next();
			String t = sc.next();
			int i = get(s);
			int j = get(t);
			String z = sc.next();
			int x = z.charAt(0) - '0';
			int y = z.charAt(2) - '0';
			g1[i] += x; g0[j] += x;
			g0[i] += y; g1[j] += y;
			if (x > y)
				pp[i] += 3;
			else if (x < y)
				pp[j] += 3;
			else {
				pp[i]++;
				pp[j]++;
			}
			dd[i]++;
			dd[j]++;
		}
		int i = 0;
		while (!ss[i].equals("BERLAND"))
			i++;
		int j = 0;
		while (j == i || dd[j] != 2)
			j++;
		Integer[] ii = { 0, 1, 2, 3 };
		for (int x = 0, y = 0; x < 30; x++) {
			g1[i] += x; g0[j] += x;
			g0[i] += y; g1[j] += y;
			if (x > y)
				pp[i] += 3;
			else if (x < y)
				pp[j] += 3;
			else {
				pp[i]++;
				pp[j]++;
			}
			Arrays.sort(ii, (i_, j_) -> {
				if (pp[i_] != pp[j_])
					return pp[j_] - pp[i_];
				int gi = g1[i_] - g0[i_];
				int gj = g1[j_] - g0[j_];
				if (gi != gj)
					return gj - gi;
				if (g1[i_] != g1[j_])
					return g1[j_] - g1[i_];
				return ss[i_].compareTo(ss[j_]);
			});
			int r = 0;
			while ((int) ii[r] != i)
				r++;
			if (r < 2) {
				println(x + ":0");
				return;
			}
			g1[i] -= x; g0[j] -= x;
			g0[i] -= y; g1[j] -= y;
			if (x > y)
				pp[i] -= 3;
			else if (x < y)
				pp[j] -= 3;
			else {
				pp[i]--;
				pp[j]--;
			}
		}
		println("IMPOSSIBLE");
	}
}

import java.io.*;
import java.util.*;

public class Main {
    class Team implements Comparable< Team > {
        int scored, missed;
        String name;
        int points;

        public Team( int s, int m, String n, int p ) {
            scored = s;
            missed = m;
            name = n;
            points = p;

        }

        public String toString( ) { return name + " " + points + " " + scored + " " + missed; }
        public int compareTo( Team t ) {
            if ( t.points != points ) {
                return -points + t.points;
            }
            if ( ( scored - missed ) != ( t.scored - t.missed ) ) {
                return -( scored - missed ) + ( t.scored - t.missed ) ;
            }
            if ( scored != t.scored ) {
                return -scored + t.scored;
            }
            return name.compareTo( t.name );
        }
    }

    public void solve( ) throws Throwable {
        Map< String, Team > names = new HashMap< String, Team >( );
        Map< String, Integer > played = new HashMap< String, Integer >( );
        for ( int i = 0; i < 5; ++i ) {
            StringTokenizer st = new StringTokenizer( in.nextLine( ), ": " );
            String f = st.nextToken( ), s = st.nextToken( );
            int nf = Integer.parseInt( st.nextToken( ) ), ns = Integer.parseInt( st.nextToken( ) );
            Team get1 = names.get( f );
            Integer t1 = played.get( f );
            if ( get1 == null ) {
                get1 =  new Team( 0, 0, f, 0 ) ;
                t1 = 0;
            }
            Team get2 = names.get( s );
            Integer t2 = played.get( s );
            if ( get2 == null ) {
                get2 = new Team( 0, 0, s, 0 );
                t2 = 0;
            }
            if ( nf == ns ) {
                get1.points++;
                get2.points++;
            } else {
                if ( nf > ns ) {
                    get1.points += 3;
                } else {
                    get2.points += 3;
                }
            }
            get1.scored += nf;
            get1.missed += ns;

            get2.scored += ns;
            get2.missed += nf;

            names.put( f, get1 );
            names.put( s, get2 );

            played.put( f, t1 + 1 );
            played.put( s, t2 + 1 );
        }

        PriorityQueue< Team > pq = new PriorityQueue< Team >( );
        for ( String t : names.keySet( ) ) {
            pq.add( names.get( t ) );
        }

        //debug( pq );
        int diff = 1000, mx = -1, my = -1;
        for ( String s : played.keySet( ) ) {
            if ( !s.equals( "BERLAND" ) && played.get( s ) == 2 ) {
                Team t1 = names.get( "BERLAND" ), t2 = names.get( s );
                for ( int y = 0; y < 200; ++y ) {
                    pq.remove( t2 );
                    t2.scored += y;
                    for ( int x = y + 1 ;x < 200; ++x ) {
                        pq.remove( t1 );
                        t1.points += 3;
                        t1.scored += x;
                        t1.missed += y;

                        t2.missed += x;
                        pq.add( t2 );

                        pq.add( t1 );

                        //debug( x, y, pq );

                        Team first = pq.poll(  ), second = pq.poll(  );

                        if ( first.name.equals( "BERLAND" ) || second.name.equals( "BERLAND" ) && x - y < diff ) {
                            diff = ( x - y );
                            mx = x;
                            my = y;
                        }
                        pq.add( first );
                        pq.add( second );

                        t2.missed -= x;
                        pq.remove( t2 );

                        pq.remove( t1 );
                        t1.missed -= y;
                        t1.scored -= x;
                        t1.points -= 3;
                        pq.add( t1 );
                    }
                    t2.scored -= y;
                    pq.add( t2 );
                }
            }
        }
        out.println( diff == 1000 ? "IMPOSSIBLE" : ( mx + ":" + my ) );
    }

    public void run( ) {
        in = new FastScanner( System.in );
        out = new PrintWriter( new PrintStream( System.out ), true );

        try {
            solve( );
            out.close( );
            System.exit( 0 );
        } catch( Throwable e ) {
            e.printStackTrace( );
            System.exit( -1 );
        }
    }

    public void debug( Object...os ) {
        System.err.println( Arrays.deepToString( os ) );
    }

    public static void main( String[ ] args ) {
        ( new Main( ) ).run( );
    }

    private FastScanner in;
    private PrintWriter out;

    private static class FastScanner {
        private int charsRead;
        private int currentRead;
        private byte buffer[ ] = new byte[ 0x1000 ];
        private InputStream reader;

        public FastScanner( InputStream in ) {
            reader = in;
        }

        public int read( ) {
            if ( charsRead == -1 ) {
                throw  new InputMismatchException( );
            }

            if ( currentRead >= charsRead ) {
                currentRead = 0;
                try {
                    charsRead = reader.read( buffer );

                } catch( IOException e ) {
                    throw new InputMismatchException(  );
                }

                if ( charsRead <= 0 ) {
                    return -1;
                }
            }

            return buffer[ currentRead++ ];
        }

        public int nextInt( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public long nextLong( ) {
            int c = read( );

            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( sign == -1 ) {
                c = read( );
            }

            if ( c == -1 || !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            long ans = 0;
            while ( !isWhitespace( c )  && c != -1 ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw  new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10 + num;
                c = read( );
            }

            return ans * sign;
        }

        public boolean isWhitespace( int c ) {
            return  c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;
        }

        public String next( ) {
            int c = read( );
            StringBuffer ans = new StringBuffer( );

            while ( isWhitespace( c ) && c != -1 ) {
                c  = read( );
            }

            if ( c == -1 ) {
                return null;
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public String nextLine( ) {
            String ans = nextLine0( );

            while ( ans.trim( ).length( ) == 0 ) {
                ans = nextLine0( );
            }

            return ans;
        }

        private String nextLine0( ) {
            int c = read( );
            if ( c == -1 ) {
                return null;
            }
            StringBuffer ans = new StringBuffer( );
            while ( c != '\n' && c != '\r' && c != -1 ) {
                ans.appendCodePoint( c );
                c = read( );
            }

            return ans.toString( );

        }

        public double nextDouble( ) {
            int c = read( );
            while ( isWhitespace( c ) ) {
                c = read( );
            }

            if ( c == -1 ) {
                throw new NullPointerException( );
            }

            if ( c != '.' && c != '-' && !( c >= '0' && c <= '9' ) ) {
                throw new InputMismatchException( );
            }

            int sign = c == '-' ? -1 : 1;
            if ( c == '-' ) {
                c = read( );
            }
            double ans = 0;
            while ( c != -1 && c != '.' && !isWhitespace( c ) ) {
                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }

                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            if ( !isWhitespace( c ) && c != -1 && c != '.' ) {
                throw new InputMismatchException( );
            }

            double pow10 = 1.0;

            if ( c == '.' ) {
                c = read( );
            }

            while ( !isWhitespace( c ) && c != -1 ) {
                pow10 *= 10.0;

                if ( !( c >= '0' && c <= '9' ) ) {
                    throw new InputMismatchException( );
                }
                int num = c - '0';
                ans = ans * 10.0 + num;
                c = read( );
            }

            return ans * sign / pow10;
        }
    }

}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		for(int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if(val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			}
			else if(val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			}
			else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
		}
		String str = "BERLAND";
		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for(String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st);

		}
		Arrays.sort(arr);
		idx = 0;
		for(int x = 0; x < 4; x++) {
			if((arr[x].key).equals(str)) {
				req = idx;
			}
			idx++;
		}
		if(req < 2) {
			System.out.println("1:0");
			return;
		}
		else {
			if(arr[1].val - arr[req].val <= 1 ) {
				System.out.println("1:0");
			}
			else if(arr[1].val - arr[req].val <= 3 ) {
				int val = goals.get(arr[1].key) - goals.get(arr[req].key) + 1;
				if(val <= 0) {
					System.out.println("1:0");
				}
				else if(val < 10)
					System.out.println(val + ":0");
				else
					System.out.println("IMPOSSIBLE");
			}
			else {
				System.out.println("IMPOSSIBLE");
			}
		}
	}

	static class pair implements Comparable<pair>{
		int val;
		String key;
		pair(int val, String key) {
			this.val = val;
			this.key = key;
		}

		public int compareTo(pair obj) {
			return obj.val - this.val;
		}
	}
}

import java.util.*;

public class Main {

    static Map<String, Integer> ids = new HashMap<String, Integer>();
    static String[] names = new String[4];

    static int id = 0;
    public static int getId(String name){
        if(!ids.containsKey(name)){
            ids.put(name, id);
            names[id] = name;
            return id++;
        }
        return ids.get(name);
    }

    static int[] games = new int[4];
    static int[] goals = new int[4];
    static int[] missed = new int[4];
    static int[] points = new int[4];

    private static boolean ok(Integer[] integers) {
        int berid = getId("BERLAND");
        int oid = -1;
        for(int i = 0; i<4; i++){
           if(games[i] == 2 && i != berid){
               oid = i;
               break;
           }
        }
        points[berid] += 3;
        goals[berid] += integers[0];
        missed[oid] += integers[0];
        goals[oid] += integers[1];
        missed[berid] += integers[1];
        Integer[] ids = new Integer[]{0,1,2,3};
        Arrays.sort(ids, new Comparator<Integer>(){

            @Override
            public int compare(Integer teamA, Integer teamB) {
                if(points[teamA] > points[teamB]) return -1;
                if(points[teamB] > points[teamA]) return 1;
                int gdiff = goals[teamA] - missed[teamA];
                int gdiff2 = goals[teamB] - missed[teamB];
                if(gdiff > gdiff2) return -1;
                if(gdiff < gdiff2) return 1;
                if(goals[teamA] > goals[teamB]) return -1;
                if(goals[teamB] > goals[teamA]) return 1;
                return names[teamA].compareTo(names[teamB]);
            }
        });
        points[berid] -= 3;
        goals[berid] -= integers[0];
        missed[oid] -= integers[0];
        goals[oid] -= integers[1];
        missed[berid] -= integers[1];
        return ids[0] == berid || ids[1] == berid;

    }

    public static void main(String... args){
        Scanner sc = new Scanner(System.in);
        for(int i = 0; i<5; i++){
            String a = sc.next();
            String b = sc.next();
            int aid = getId(a);
            int bid = getId(b);
            String[] score = sc.next().split(":");
            int asc = Integer.parseInt(score[0]);
            int bsc = Integer.parseInt(score[1]);
            goals[aid] += asc;
            missed[bid] += asc;
            goals[bid] += bsc;
            missed[aid] += bsc;
            games[aid]++;
            games[bid]++;
            if(asc > bsc){
                points[aid] += 3;
            } else if(asc == bsc){
                points[aid]++;
                points[bid]++;
            } else {
                points[bid] += 3;
            }
        }
        List<Integer[]> possible = new ArrayList<Integer[]>();
        for(int i = 0; i<100; i++){
            for(int j = 0; j<i; j++){
                possible.add(new Integer[]{i, j});
            }
        }
        for(int i = 0; i<possible.size(); i++){
            if(!ok(possible.get(i))){
                possible.remove(i);
                i--;
            }
        }
        if(possible.isEmpty()){
            System.out.println("IMPOSSIBLE");
            return;
        }
        Collections.sort(possible, new Comparator<Integer[]>() {
            @Override
            public int compare(Integer[] integers, Integer[] integers1) {
                int da = integers[0]-integers[1];
                int db = integers1[0]-integers1[1];
                if(da < db) return -1;
                if(db > da) return 1;
                return ((Integer)integers[1]).compareTo(integers1[1]);
            }
        });
        System.out.println(possible.get(0)[0]+":"+possible.get(0)[1]);
    }

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;

/**
 * Works good for CF
 * @author cykeltillsalu
 */
public class Footbaal {

	//some local config
	static boolean test = false;
	static String testDataFile = "testdata.txt";
	static String feedFile = "feed.txt";
	CompetitionType type = CompetitionType.CF;
	private static String ENDL = "\n";

	// solution
	class Team {
		int goals, missed, points, played;
		String name;
		public Team(int goals, int missed, int points, String name) {
			super();
			this.goals = goals;
			this.missed = missed;
			this.points = points;
			this.name = name;
		}
		@Override
		public String toString() {
			return "Team [goals=" + goals + ", missed=" + missed + ", points=" + points + ", played=" + played + ", name=" + name + "]";
		}
	}

	private void solve() throws Throwable {

		HashMap<String, Team> teams = new HashMap<String, Footbaal.Team>();

		for (int i = 0; i < 5; i++) {
			String t1 = wread();
			String t2 = wread();
			String[] split = wread().split(":");
			Integer t1score = Integer.valueOf(split[0]);
			Integer t2score = Integer.valueOf(split[1]);
			int t1points = 0, t2points = 0;
			if(t1score > t2score){
				t1points = 3;
			} else if( t2score > t1score){
				t2points = 3;
			} else {
				t1points = 1;
				t2points = 1;
			}
			Team team1 = null, team2 = null;

			if(teams.containsKey(t1)){
				team1 = teams.get(t1);
			} else {
				team1 = new Team(0, 0, 0, t1);
			}

			if(teams.containsKey(t2)){
				team2 = teams.get(t2);
			} else {
				team2 = new Team(0, 0, 0, t2);
			}

			team1.points += t1points;
			team1.goals += t1score;
			team1.missed += t2score;
			team1.played ++;

			team2.points += t2points;
			team2.goals += t2score;
			team2.missed += t1score;
			team2.played ++;

			teams.put(t1, team1);
			teams.put(t2, team2);
		}

		Team berland = teams.get("BERLAND");
		berland.points += 3;

		ArrayList<Team> t = new ArrayList<Team>();
		t.addAll(teams.values());
		int res = -1;
		Team opposingTeam = null;
		for (int j = 0; j < t.size(); j++) {
			Team team = t.get(j);
			if(team.name.compareTo("BERLAND") != 0 && team.played == 2){
				opposingTeam = team;
			}
		}
		for (int i = 1; i < 100000; i++) {
			berland.goals += i;
			opposingTeam.missed += i;

			Collections.sort(t, new Comparator<Team>(){

				@Override
				public int compare(Team t0, Team t1) {
					if(t0.points != t1.points){
						return t1.points - t0.points;
					}
					int t0scored = t0.goals - t0.missed;
					int t1scored = t1.goals - t1.missed;
					if(t0scored != t1scored){
						return t1scored - t0scored;
					}
					if(t0.goals != t1.goals){
						return t1.goals - t0.goals;
					}
					return t0.name.compareTo(t1.name);
				}
			});

			if(t.get(0).name.equals("BERLAND") || t.get(1).name.equals("BERLAND")){
				res = i;
				break;
			}

			berland.goals -= i;
			opposingTeam.missed -= i;
		}

		if(res == -1){
			out.write("IMPOSSIBLE\n");
		} else {
			out.write(res + ":0\n");
		}

		out.flush();
	}

	public int iread() throws Exception {
		return Integer.parseInt(wread());
	}

	public double dread() throws Exception {
		return Double.parseDouble(wread());
	}

	public long lread() throws Exception {
		return Long.parseLong(wread());
	}

	public String wread() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) throws Throwable {

		if(test){ //run all cases from testfile:
			BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));
			String readLine = testdataReader.readLine();
			int casenr = 0;
			out: while (true) {
				BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));
				if(!readLine.equalsIgnoreCase("input")){
					break;
				}
				while (true) {
					readLine = testdataReader.readLine();
					if(readLine.equalsIgnoreCase("output")){
						break;
					}
					w.write(readLine + "\n");
				}
				w.close();
				System.out.println("Answer on case "+(++casenr)+": ");

				new Footbaal().solve();
				System.out.println("Expected answer: ");

				while (true) {
					readLine = testdataReader.readLine();

					if(readLine == null){
						break out;
					}
					if(readLine.equalsIgnoreCase("input")){
						break;
					}
					System.out.println(readLine);
				}
				System.out.println("----------------");
			}
			testdataReader.close();
		} else { // run on server
			new Footbaal().solve();
		}
		out.close();
	}

	public Footbaal() throws Throwable {
		if (test) {
			in = new BufferedReader(new FileReader(new File(feedFile)));
		}
	}

	InputStreamReader inp = new InputStreamReader(System.in);
	BufferedReader in = new BufferedReader(inp);
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	enum CompetitionType {CF, OTHER};
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    static class Team{
        String name;
        int id;
        int winP;
        int goal;
        int missgoal;
        int rank=0;

        Team(int id,String name,
        int winP,int minssgoal,
        int goal){
            this.id=id;
            this.name=name;
            this.winP=winP;
            this.goal=goal;
            this.missgoal=minssgoal;
        }
    }

    int id=0;

    HashMap<String,Team> teams;

    boolean[][] game=new boolean[4][4];
    List<Team> teamlist;
    public void solve() {
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<4;i++){
            game[i][i]=true;
        }
        teams=new HashMap<String, Main.Team>();
        for (int i = 0; i < 5; i++) {
            String name1=sc.next();
            String name2=sc.next();

            String param=sc.next();
            int p1=param.charAt(0)-'0';
            int p2=param.charAt(2)-'0';

            Team t1,t2;
            if(!teams.containsKey(name1)){
                t1=new Team(id++,name1,0,0,0);
                teams.put(name1,t1);
            }else{
                t1=teams.get(name1);
            }
            if(!teams.containsKey(name2)){
                t2=new Team(id++,name2,0,0,0);
                teams.put(name2,t2);
            }else{
                t2=teams.get(name2);
            }

            game[t1.id][t2.id]=true;
            game[t2.id][t1.id]=true;
            t1.goal+=p1;
            t2.goal+=p2;
            t1.missgoal+=p2;
            t2.missgoal+=p1;
            if(p1<p2){
                t2.winP+=3;
            }else if(p1> p2){
                t1.winP+=3;
            }else{
                t1.winP++;
                t2.winP++;
            }
        }

        teamlist=new ArrayList<Team>();
        for(Entry<String,Team> team:teams.entrySet()){
            teamlist.add(team.getValue());
        }

        refreashRank();

        Team berand=null;
        for(Team team:teamlist){
            if(team.name.equals("BERLAND")){
                berand=team;
                break;
            }
        }

        int lastgameid=0;
        for(int i=0;i<4;i++){
            if(!game[i][berand.id]){
                lastgameid=i;break;
            }
        }

        Team lastGame=null;
        for(Team team:teamlist){
            if(team.id==lastgameid){
                lastGame=team;
            }
        }

        berand.winP+=3;
        int mx=Integer.MAX_VALUE;int my=0;
        for(int x=0;x<=60;x++){
            for(int y=0;y<x;y++){
                berand.goal+=x;
                lastGame.goal+=y;
                berand.missgoal+=y;
                lastGame.missgoal+=x;

                refreashRank();
                if(berand.rank<=1){
                    if(mx-my>=x-y && y<=my){
                        mx=x;
                        my=y;
                    }
                }
                berand.goal-=x;
                lastGame.goal-=y;
                berand.missgoal-=y;
                lastGame.missgoal-=x;
            }
        }

        if(mx==Integer.MAX_VALUE){
            pr("IMPOSSIBLE");
        }else{
            pr(mx+":"+my);
        }
    }

    public void  refreashRank(){
        Collections.sort(teamlist,new Comparator<Team>() {
            @Override
            public int compare(Team o1, Team o2) {
                if(o1.winP!=o2.winP){
                    return o2.winP-o1.winP;
                }
                if(o1.goal-o1.missgoal!=o2.goal-o2.missgoal){
                    return o2.goal-o2.missgoal-(o1.goal-o1.missgoal);
                }
                if(o1.goal!=o2.goal){
                    return o2.goal-o1.goal;
                }
                return o2.name.compareTo(o1.name);
            }
        });
        int rank=0;
        for(Team team:teamlist){
            team.rank=rank;
            rank++;
        }
    }

    public void run() {
        solve();
    }

    public static void main(String[] _) {
        new Main().run();
    }

    public static void pr() {
        System.out.println();
    }

    public static void pr(Object o) {
        System.out.println(o);
    }

}

import java.io.PrintWriter;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: vaibhav mittal
 * Date: 24/6/12
 * Time: 9:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int MAX_TEAMS = 4;
        final int LINES = 5;

        String[] data = new String[LINES];
        for (int i = 0; i < data.length; ++i)
            data[i] = in.nextLine();

        HashSet<String> teamNames = new HashSet<String>();
        for (int i = 0; i < data.length; ++i) {
            String[] tokens = data[i].split(" ");
            teamNames.add(tokens[0]);
            teamNames.add(tokens[1]);
        }

        Team[] teams = new Team[MAX_TEAMS];
        int idx = 0;
        for (String name : teamNames)
            teams[idx++] = new Team(name);

        for (int i = 0; i < data.length; ++i) {
            String[] tokens1 = data[i].split(" ");
            int idx1 = getIndex(tokens1[0], teams);
            int idx2 = getIndex(tokens1[1], teams);
            String[] tokens2 = tokens1[2].split(":");
            int x = Integer.parseInt(tokens2[0]);
            int y = Integer.parseInt(tokens2[1]);

            if (x > y) {
                teams[idx1].points += 3;
                teams[idx2].points += 0;
            }
            else if (x < y) {
                teams[idx1].points += 0;
                teams[idx2].points += 3;
            }
            else {
                teams[idx1].points += 1;
                teams[idx2].points += 1;
            }

            teams[idx1].scoredGoals += x;
            teams[idx1].missedGoals += y;
            teams[idx1].matches += 1;

            teams[idx2].scoredGoals += y;
            teams[idx2].missedGoals += x;
            teams[idx2].matches += 1;
        }

        String firstTeamName = "BERLAND";
        String otherTeamName = "";
        for (int i = 0; i < teams.length; ++i) {
            if (teams[i].matches == 2) {
                if (teams[i].name.compareTo(firstTeamName) != 0) {
                    otherTeamName = teams[i].name;
                }
            }
        }

        teams[getIndex(firstTeamName, teams)].points += 3;
        teams[getIndex(otherTeamName, teams)].points += 0;

        Arrays.sort(teams);

        int bestX = -1, bestY = -1;
        boolean done = false;
        for (int y = 0; y <= 200; ++y) {
            for (int x = y + 1; x <= 200; ++x) {
                teams[getIndex(firstTeamName, teams)].scoredGoals += x;
                teams[getIndex(firstTeamName, teams)].missedGoals += y;
                teams[getIndex(otherTeamName, teams)].scoredGoals += y;
                teams[getIndex(otherTeamName, teams)].missedGoals += x;

                Arrays.sort(teams);
                if (getIndex(firstTeamName, teams) <= 1) {
                    if (bestX == -1 || bestY == -1) {
                        bestX = x;
                        bestY = y;
                    }
                    else if ((x - y < bestX - bestY) || (x - y == bestX - bestY && y < bestY)) {
                        bestX = x;
                        bestY = y;
                    }
                    done = true;
                }

                teams[getIndex(firstTeamName, teams)].scoredGoals -= x;
                teams[getIndex(firstTeamName, teams)].missedGoals -= y;
                teams[getIndex(otherTeamName, teams)].scoredGoals -= y;
                teams[getIndex(otherTeamName, teams)].missedGoals -= x;
            }
        }
        if (!done) {
            out.println("IMPOSSIBLE");
        }
        else {
            out.println(bestX + ":" + bestY);
        }

        in.close();
        out.close();
    }

    public static int getIndex(String name, Team[] teams) {
        for (int idx = 0; idx < teams.length; ++idx) {
            if (name.compareTo(teams[idx].name) == 0) {
                return idx;
            }
        }
        return -1;
    }

    public static class Team implements Comparable<Team> {
        String name;
        int points;
        int scoredGoals;
        int missedGoals;
        int matches;

        public Team(String teamName) {
            this.name = teamName;
            this.points = 0;
            this.scoredGoals = 0;
            this.missedGoals = 0;
            this.matches = 0;
        }

        public int compareTo(Team team) {
            if (points != team.points) return team.points - points;
            if (scoredGoals - missedGoals != team.scoredGoals - team.missedGoals) return (team.scoredGoals - team.missedGoals) - (scoredGoals - missedGoals);
            if (scoredGoals != team.scoredGoals) return team.scoredGoals - scoredGoals;
            return -(name.compareTo(team.name));
        }

        public String toString() {
            return name + " " + points + " " + (scoredGoals - missedGoals) + " " + missedGoals;
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		HashMap<String, Integer> diff = new HashMap();
		HashMap<String, Integer> nom = new HashMap();
		for (int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if (val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			} else if (val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			} else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			diff.put(str1, diff.getOrDefault(str1, 0) + val1 - val2);
			diff.put(str2, diff.getOrDefault(str2, 0) + val2 - val1);
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
			nom.put(str1, nom.getOrDefault(str1, 0) + 1);
			nom.put(str2, nom.getOrDefault(str2, 0) + 1);
		}

		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for (String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st, goals.get(st), diff.get(st));
		}
		Arrays.sort(arr);

		idx = 0;
		String str1 = "BERLAND";
		for (int x = 0; x < 4; x++) {
			if ((arr[x].key).equals(str1)) {
				req = idx;
			}
			idx++;
		}
		if(req < 2) {
			System.out.println("1:0");
			return;
		}
		else if(arr[1].val - arr[req].val > 3) {
			System.out.println("IMPOSSIBLE");
			return;
		}
		String str2 = "";
		int idx2 = 0;
		for(String str : nom.keySet()) {
			if(nom.get(str) == 2 && !str.equals(str1)) {
				str2 = str;
				break;
			}

		}
		for(int x = 0; x < 4; x++) {
			if(arr[x].key.equals(str2)) {
				idx2 = x;
				break;
			}
		}
		String ans = "";
		for(int x = 1; x < 29; x++) {
			boolean flag = false;
			for(int y = 0; y < x; y++) {
				arr[req].dif += x - y;
				arr[req].val += 3;
				arr[req].goals += x;
				arr[idx2].dif += y - x;
				arr[idx2].goals += y;
				pair[] arr1 = arr.clone();
				Arrays.sort(arr1);
				arr[req].dif -= (x - y);
				arr[req].val -= 3;
				arr[req].goals -= (x);
				arr[idx2].dif -= (y - x);
				arr[idx2].goals -= (y);
				if(arr1[1].key.equals(str1) || arr1[0].key.equals(str1)) {
					flag = true;
					ans = x+":"+y;
				}
				else {
					break;
				}

			}
			if(flag) break;
		}
		System.out.println(ans);
	}

	static class pair implements Comparable<pair> {
		int val;
		int goals;
		int dif;
		String key;

		pair(int val, String key, int points, int dif) {
			this.val = val;
			this.key = key;
			this.goals = points;
			this.dif = dif;
		}

		public int compareTo(pair obj) {
			if (obj.val == val) {
				if (obj.dif == dif) {
					if(obj.goals == goals) {
						return key.compareTo(obj.key);
					}
					return obj.goals - goals;
				} else
					return obj.dif - dif;
			}
			return obj.val - this.val;
		}
	}
}

import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.System.*; import static java.util.Arrays.*;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class C {
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintStream out = System.out;

    static int m = 0, n = 0;
    static int result = 0;
    static String[] a;

    static class Team implements Comparable<Team> {

    	public String name;
    	public int matches, points, goalFor, goalAgainst;

		public Team(String name) {
			this.name = name;
			matches = 0;
			points = 0;
			goalFor = 0;
			goalAgainst = 0;
		}

		public void addMatch (int co, int u, int v) {
			if (u==v) points +=1 * co;
			if (u>v) points +=3 * co;
			goalFor += u * co;
			goalAgainst += v * co;
			matches += co;
		}

		public int compareTo(Team t) {
			if (points!= t.points) return t.points - points;
			if (goalFor-goalAgainst!= t.goalFor-t.goalAgainst) return (t.goalFor-t.goalAgainst) - (goalFor-goalAgainst);
			if (goalFor!= t.goalFor) return t.goalFor - goalFor;
			return name.compareTo(t.name);
		}

		void debug () {
			C.debug(name, matches, points, goalFor, goalAgainst);
		}
	}

    static ArrayList<Team> list;

	static void readInput() throws IOException {
		list = new ArrayList<C.Team> ();
		a = new String[5];
		for (int i = 0; i < 5; i++) {
			a[i] = in.readLine().trim();
			add (a[i]);
		}
	}

	static void add (String s) {
		String [] teams = s.split("[ ]+");
		String [] scores = teams[2].split(":");
		int u = -1, v = -1;
		int su = new Integer(scores[0]), sv = new Integer(scores[1]);
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).name .equals(teams[0])) u = i;
			if (list.get(i).name .equals(teams[1])) v = i;
		}
		if (u==-1) {
			list.add(new Team(teams[0]));
			u = list.size()-1;
		}
		if (v==-1) {
			list.add(new Team(teams[1]));
			v = list.size()-1;
		}

		list.get(u).addMatch(1, su, sv);
		list.get(v).addMatch(1, sv, su);
	}

	static int ru = -1, rv = -1;
	static void process() {
		ru = -1;
		rv = -1;
		Team berland = new Team(""), other = new Team("");
		for(Team team:list) if(team.matches ==2 && !team.name.equals("BERLAND")) other = team;
		for(Team team:list) if(team.name.equals("BERLAND")) berland = team;

		for (int i = 0; i < 50; i++) for (int j = 0; j < 50; j++) {
			berland.addMatch(1, i, j);
			other.addMatch(1, j,i);

			Collections.sort(list);
			if(list.get(0).name.equals("BERLAND") || list.get(1).name.equals("BERLAND")) update( i, j);

			berland.addMatch(-1, i, j);
			other.addMatch(-1, j,i);
		}

		if(ru==-1) out.println("IMPOSSIBLE");
		else out.println(ru+":"+rv);
	}

	private static void update(int u, int v) {
		if (ru==-1) {
			ru = u; rv = v; return;
		}
		if (ru-rv > u-v) {
			ru = u;rv = v;return;
		}
		if (rv > v) {
			ru = u;rv = v;return;
		}
	}

	public static void main(String[] args) throws IOException {
		readInput();
		process();
	}

	public static void debug(Object...os) {
		System.err.println(Arrays.deepToString(os));
	}

	static int[] readArrInt() throws IOException {
		return parseArrInt(in.readLine());
	}

	static int readInt() throws IOException {
		return new Integer(in.readLine());
	}

	static int[] parseArrInt(String s) {
		StringTokenizer st = new StringTokenizer(s);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (st.hasMoreTokens()) {
			list.add(Integer.parseInt(st.nextToken()));
		}
		Integer[] temp = list.toArray(new Integer[]{});
		int[] res = new int[temp.length];
		for (int i = 0; i < temp.length; i++) {
			res[i] = temp[i];
		}
		return (res);
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[4];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        Score other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = map.get(name);
                }

            } else {
                ber = map.get(name);
            }
            data[index++] = map.get(name);
        }
        ber.score += 1;
        ber.point += 3;

        other.miss += 1;
        Arrays.sort(data);
      //  System.out.println(ber.score + " "+ data[2].score);
        if (ber.point < data[2].point) {
            out.println("IMPOSSIBLE");
        } else {
            int left = 1;
            int right = 0;
       //     System.out.println(data[2].name + " ");
            while (!data[2].name.equals("BERLAND") && !data[3].name.equals("BERLAND")) {
                int difBer = ber.score - ber.miss;
                int difSe = data[2].score - data[2].miss;
                int need = difSe - difBer;
                if (need == 0) {
                    if (data[2].score > ber.score && !data[2].name.equals(other.name)) {
                        int more = data[2].score - ber.score + 1;
                        left += more;
                        ber.score += more;
                        other.miss += more;
                    } else {
                        ber.score += 1;
                        left++;
                        right++;
                        other.miss++;
                    }

                } else {
                    if (!data[2].name.equals(other.name)) {
                        int more = need;
                        int miss = 0;
                        while(data[2].score > ber.score + more){
                            more++;
                            miss++;
                        }
                        if(data[2].name.compareTo(ber.name) < 0){
                            more++;
                            miss++;
                        }
                        left += more;
                        right += miss;
                        ber.score += more;
                        ber.miss += miss;
                        other.miss += more;
                        other.score += miss;
                    } else {
                        int more = need + 1;
                        int a = more / 2;
                        if (more % 2 != 0) {
                            a++;
                        }
                        left += a;
                        ber.score += a;
                        other.miss += a;
                    }
                }
                Arrays.sort(data);
            }
            out.println(left + ":" + right);

        }
        // System.out.println(second.point);

        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static Pair cal(ArrayList<Integer>[] map, HashSet<Integer> result, HashSet<Pair> check, int pa, int node) {
        boolean taken = false;
        if (check.contains(new Pair(pa, node)) || check.contains(new Pair(node, pa))) {
            taken = true;
        }
        boolean leaf = true;

        ArrayList<Integer> list = new ArrayList();
        Pair store = null;
        for (int next : map[node]) {
            if (next != pa) {
                leaf = false;

                Pair p = cal(map, result, check, node, next);
                if (p.y == 1) {
                    store = p;
                    taken = false;

                } else {
                    if (store == null) {
                        store = p;
                    }
                }
            }
        }
        if (leaf) {
            if (taken) {
                result.add(node);
                return new Pair(node, 1);
            } else {
                return new Pair(node, 0);
            }
        }
        if (taken) {
            result.add(store.x);
            return new Pair(store.x, 1);
        }
        return store;

    }

    public static class Pair {

        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair other = (Pair) o;
                return x == other.x && y == other.y;
            }
            return false;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 29 * hash + this.x;
            hash = 29 * hash + this.y;
            return hash;
        }
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            d = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);

    }

    static class Line {

        double a, b, c;

        Line(double x1, double y1, double x2, double y2) {
            if (Math.abs(x1 - x2) < Epsilon && Math.abs(y1 - y2) < Epsilon) {
                throw new RuntimeException("Two point are the same");
            }
            a = y1 - y2;
            b = x2 - x1;
            c = -a * x1 - b * y1;
        }

        Line(Point x, Point y) {
            this(x.x, x.y, y.x, y.y);
        }

        public Line perpendicular(Point p) {
            return new Line(p, new Point(p.x + a, p.y + b));
        }

        public Point intersect(Line l) {
            double d = a * l.b - b * l.a;
            if (d == 0) {
                throw new RuntimeException("Two lines are parallel");
            }

            return new Point((l.c * b - c * l.b) / d, (l.a * c - l.c * a) / d);
        }
    }

    static void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {
        for (int i = 0; i < 4; i++) {
            int m = (i + index) % 4;
            int j = (i + 1 + index) % 4;
            Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));
            if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {
                Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);
                p.add(add(val, a));
                // System.out.println(a + " " + b + " " + rec[i] + " " + rec[j]);
                // System.out.println(add(val, a));
            }
        }
    }

    static Point intersect(Point a, Point b, Point c) {
        double D = cross(a, b);
        if (D != 0) {
            return new Point(cross(c, b) / D, cross(a, c) / D);
        }
        return null;
    }

    static Point convert(Point a, double angle) {
        double x = a.x * cos(angle) - a.y * sin(angle);
        double y = a.x * sin(angle) + a.y * cos(angle);
        return new Point(x, y);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;

    }

    static class Point {

        double x, y;

        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.*;
import java.rmi.server.UID;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Q200C implements Runnable {
    Map<String, Data> table = new HashMap<String, Data>();
    static String BERLAND = "BERLAND";
    private void solve() throws IOException {
        //solve

        for (int i = 0; i < 5; i++) {
            String t1 = nextToken();
            String t2 = nextToken();
            String score = nextToken();
            int s1 = Integer.parseInt(score.substring(0, score.indexOf(":")));
            int s2 = Integer.parseInt(score.substring(score.indexOf(":") + 1));
            addRes(t1, t2, s1, s2);
            writer.println(s1 + " " + s2);
        }
        Data[] t = new Data[4];
        int i = 1;
        int other =0;
        t[0]=table.remove(BERLAND);
        for (Data d : table.values()) {
            t[i++] = d;
            if(d.games==2)other = i-1;
        }

        int x1=-1;
        int x2=-1;
        t[0].points+=3;
        for (int s1 = 1; s1 < 50; s1++) {
            for (int s2 = 0; s2 < s1; s2++) {
                int betterThen=0;
                t[0].s+=s1;
                t[0].m+=s2;
                t[other].s+=s2;
                t[other].m+=s1;

                for (int j = 0; j < 3; j++) {
                    if(t[0].compareTo(t[1+j])>0)betterThen++;
                }
                t[0].s-=s1;
                t[0].m-=s2;
                t[other].s-=s2;
                t[other].m-=s1;

                if(betterThen>=2 && (x1==-1 || (s1-s2)<(x1-x2) || ((s1-s2)==(x1-x2) && s2<x2))){
                    x1=s1;x2=s2;
                }
            }
        }

        if(x1==-1)writer.println("IMPOSSIBLE");
        else{
            writer.println(x1+":"+x2);
        }
    }

    private void addRes(String t1, String t2, int s1, int s2) {
        if (!table.containsKey(t1)) {
            table.put(t1, new Data(t1));
        }
        if (!table.containsKey(t2)) {
            table.put(t2, new Data(t2));
        }

        Data d1 = table.get(t1);
        Data d2 = table.get(t2);
        d1.s += s1;
        d1.m += s2;
        d2.s += s2;
        d2.m += s1;
        d1.points += s1 > s2 ? 3 : s1 == s2 ? 1 : 0;
        d2.points += s2 > s1 ? 3 : s2 == s1 ? 1 : 0;

        d1.games++;
        d2.games++;
    }

    private static class Data implements Comparable<Data>{
        int games;
        String name;
        int points;
        int s;
        int m;

        public Data(String t1) {
            name = t1;
        }

        public int compareTo(Data o) {
            if(points>o.points)return 1;
            else if(points<o.points)return -1;
            else{
                if(s-m>o.s-o.m)return 1;
                else if(s-m<o.s-o.m)return -1;
                else{
                    if(s>o.s)return 1;
                    else if(s<o.s)return -1;
                    else{
                        return name.compareTo(o.name);
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        new Q200C().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            boolean oj = System.getProperty("ONLINE_JUDGE") != null;
            reader = oj ? new BufferedReader(new InputStreamReader(System.in)) :
                    new BufferedReader(new FileReader(new File("input.txt")));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            long start = System.currentTimeMillis();
            solve();
            reader.close();
            if (!oj) writer.print("\nTime: " + (System.currentTimeMillis() - start) + "\n");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		HashMap<String, Integer> diff = new HashMap();
		HashMap<String, Integer> nom = new HashMap();
		for (int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if (val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			} else if (val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			} else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			diff.put(str1, diff.getOrDefault(str1, 0) + val1 - val2);
			diff.put(str2, diff.getOrDefault(str2, 0) + val2 - val1);
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
			nom.put(str1, nom.getOrDefault(str1, 0) + 1);
			nom.put(str2, nom.getOrDefault(str2, 0) + 1);
		}

		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for (String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st, goals.get(st), diff.get(st));
		}
		Arrays.sort(arr);
		idx = 0;
		String str1 = "BERLAND", str2 = arr[1].key;
		for (int x = 0; x < 4; x++) {
			if ((arr[x].key).equals(str1)) {
				req = idx;
			}
			idx++;
		}
		if (req < 2) {
			System.out.println("1:0");
			return;
		} else if (arr[1].val - arr[req].val < 3) {
			System.out.println("1:0");
		} else if (arr[1].val - arr[req].val == 3) {
			int val = diff.get(str2) - diff.get(str1);
			if (val < 0) {
				System.out.println("1:0");
			} else {
				if(nom.get(str2) == 2) {
					if((val & 1) == 0) {
						val = val/2;
						if(goals.get(str1) + val <= goals.get(str2)) {
							val++;
						}
					}
					else {
						val = (val + 1)/2;
					}
				}
				else {
					if(goals.get(str1) + val <= goals.get(str2)) {
						val++;
					}
				}
				int extra = 0;
				if(req == 3 && arr[1].val == arr[2].val) {
					String str3 = arr[2].key;
					if(nom.get(str3) == 2) {
						int dif = diff.get(str3) - diff.get(str1) - val;
						if((dif & 1) == 0) {
							extra = dif/2;
							if(goals.get(str1) + val + extra<= goals.get(str3)) {
								extra++;
							}
						}
						else {
							extra = (dif + 1)/2;
						}
					}
					else if(diff.get(str3) >= diff.get(str1) + val){
						extra = diff.get(str3) - diff.get(str1) - val;
						if(goals.get(str1) + val + extra <= goals.get(str3)) {
							extra++;
						}
					}
				}
				System.out.println(val + extra + ":0");
			}
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	static class pair implements Comparable<pair> {
		int val;
		int goals;
		int dif;
		String key;

		pair(int val, String key, int points, int dif) {
			this.val = val;
			this.key = key;
			this.goals = points;
			this.dif = dif;
		}

		public int compareTo(pair obj) {
			if (obj.val == val) {
				if (obj.dif == dif) {
					return obj.goals - goals;
				} else
					return obj.dif - dif;
			}
			return obj.val - this.val;
		}
	}
}

import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.System.*; import static java.util.Arrays.*;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class C {
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintStream out = System.out;

    static int m = 0, n = 0;
    static int result = 0;
    static String[] a;

    static class Team implements Comparable<Team> {

    	public String name;
    	public int matches, points, goalFor, goalAgainst;

		public Team(String name) {
			this.name = name;
			matches = 0;
			points = 0;
			goalFor = 0;
			goalAgainst = 0;
		}

		public void addMatch (int co, int u, int v) {
			if (u==v) points +=1 * co;
			if (u>v) points +=3 * co;
			goalFor += u * co;
			goalAgainst += v * co;
			matches += co;
		}

		public int compareTo(Team t) {
			if (points!= t.points) return t.points - points;
			if (goalFor-goalAgainst!= t.goalFor-t.goalAgainst) return (t.goalFor-t.goalAgainst) - (goalFor-goalAgainst);
			if (goalFor!= t.goalFor) return t.goalFor - goalFor;
			return name.compareTo(t.name);
		}

		void debug () {
			C.debug(name, matches, points, goalFor, goalAgainst);
		}
	}

    static ArrayList<Team> list;

	static void readInput() throws IOException {
		list = new ArrayList<C.Team> ();
		a = new String[5];
		for (int i = 0; i < 5; i++) {
			a[i] = in.readLine().trim();
			add (a[i]);
		}
	}

	static void add (String s) {
		String [] teams = s.split("[ ]+");
		String [] scores = teams[2].split(":");
		int u = -1, v = -1;
		int su = new Integer(scores[0]), sv = new Integer(scores[1]);
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).name .equals(teams[0])) u = i;
			if (list.get(i).name .equals(teams[1])) v = i;
		}
		if (u==-1) {
			list.add(new Team(teams[0]));
			u = list.size()-1;
		}
		if (v==-1) {
			list.add(new Team(teams[1]));
			v = list.size()-1;
		}

		list.get(u).addMatch(1, su, sv);
		list.get(v).addMatch(1, sv, su);
	}

	static int ru = -1, rv = -1;
	static void process() {
		ru = -1;
		rv = -1;
		Team berland = new Team(""), other = new Team("");
		for(Team team:list) if(team.matches ==2 && !team.name.equals("BERLAND")) other = team;
		for(Team team:list) if(team.name.equals("BERLAND")) berland = team;

		for (int i = 0; i < 50; i++) for (int j = 0; j < 50; j++) if (i>j) {
			berland.addMatch(1, i, j);
			other.addMatch(1, j,i);

			Collections.sort(list);
			if(list.get(0).name.equals("BERLAND") || list.get(1).name.equals("BERLAND")) update( i, j);

			berland.addMatch(-1, i, j);
			other.addMatch(-1, j,i);
		}

		if(ru==-1) out.println("IMPOSSIBLE");
		else out.println(ru+":"+rv);
	}

	private static void update(int u, int v) {
		if (ru==-1) {
			ru = u; rv = v; return;
		}
		if (ru-rv > u-v) {
			ru = u;rv = v;return;
		}
		if (rv > v) {
			ru = u;rv = v;return;
		}
	}

	public static void main(String[] args) throws IOException {
		readInput();
		process();
	}

	public static void debug(Object...os) {
		System.err.println(Arrays.deepToString(os));
	}

	static int[] readArrInt() throws IOException {
		return parseArrInt(in.readLine());
	}

	static int readInt() throws IOException {
		return new Integer(in.readLine());
	}

	static int[] parseArrInt(String s) {
		StringTokenizer st = new StringTokenizer(s);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (st.hasMoreTokens()) {
			list.add(Integer.parseInt(st.nextToken()));
		}
		Integer[] temp = list.toArray(new Integer[]{});
		int[] res = new int[temp.length];
		for (int i = 0; i < temp.length; i++) {
			res[i] = temp[i];
		}
		return (res);
	}

}

import java.io.PrintWriter;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: vaibhav mittal
 * Date: 24/6/12
 * Time: 9:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int MAX_TEAMS = 4;
        final int LINES = 5;

        String[] data = new String[LINES];
        for (int i = 0; i < data.length; ++i)
            data[i] = in.nextLine();

        HashSet<String> teamNames = new HashSet<String>();
        for (int i = 0; i < data.length; ++i) {
            String[] tokens = data[i].split(" ");
            teamNames.add(tokens[0]);
            teamNames.add(tokens[1]);
        }

        Team[] teams = new Team[MAX_TEAMS];
        int idx = 0;
        for (String name : teamNames)
            teams[idx++] = new Team(name);

        for (int i = 0; i < data.length; ++i) {
            String[] tokens1 = data[i].split(" ");
            int idx1 = getIndex(tokens1[0], teams);
            int idx2 = getIndex(tokens1[1], teams);
            String[] tokens2 = tokens1[2].split(":");
            int x = Integer.parseInt(tokens2[0]);
            int y = Integer.parseInt(tokens2[1]);

            if (x > y) {
                teams[idx1].points += 3;
                teams[idx2].points += 0;
            }
            else if (x < y) {
                teams[idx1].points += 0;
                teams[idx2].points += 3;
            }
            else {
                teams[idx1].points += 1;
                teams[idx2].points += 1;
            }

            teams[idx1].scoredGoals += x;
            teams[idx1].missedGoals += y;
            teams[idx1].matches += 1;

            teams[idx2].scoredGoals += y;
            teams[idx2].missedGoals += x;
            teams[idx2].matches += 1;
        }

        String firstTeamName = "BERLAND";
        String otherTeamName = "";
        for (int i = 0; i < teams.length; ++i) {
            if (teams[i].matches == 2) {
                if (teams[i].name.compareTo(firstTeamName) != 0) {
                    otherTeamName = teams[i].name;
                }
            }
        }

        teams[getIndex(firstTeamName, teams)].points += 3;
        teams[getIndex(otherTeamName, teams)].points += 0;

        Arrays.sort(teams);

        if (getIndex(firstTeamName, teams) >= 2) {
            if (teams[1].points > teams[getIndex(firstTeamName, teams)].points) {
                out.println("IMPOSSIBLE");
            }
            else {
                boolean done = false;
                for (int y = 0; y <= 500 && !done; ++y) {
                    for (int x = y + 1; x <= 500 && !done; ++x) {
                        teams[getIndex(firstTeamName, teams)].scoredGoals += x;
                        teams[getIndex(firstTeamName, teams)].missedGoals += y;
                        teams[getIndex(otherTeamName, teams)].scoredGoals += y;
                        teams[getIndex(otherTeamName, teams)].missedGoals += x;

                        Arrays.sort(teams);
                        if (getIndex(firstTeamName, teams) <= 1) {
                            out.println(x + ":" + y);
                            done = true;
                        }

                        teams[getIndex(firstTeamName, teams)].scoredGoals -= x;
                        teams[getIndex(firstTeamName, teams)].missedGoals -= y;
                        teams[getIndex(otherTeamName, teams)].scoredGoals -= y;
                        teams[getIndex(otherTeamName, teams)].missedGoals -= x;
                    }
                }
            }
        }
        else {
            out.println("1:0");
        }

        in.close();
        out.close();
    }

    public static int getIndex(String name, Team[] teams) {
        for (int idx = 0; idx < teams.length; ++idx) {
            if (name.compareTo(teams[idx].name) == 0) {
                return idx;
            }
        }
        return -1;
    }

    public static class Team implements Comparable<Team> {
        String name;
        int points;
        int scoredGoals;
        int missedGoals;
        int matches;

        public Team(String teamName) {
            this.name = teamName;
            this.points = 0;
            this.scoredGoals = 0;
            this.missedGoals = 0;
            this.matches = 0;
        }

        public int compareTo(Team team) {
            if (points != team.points) return team.points - points;
            if (scoredGoals - missedGoals != team.scoredGoals - team.missedGoals) return (team.scoredGoals - team.missedGoals) - (scoredGoals - missedGoals);
            if (scoredGoals != team.scoredGoals) return team.scoredGoals - scoredGoals;
            return -(name.compareTo(team.name));
        }

        public String toString() {
            return name + " " + points + " " + (scoredGoals - missedGoals) + " " + missedGoals;
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {

   static class Assertion {
      static void check(boolean e) {
         if (!e) {
            throw new Error();
         }
      }
   }

   // class Scanner {
   // StreamTokenizer in;
   //
   // Scanner(InputStream s) {
   // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(s)));
   // in.resetSyntax();
   // in.whitespaceChars(0, 32);
   // in.wordChars(33, 255);
   // }
   //
   // String next() {
   // try {
   // in.nextToken();
   // return in.sval;
   // } catch (Exception e) {
   // throw new Error();
   // }
   // }
   //
   // int nextInt() {
   // return Integer.parseInt(next());
   // }
   //
   // long nextLong() {
   // return Long.parseLong(next());
   // }
   //
   // double nextDobule() {
   // return Double.parseDouble(next());
   // }
   // }

   Scanner in;
   PrintWriter out;

   class Team implements Comparable<Team> {
      int nGoals;
      int nleaves;
      String name;
      int nPoints;

      public Team(String name) {
         this.name = name;
      }

      @Override
      public int compareTo(Team second) {
         if (this.nPoints != second.nPoints) {
            return this.nPoints - second.nPoints;
         } else if (this.nGoals - this.nleaves != second.nGoals - second.nleaves) {
            return (this.nGoals - this.nleaves) - (second.nGoals - second.nleaves);
         } else if (this.nGoals != second.nGoals) {
            return this.nGoals - second.nGoals;
         } else {
            return -this.name.compareTo(second.name);

         }
      }
   }

   void solve() {
      TreeMap<String, Team> teams = new TreeMap<String, Main.Team>();
      for (int i = 0; i < 5; i++) {
         String first = in.next();
         String second = in.next();
         if (!teams.containsKey(first)) {
            teams.put(first, new Team(first));
         }
         if (!teams.containsKey(second)) {
            teams.put(second, new Team(second));
         }
         Team fTeam = teams.get(first);
         Team sTeam = teams.get(second);
         String score = in.next();
         int fTeamGoals = Integer.parseInt(score.substring(0, 1));
         int sTeamGoals = Integer.parseInt(score.substring(2, 3));
         if (fTeamGoals == sTeamGoals) {
            fTeam.nPoints++;
            fTeam.nGoals++;
            fTeam.nleaves++;
            sTeam.nPoints++;
            sTeam.nGoals++;
            sTeam.nleaves++;
         } else if (fTeamGoals > sTeamGoals) {
            fTeam.nPoints += 3;
            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;

            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;
         } else {
            sTeam.nPoints += 3;
            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;

            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;
         }
         teams.put(first, fTeam);
         teams.put(second, sTeam);
      }
      String berTeamSt = "BERLAND";
      Team berTeam = teams.get(berTeamSt);
      ArrayList<Team> teamList = new ArrayList<Main.Team>();
      for (String teamSt : teams.keySet()) {
         teamList.add(teams.get(teamSt));
      }
      Collections.sort(teamList);
      Team fTeam = berTeam;
      ArrayList<Team> teamBackUp = copy(teamList);
      boolean found = false;
      int bestNGoals = 0;
      int bestNLeaves = 100;
      for (Team sTeam : teamList) {
         if (!sTeam.name.equals(berTeam.name)) {
            for (int nG = 1; nG < 40; nG++) {
               for (int nL = 0; nL < nG; nL++) {
                  int fTeamGoals = nG;
                  int sTeamGoals = nL;
                  int tt = 0;
                  if (fTeamGoals == sTeamGoals) {
                     fTeam.nPoints++;
                     fTeam.nGoals++;
                     fTeam.nleaves++;
                     sTeam.nPoints++;
                     sTeam.nGoals++;
                     sTeam.nleaves++;
                     tt = 1;
                  } else if (fTeamGoals > sTeamGoals) {
                     fTeam.nPoints += 3;
                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;

                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;
                     tt = 2;
                  } else {
                     sTeam.nPoints += 3;
                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;

                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;
                     tt = 3;
                  }
                  Collections.sort(teamBackUp);
                  if (teamBackUp.get(2).name.equals(berTeamSt) || teamBackUp.get(3).name.equals(berTeamSt)) {
                     if (!found) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                     found = true;

                     if (nG - nL < bestNGoals - bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     } else if (nG - nL == bestNGoals - bestNLeaves && nL < bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                  }
                  if (tt == 1) {
                     fTeam.nPoints--;
                     fTeam.nGoals--;
                     fTeam.nleaves--;
                     sTeam.nPoints--;
                     sTeam.nGoals--;
                     sTeam.nleaves--;
                  } else if (tt == 2) {
                     fTeam.nPoints -= 3;
                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;

                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;
                  } else if (tt == 3) {
                     sTeam.nPoints -= 3;
                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;

                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;
                  }
               }
            }
         }
      }
      if (found) {
         Assertion.check(bestNGoals>0 && bestNLeaves<bestNGoals);
         out.print(bestNGoals + ":" + bestNLeaves);
      } else {
         out.println("IMPOSSIBLE");
      }
   }

   ArrayList<Team> copy(ArrayList<Team> from) {
      ArrayList<Team> copyList = new ArrayList<Main.Team>();
      for (Team team : from) {
         copyList.add(team);
      }
      return copyList;
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();
   }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class First
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class Team
{
    String teamName;
    int score;
    int goalFor;
    int goalAgainst;
    int matchPlayed;

    public Team(String teamName, int score, int goalFor, int goalAgainst, int matchPlayed)
    {
        super();
        this.teamName = teamName;
        this.score = score;
        this.goalFor = goalFor;
        this.goalAgainst = goalAgainst;
        this.matchPlayed = matchPlayed;
    }
}

class MyComparator implements Comparator<Team>
{
    @Override
    public int compare(Team t1, Team t2)
    {

        if(t1.score < t2.score) return 1;
        if(t1.score > t2.score) return -1;
        if(t1.goalFor - t1.goalAgainst < t2.goalFor - t2.goalAgainst) return 1;
        if(t1.goalFor - t1.goalAgainst > t2.goalFor - t2.goalAgainst) return -1;
        if(t1.goalFor < t2.goalFor) return 1;
        if(t1.goalFor > t2.goalFor) return -1;
        return t1.teamName.compareTo(t2.teamName);
    }
}

class TaskA
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        Set <String> hset = new HashSet <String> ();
        String[] inputStr = new String[5];
        for(int i = 0; i < 5; i++)
        {
            inputStr[i] = in.nextLine();
        }

        Team[] team = new Team[4];
        for(int i = 0; i < 5; i++)
        {
            String str = inputStr[i];
            str = str.replace(":", " ");
            String[] ans = str.split("[ ]+");
            hset.add(ans[0]); hset.add(ans[1]);
        }
        int index = 0;
        for(String str : hset)
        {
            int myScore = 0;
            int myGoalFor = 0;
            int myGoalAgainst = 0;
            int matchPlayed = 0;
            for(int i = 0; i < 5; i++)
            {
                String current = inputStr[i];
                current = current.replace(":", " ");
                String[] ans = current.split("[ ]+");
                String firstTeam = ans[0];
                String secondTeam = ans[1];
                int firstScoreGoal = Integer.parseInt(ans[2]);
                int secondScoreGoal = Integer.parseInt(ans[3]);

                if(firstTeam.equals(str))
                {
                    myGoalFor += firstScoreGoal;
                    myGoalAgainst += secondScoreGoal;
                    if(firstScoreGoal > secondScoreGoal)
                    {
                        myScore += 3;
                    }
                    if(firstScoreGoal == secondScoreGoal)
                        myScore++;
                    matchPlayed++;
                }
                if(secondTeam.equals(str))
                {
                    myGoalFor += secondScoreGoal;
                    myGoalAgainst += firstScoreGoal;
                    if(secondScoreGoal > firstScoreGoal) myScore += 3;
                    if(secondScoreGoal == firstScoreGoal) myScore++;
                    matchPlayed++;
                }
            }
            team[index++] = new Team(str, myScore, myGoalFor, myGoalAgainst, matchPlayed);
        }
        Arrays.sort(team, new MyComparator());

        index = 0; int i = 0;
        for(Team item : team)
        {   if(item.teamName.equals("BERLAND"))
                index = i;
            i++;
            //System.out.println(item.teamName + " " + item.score + "  " + item.goalFor + "  " + item.goalAgainst + " " + item.matchPlayed);
        }
        if(team[0].teamName.equals("BERLAND") || team[1].teamName.equals("BERLAND"))
            out.println("1:0");

        else
        {
            String secondTeamName = team[1].teamName;
            int secondScore = team[1].score;
            int secondGoalFor = team[1].goalFor;
            int secondGoalAgainst = team[1].goalAgainst;
            int differenceSecond = secondGoalFor - secondGoalAgainst;

            int berlandScore = team[index].score;
            int berlandGoalFor = team[index].goalFor;
            int berlandGoalAgainst = team[index].goalAgainst;
            int differenceBerland = berlandGoalFor - berlandGoalAgainst;
            if(secondScore <= berlandScore + 2)
            {
                out.println("1:0");
            }
            else if (secondScore > berlandScore + 3)
            {
                out.println("IMPOSSIBLE");
            }
            else
            {
                int kk = 0;
                for(int k = 1; k < 4; k++)
                {
                    if(team[k].teamName.equals("BERLAND") == false && team[k].matchPlayed == 2)
                    {
                        kk = k;
                        break;
                    }
                }
                Team[] tempTeam = new Team[4];

                for(int goals = 1; ; goals++)
                {
                    for(int step = 0; step < 4; step++)
                    {
                        tempTeam[step] = new Team(team[step].teamName, team[step].score, team[step].goalFor , team[step].goalAgainst, team[step].matchPlayed);
                    }

                    tempTeam[index].score += 3;
                    tempTeam[index].goalFor += goals;

                    tempTeam[kk].goalAgainst += goals;

                    Arrays.sort(tempTeam, new MyComparator());
                    if(tempTeam[0].teamName.equals("BERLAND") || tempTeam[1].teamName.equals("BERLAND"))
                    {
                        out.println(goals + ":0");
                        break;
                    }
                }
            }
        }
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next()
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
        {
            try
            {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public String nextLine()
    {
        String inputLine = "";
        try
        {
            inputLine = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return inputLine;
    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    static class Team{
        String name;
        int id;
        int winP;
        int goal;
        int missgoal;
        int rank=0;

        Team(int id,String name,
        int winP,int minssgoal,
        int goal){
            this.id=id;
            this.name=name;
            this.winP=winP;
            this.goal=goal;
            this.missgoal=minssgoal;
        }
    }

    int id=0;

    HashMap<String,Team> teams;

    boolean[][] game=new boolean[4][4];
    List<Team> teamlist;
    public void solve() {
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<4;i++){
            game[i][i]=true;
        }
        teams=new HashMap<String, Main.Team>();
        for (int i = 0; i < 5; i++) {
            String name1=sc.next();
            String name2=sc.next();

            String param=sc.next();
            int p1=param.charAt(0)-'0';
            int p2=param.charAt(2)-'0';

            Team t1,t2;
            if(!teams.containsKey(name1)){
                t1=new Team(id++,name1,0,0,0);
                teams.put(name1,t1);
            }else{
                t1=teams.get(name1);
            }
            if(!teams.containsKey(name2)){
                t2=new Team(id++,name2,0,0,0);
                teams.put(name2,t2);
            }else{
                t2=teams.get(name2);
            }

            game[t1.id][t2.id]=true;
            game[t2.id][t1.id]=true;
            t1.goal+=p1;
            t2.goal+=p2;
            t1.missgoal+=p2;
            t2.missgoal+=p1;
            if(p1<p2){
                t2.winP+=3;
            }else if(p1> p2){
                t1.winP+=3;
            }else{
                t1.winP++;
                t2.winP++;
            }
        }

        teamlist=new ArrayList<Team>();
        for(Entry<String,Team> team:teams.entrySet()){
            teamlist.add(team.getValue());
        }

        refreashRank();

        Team berand=null;
        for(Team team:teamlist){
            if(team.name.equals("BERLAND")){
                berand=team;
                break;
            }
        }

        int lastgameid=0;
        for(int i=0;i<4;i++){
            if(!game[i][berand.id]){
                lastgameid=i;break;
            }
        }

        Team lastGame=null;
        for(Team team:teamlist){
            if(team.id==lastgameid){
                lastGame=team;
            }
        }

        berand.winP+=3;
        int mx=Integer.MAX_VALUE;int my=0;
        for(int x=0;x<=9;x++){
            for(int y=0;y<x;y++){
                berand.goal+=x;
                lastGame.goal+=y;
                berand.missgoal+=y;
                lastGame.missgoal+=x;

                refreashRank();
                if(berand.rank<=1){
                    if(mx-my>=x-y && y<=my){
                        mx=x;
                        my=y;
                    }
                }
                berand.goal-=x;
                lastGame.goal-=y;
                berand.missgoal-=y;
                lastGame.missgoal-=x;
            }
        }

        if(mx==Integer.MAX_VALUE){
            pr("IMPOSSIBLE");
        }else{
            pr(mx+":"+my);
        }
    }

    public void  refreashRank(){
        Collections.sort(teamlist,new Comparator<Team>() {
            @Override
            public int compare(Team o1, Team o2) {
                if(o1.winP!=o2.winP){
                    return o2.winP-o1.winP;
                }
                if(o1.goal-o1.missgoal!=o2.goal-o2.missgoal){
                    return o2.goal-o2.missgoal-(o1.goal-o1.missgoal);
                }
                if(o1.goal!=o2.goal){
                    return o2.goal-o1.goal;
                }
                return o2.name.compareTo(o1.name);
            }
        });
        int rank=0;
        for(Team team:teamlist){
            team.rank=rank;
            rank++;
        }
    }

    public void run() {
        solve();
    }

    public static void main(String[] _) {
        new Main().run();
    }

    public static void pr() {
        System.out.println();
    }

    public static void pr(Object o) {
        System.out.println(o);
    }

}

import java.io.*;
import java.util.*;

/**
 * */
public class Solution {

	public static List<Team> listTeams=Collections.synchronizedList(new ArrayList<Team>(4));
	public static Team BERLAND=null;
	public static TeamComparator teamComparator=null;

	public class Team{
		public String name;
		public Map<String,Integer> selfScores=Collections.synchronizedMap(new HashMap<String,Integer>());
		public Map<String,Integer> oppScores=Collections.synchronizedMap(new HashMap<String,Integer>());

		public Integer points=0;
		public Integer goalDiff=0;
		public Integer goalFor=0;

		public Team(String name){
			this.name=name;
		}
	}
	public Team newTeam(String name){
		return new Team(name);
	}

	public static Team getTeam(String name){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			if(team.name.equals(name))
				return team;
		}
		return null;
	}

	public static int getBerlandRanking(){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			team.points=team.goalDiff=team.goalFor=0;
			Iterator<String> iterOpp=team.selfScores.keySet().iterator();
			while(iterOpp.hasNext()){
				String oppName=iterOpp.next();
				int selfScore=team.selfScores.get(oppName);
				int oppScore=team.oppScores.get(oppName);
				team.points+=(selfScore>oppScore)?3:(selfScore==oppScore)?1:0;
				team.goalDiff+=(selfScore-oppScore);
				team.goalFor+=selfScore;
				}}
		Collections.sort(listTeams,teamComparator);
		return listTeams.indexOf(BERLAND);
	}

	public class TeamComparator implements Comparator<Team>{

		@Override
		public int compare(Team team1, Team team2) {
			if(team1.points.equals(team2.points)){
				if(team1.goalDiff.equals(team2.goalDiff)){
					if(team1.goalFor.equals(team2.goalFor))
						return team2.name.compareTo(team1.name);
					return team1.goalFor.compareTo(team2.goalFor);
				}
				return team1.goalDiff.compareTo(team2.goalDiff);
			}
			return team1.points.compareTo(team2.points);
		}}
	public TeamComparator newTeamComparator(){
		return new TeamComparator(); }

	/**
	 * @param args
	 */
	public static void main(String[] args){
	    try {

	    	BufferedReader reader =new BufferedReader( new InputStreamReader( System.in)); // STDIN

	    	// Teams
	    	Solution solution=new Solution();
	    	listTeams.add(solution.newTeam("BERLAND"));
	    	BERLAND=getTeam("BERLAND");
	    	teamComparator=solution.newTeamComparator();

	    	//
	    	for(int i=0;i!=5;i++){
	    		String[] result=reader.readLine().trim().split(" ",3);
	    		// Team1
	    		String name1=result[0].trim();
	    		Team team1=getTeam(name1);
	    		if(team1==null){
	    			listTeams.add(solution.newTeam(name1));
	    			team1=getTeam(name1);
	    		}
	    		// Team2
	    		String name2=result[1].trim();
	    		Team team2=getTeam(name2);
	    		if(team2==null){
	    			listTeams.add(solution.newTeam(name2));
	    			team2=getTeam(name2);
	    		}
	    		String[] score=result[2].trim().split(":",2);
	    		Integer score1=Integer.valueOf(score[0].trim());
	    		Integer score2=Integer.valueOf(score[1].trim());
	    		team1.selfScores.put(team2.name,score1);
	    		team1.oppScores.put(team2.name,score2);
	    		team2.selfScores.put(team1.name,score2);
	    		team2.oppScores.put(team1.name,score1);
	    	}

	    	String oppName="";
	    	Iterator<Team> iterTeam=listTeams.iterator();
	    	while(iterTeam.hasNext()&&(oppName=="")){
	    		Team team=iterTeam.next();
	    		if((team.oppScores.size()==2)&&(team.name!="BERLAND"))
	    			oppName=team.name; }

	    	//
	    	boolean bPossible=false;
	    	for(int diff=0;diff<=30;diff++){
	    		for(int opp=0;opp<=30;opp++){
	    			int selfScore=diff+opp;
	    			Team oppTeam=getTeam(oppName);
	    			oppTeam.selfScores.put(BERLAND.name,opp);
	    			oppTeam.oppScores.put(BERLAND.name,selfScore);
	    			BERLAND.selfScores.put(oppName,selfScore);
	    			BERLAND.oppScores.put(oppName,opp);
	    			if(getBerlandRanking()>=2){
	    				System.out.println(selfScore+":"+opp);
	    				bPossible=true;
	    				break;
	    			}
	    		}
	    		if(bPossible)
	    			break;
	    	}
	    	if(!bPossible)
	    		System.out.println("IMPOSSIBLE");

		    }catch(Exception e){
		    	e.printStackTrace(System.err);
		}
	}
}

import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;

public class C {
	private static void solve() throws IOException {
		HashMap<String, Info> a = new HashMap<String, Info>();
		for(int i = 0; i < 5; i++) {
			String n1 = nextToken(), n2 = nextToken(), n3 = nextToken();
			String[] b = n3.split(":");
			int s1 = Integer.parseInt(b[0]);
			int s2 = Integer.parseInt(b[1]);
			int w1 = 1, w2 = 1;
			if(s1 > s2) {
				w1 = 3;
				w2 = 0;
			}
			else if(s1 < s2) {
				w1 = 0;
				w2 = 3;
			}
			if(a.containsKey(n1)) {
				a.get(n1).gf += s1;
				a.get(n1).go += s2;
				a.get(n1).w += w1;
			}
			else
				a.put(n1, new Info(s1, s2, w1));

			if(a.containsKey(n2)) {
				a.get(n2).gf += s2;
				a.get(n2).go += s1;

				a.get(n2).w += w2;
			}
			else
				a.put(n2, new Info(s2, s1, w2));
		}
		boolean f = false;

		a.get("BERLAND").w += 3;
		for(int d = 1; d < 200 && !f; d++) {
			for(int y = 0; y < 200 && !f; y++) {

				Iterator<String> it1 = a.keySet().iterator();
				while(it1.hasNext()) {

					int x = d + y;
					String op = it1.next();
					if(op.compareTo("BERLAND") == 0)
						continue;
					a.get(op).gf += y;
					a.get(op).go += x;
					a.get("BERLAND").gf += x;
					a.get("BERLAND").go += y;
					Iterator<String> it = a.keySet().iterator();
					int num = 0;
					while(it.hasNext()) {
						String cur = it.next();
						if(cur.equals("BERLAND"))
							continue;
						Info o = a.get(cur);
						if(o.compareTo(a.get("BERLAND")) > 0)
							num++;
						else if(o.compareTo(a.get("BERLAND")) == 0)
							if(cur.compareTo("BERLAND") < 0)
								num++;
					}

					a.get(op).gf -= y;
					a.get(op).go -= x;
					a.get("BERLAND").gf -= x;
					a.get("BERLAND").go -= y;
					if(num <= 1) {
						out.println(x + ":" + y);
						f = true;
						break;
					}
				}
			}
		}

		if(!f)
			out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(239);
		}
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}
class Info implements Comparable<Info>{
	int gf, go, w;
	Info(int f, int o, int w) {
		gf = f;
		go = o;
		this.w = w;
	}
	public int compareTo(Info o) {
		if(this.w > o.w)
			return 1;
		else if(this.w < o.w)
			return -1;
		else if(this.gf - this.go < o.gf - o.go)
			return -1;
		else if(this.gf - this.go > o.gf - o.go)
			return 1;
		else if(this.gf < o.gf)
			return -1;
		else if(this.gf > o.gf)
			return 1;
		else
			return 0;
	}
}

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main
{
    public static class GameResults
    {
        int points;
        int successful_balls;
        int unsuccessful_balls;
        int games_played;
        GameResults()
        {
            points = 0;
            successful_balls = 0;
            unsuccessful_balls = 0;
            games_played = 0;
        }
    }
    public static class Answer
    {
        int good;
        int bad;
        Answer()
        {
            good = 100;
            bad = 0;
        }
    }
    static boolean is_better( GameResults arg1, GameResults arg2, String arg1_name, String arg2_name )
    {
        if ( arg1.points > arg2.points ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls > arg2.successful_balls - arg2.unsuccessful_balls ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls == arg2.successful_balls - arg2.unsuccessful_balls &&
                  arg1.successful_balls > arg2.successful_balls ) return true;
        else if ( arg1.points == arg2.points && arg1.successful_balls - arg1.unsuccessful_balls == arg2.successful_balls - arg2.unsuccessful_balls &&
                  arg1.successful_balls == arg2.successful_balls && arg1_name.compareTo( arg2_name ) < 0 ) return true;
        else return false;
    }
    public static void main( String[] args )
    {
        Scanner in = new Scanner( System.in );
        Map < String, GameResults > football_result = new TreeMap<String, GameResults>();
        for ( int i = 1; i < 6; i++ )
        {
            String first_team_name = in.next();
            String second_team_name = in.next();
            if ( football_result.get( first_team_name ) == null ) football_result.put( first_team_name, new GameResults() );
            if ( football_result.get( second_team_name ) == null ) football_result.put( second_team_name, new GameResults() );
            String balls = in.next();
            int first_team_balls = Character.digit( balls.charAt( 0 ), 10 );
            int second_team_balls = Character.digit( balls.charAt( 2 ), 10 );
            football_result.get( first_team_name ).successful_balls += first_team_balls;
            football_result.get( first_team_name ).unsuccessful_balls += second_team_balls;
            football_result.get( first_team_name ).games_played++;
            football_result.get( second_team_name ).successful_balls += second_team_balls;
            football_result.get( second_team_name ).unsuccessful_balls += first_team_balls;
            football_result.get( second_team_name ).games_played++;
            if ( first_team_balls > second_team_balls ) football_result.get( first_team_name ).points += 3;
            else if ( first_team_balls == second_team_balls )
            {
                football_result.get( first_team_name ).points += 1;
                football_result.get( second_team_name ).points += 1;
            }
            else football_result.get( second_team_name ).points += 3;
        }
        football_result.get( "BERLAND" ).points += 3;

        String opponent_team = "";
        for ( String element : football_result.keySet() )
        {
            if ( element.equals( "BERLAND" ) ) continue;
            if ( football_result.get( element ).games_played < 3 ) opponent_team = element;
        }

        Answer answer = new Answer();
        for ( int good = 1; good < 100; good++ )
        {
            for ( int bad = 0; bad < good; bad++ )
            {
                football_result.get( opponent_team ).unsuccessful_balls += good;
                football_result.get( opponent_team ).successful_balls += bad;
                football_result.get( "BERLAND" ).successful_balls += good;
                football_result.get( "BERLAND" ).unsuccessful_balls += bad;
                int count = 0;
                for ( String element : football_result.keySet() )
                {
                    if ( element.equals( "BERLAND" ) ) continue;
                    if ( is_better( football_result.get( "BERLAND" ), football_result.get( element ), "BERLAND", element ) ) count++;
                    if ( count >= 2 )
                    {
                        if ( answer.good - answer.bad > good - bad ) { answer.good = good; answer.bad = bad; }
                        else if ( answer.good - answer.bad == good - bad && answer.bad > bad ) { answer.good = good; answer.bad = bad; }
                    }
                }
                football_result.get( opponent_team ).unsuccessful_balls -= good;
                football_result.get( opponent_team ).successful_balls -= bad;
                football_result.get( "BERLAND" ).successful_balls -= good;
                football_result.get( "BERLAND" ).unsuccessful_balls -= bad;
            }
        }
        if ( answer.good == 100 ) System.out.println( "IMPOSSIBLE" );
        else System.out.println( answer.good + " " + answer.bad );
    }
}

import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        HashMap<String, State> teams = new HashMap<>();
        for (int i = 0; i < 5; ++i) {
            String x = sc.next(), y = sc.next();
            String[] z = sc.next().split(":");
            int a = Integer.parseInt(z[0]), b = Integer.parseInt(z[1]);
            teams.computeIfAbsent(x, State::new).update(a, b);
            teams.computeIfAbsent(y, State::new).update(b, a);
        }
        String t1 = "BERLAND", t2 = null;
        for(Map.Entry<String, State> e: teams.entrySet())
            if(e.getValue().played == 2 && !e.getKey().equals(t1))
                t2 = e.getKey();
        State s1 = teams.get(t1), s2 = teams.get(t2);

        boolean possible = false;
        ll: for(int d = 1; d < 100; ++d)
            for(int i = 1; i < 100; ++i) {
                int j = i - d;
                State bState = s1.play(i, j);
                teams.put(t1, bState);
                teams.put(t2, s2.play(j, i));
                int cnt = 0;
                for (State s: teams.values())
                    if(s.compareTo(bState) < 0)
                        ++cnt;
                if (cnt <= 1) {
                    possible = true;
                    out.println(i + ":" + j);
                    break ll;
                }
            }

        if (!possible) out.println("IMPOSSIBLE");
        out.close();

    }

    static class State implements Comparable<State> {
        int points, goalsFor, goalsAgainst, played;
        String name;

        State(String s) { name = s; }

        void update(int x, int y) {
            goalsFor += x;
            goalsAgainst += y;
            points += x > y ? 3 : x < y ? 0 : 1;
            played++;
        }

        State play(int x, int y) {
            State newState = new State(name);
            newState.points = points;
            newState.goalsFor = goalsFor;
            newState.goalsAgainst = goalsAgainst;
            newState.update(x, y);
            return newState;
        }

        @Override
        public int compareTo(State s) {
            if (points != s.points)
                return s.points - points;
            int gd1 = goalsFor - goalsAgainst;
            int gd2 = s.goalsFor - s.goalsAgainst;
            if (gd1 != gd2)
                return gd2 - gd1;
            if (goalsFor != s.goalsFor)
                return s.goalsFor - goalsFor;
            return name.compareTo(s.name);
        }
    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public boolean ready() throws IOException {return br.ready();}

    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		long time_beg = -1;
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		if (args.length > 0 && args[0].equals("outside")) {
			time_beg = System.currentTimeMillis();
			try {
				inputStream = new FileInputStream("io/in.txt");
//				outputStream = new FileOutputStream("io/out.txt");
			} catch (Exception e) {
				System.err.println(e);
				System.exit(1);
			}
		} else {
//			try {
//				inputStream = new FileInputStream("file_name");
//				outputStream = new FileOutputStream("file_name");
//			} catch (Exception e) {
//				System.err.println(e);
//				System.exit(1);
//			}
		}
		Solver s = new Solver();
		s.in = new InputReader(inputStream);
		s.out = new OutputWriter(outputStream);
		s.solve();
		s.out.close();
		if (args.length > 0 && args[0].equals("outside")) {
			System.err.printf("*** Total time: %.3f ***\n", (System.currentTimeMillis() - time_beg) / 1000.0);
		}
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object... objects) {
		writer.printf(format, objects);
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}
}

class Solver {
	InputReader in;
	OutputWriter out;

	void solve() {
		HashMap<String, Integer> M = new HashMap<>();
		String[] MR = new String[4];
		int count = 0;
		int[][] mas = new int[4][4];
		for (int j = 0; j < 4; ++j)
			for (int i = 0; i < 4; ++i)
				mas[j][i] = -1;
		for (int i = 0; i < 5; ++i) {
			String s = in.readLine();
			s = s.replace(':', ' ');
			String[] temp = s.split(" ");
			if (!M.containsKey(temp[0])) {
				MR[count] = temp[0];
				M.put(temp[0], count++);
			}
			if (!M.containsKey(temp[1])) {
				MR[count] = temp[1];
				M.put(temp[1], count++);
			}
			mas[M.get(temp[0])][M.get(temp[1])] = Integer.parseInt(temp[2]);
			mas[M.get(temp[1])][M.get(temp[0])] = Integer.parseInt(temp[3]);
		}
		int me = M.get("BERLAND");
		int he;
		for (he = 0; he < 4; ++he)
			if (he != me) {
				boolean flag = false;
				for (int i = 0; i < 4; ++i)
					if (he != i && mas[he][i] == -1) {
						flag = true;
						break;
					}
				if (flag) break;
			}
		for (int x = 1; x < 100; ++x)
			for (int y = x - 1; y >= 0; --y) {
				mas[me][he] = x;
				mas[he][me] = y;
				int[] P = new int[4];
				int[] miss = new int[4];
				int[] hit = new int[4];
				for (int j = 0; j < 4; ++j)
					for (int i = 0; i < 4; ++i)
						if (j != i) {
							if (mas[j][i] > mas[i][j]) P[j] += 3;
							if (mas[j][i] == mas[i][j]) P[j] += 1;
							hit[j] += mas[j][i];
							miss[j] += mas[i][j];
						}
				ArrayList<Pair<Pair<Integer, Integer>, Pair<Integer, String>>> A = new ArrayList<>();
				for (int i = 0; i < 4; ++i)
					A.add(new Pair<Pair<Integer, Integer>, Pair<Integer, String>>(
							new Pair<Integer, Integer>(-P[i], -hit[i] + miss[i]),
							new Pair<Integer, String>(-hit[i], MR[i])));
				Collections.sort(A);
				if (A.get(0).second.second == MR[me] || A.get(1).second.second == MR[me]) {
					out.printFormat("%d:%d\n", x, y);
					return;
				}
			}
		out.printLine("IMPOSSIBLE");
	}
}

class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
	U first;
	V second;

	Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair<U, V> o) {
		int value = first.compareTo(o.first);
		if (value != 0) return value;
		return second.compareTo(o.second);
	}

	@Override
	public String toString() {
		return "(" + first + ", " + second + ")";
	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

    static class Team{
        String name;
        int id;
        int winP;
        int goal;
        int missgoal;
        int rank=0;

        Team(int id,String name,
        int winP,int minssgoal,
        int goal){
            this.id=id;
            this.name=name;
            this.winP=winP;
            this.goal=goal;
            this.missgoal=minssgoal;
        }
    }

    int id=0;

    HashMap<String,Team> teams;

    boolean[][] game=new boolean[4][4];
    List<Team> teamlist;
    public void solve() {
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<4;i++){
            game[i][i]=true;
        }
        teams=new HashMap<String, Main.Team>();
        for (int i = 0; i < 5; i++) {
            String name1=sc.next();
            String name2=sc.next();

            String param=sc.next();
            int p1=param.charAt(0)-'0';
            int p2=param.charAt(2)-'0';

            Team t1,t2;
            if(!teams.containsKey(name1)){
                t1=new Team(id++,name1,0,0,0);
                teams.put(name1,t1);
            }else{
                t1=teams.get(name1);
            }
            if(!teams.containsKey(name2)){
                t2=new Team(id++,name2,0,0,0);
                teams.put(name2,t2);
            }else{
                t2=teams.get(name2);
            }

            game[t1.id][t2.id]=true;
            game[t2.id][t1.id]=true;
            t1.goal+=p1;
            t2.goal+=p2;
            t1.missgoal+=p2;
            t2.missgoal+=p1;
            if(p1<p2){
                t2.winP+=3;
            }else if(p1> p2){
                t1.winP+=3;
            }else{
                t1.winP++;
                t2.winP++;
            }
        }

        teamlist=new ArrayList<Team>();
        for(Entry<String,Team> team:teams.entrySet()){
            teamlist.add(team.getValue());
        }

        refreashRank();

        Team berand=null;
        for(Team team:teamlist){
            if(team.name.equals("BERLAND")){
                berand=team;
                break;
            }
        }

        int lastgameid=0;
        for(int i=0;i<4;i++){
            if(!game[i][berand.id]){
                lastgameid=i;break;
            }
        }

        Team lastGame=null;
        for(Team team:teamlist){
            if(team.id==lastgameid){
                lastGame=team;
            }
        }

        berand.winP+=3;
        int mx=Integer.MAX_VALUE;int my=0;
        for(int x=0;x<=60;x++){
            for(int y=0;y<x;y++){
                berand.goal+=x;
                lastGame.goal+=y;
                berand.missgoal+=y;
                lastGame.missgoal+=x;

                refreashRank();
                if(berand.rank<=1){
                    if(mx-my>=x-y && y<=my){
                        mx=x;
                        my=y;
                    }
                }
                berand.goal-=x;
                lastGame.goal-=y;
                berand.missgoal-=y;
                lastGame.missgoal-=x;
            }
        }

        if(mx==Integer.MAX_VALUE){
            pr("IMPOSSIBLE");
        }else{
            pr(mx+":"+my);
        }
    }

    public void  refreashRank(){
        Collections.sort(teamlist,new Comparator<Team>() {
            @Override
            public int compare(Team o1, Team o2) {
                if(o1.winP!=o2.winP){
                    return o2.winP-o1.winP;
                }
                if(o1.goal-o1.missgoal!=o2.goal-o2.missgoal){
                    return o2.goal-o2.missgoal-(o1.goal-o1.missgoal);
                }
                if(o1.goal!=o2.goal){
                    return o2.goal-o1.goal;
                }
                return o2.name.compareTo(o1.name);
            }
        });
        int rank=0;
        for(Team team:teamlist){
            team.rank=rank;
            rank++;
        }
    }

    public void run() {
        solve();
    }

    public static void main(String[] _) {
        new Main().run();
    }

    public static void pr() {
        System.out.println();
    }

    public static void pr(Object o) {
        System.out.println(o);
    }

}

import java.io.*;
import java.util.*;

public class C {

	HashMap<String, Team> mapper = new HashMap<String, C.Team>();
	ArrayList<Team> teams = new ArrayList<C.Team>();

	void run() throws IOException{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		Team berland=null;

		for(int i=0; i<5; i++){
			String[] toks = bf.readLine().trim().split("[ :]+");
			Team t1 = mapper.get(toks[0]);
			if(t1==null){
				t1 = new Team(toks[0]);
				mapper.put(toks[0], t1);
				teams.add(t1);
			}

			Team t2 = mapper.get(toks[1]);
			if(t2==null){
				t2 = new Team(toks[1]);
				mapper.put(toks[1], t2);
				teams.add(t2);
			}
			int g1 = Integer.parseInt(toks[2]);
			int g2 = Integer.parseInt(toks[3]);
			t1.addResult(g1, g2);
			t2.addResult(g2, g1);
		}

		Collections.sort(teams);
//		for(int i=0; i<teams.size(); i++) System.out.println(teams.get(i));
		Team t2=null;
		for(int i=0; i<teams.size(); i++){
			if(teams.get(i).name.equals("BERLAND")) berland = teams.get(i);
			else if(teams.get(i).numPlayed<3) t2 = teams.get(i);
		}

		if(berland.points+3<teams.get(1).points){
			System.out.println("IMPOSSIBLE");
		} else if(teams.get(1).name.equals("BERLAND") || berland.points+3>teams.get(1).points){
			System.out.println("1:0");
		} else{
			for(int g1=0; g1<100; g1++){
				for(int g2=0; g2<g1; g2++){
					berland.addResult(g1, g2);
					t2.addResult(g2, g1);

					Collections.sort(teams);
					if(berland.compareTo(teams.get(1)) <= 0){
						System.out.println(g1 + ":" + g2);
						return;
					}else{
						berland.removeResult(g1, g2);
						t2.removeResult(g2, g1);
						Collections.sort(teams);
					}
				}
			}
		}
	}

	public static void main(String[] args)throws IOException {
		new C().run();
	}

	class Team implements Comparable<Team>{

		String name;
		int points;
		int goals;
		int misses;
		int numPlayed=0;

		public Team(String name){
			this.name = name;
		}

		void addResult(int goals, int misses){
			numPlayed++;
			this.goals += goals;
			this.misses += misses;
			if(goals>misses) points+=3;
			else if(goals==misses) points++;
		}

		void removeResult(int goals, int misses){
			numPlayed--;
			this.goals -= goals;
			this.misses -= misses;
			if(goals>misses) points-=3;
			else if(goals==misses) points--;
		}

		@Override
		public int compareTo(Team t) {
			int diff = t.points-points;
			if(diff==0) diff = (t.goals-t.misses) - (goals-misses);
			if(diff==0) diff = t.goals-goals;
			if(diff==0) diff = name.compareTo(t.name);
			return diff;
		}

		public String toString(){
			String s = name + ": " + points + ", " + goals + ", " + misses +", played = " + numPlayed;
			return s;
		}
	}
}

import java.util.*;
import java.io.*;

public class cf200c {
  static Map<String, Integer> names = new HashMap<String, Integer>();
  static Map<Integer, String> rev = new HashMap<Integer, String>();
  public static void main(String[] args) {
    FastIO in = new FastIO(), out = in;
    names.put("BERLAND",0);
    rev.put(0,"BERLAND");

    int[][] v = new int[4][4];
    for(int[] x : v) Arrays.fill(x,-1);
    for(int i=0; i<5; i++) {
      String team1 = in.next().trim();
      int t1 = names.size();
      if(names.containsKey(team1)) t1 = names.get(team1);
      else names.put(team1,t1);
      String team2 = in.next().trim();
      int t2 = names.size();
      if(names.containsKey(team2)) t2 = names.get(team2);
      else names.put(team2,t2);
      String[] g = in.next().trim().split(":");
      int g1 = Integer.parseInt(g[0]);
      int g2 = Integer.parseInt(g[1]);
      v[t1][t2] = g1;
      v[t2][t1] = g2;
      rev.put(t1,team1);
      rev.put(t2,team2);
    }
    int other = 0;
    int bestx = -1, besty = -1;
    for(int i=1; i<4; i++)
      if(v[0][i] == -1) other = i;
    for(int x=0; x<100; x++)
      for(int y=0; y<x; y++) {
        v[0][other] = x;
        v[other][0] = y;
        if(ok(v)) {
          if(bestx == -1 || (x-y < bestx - besty) || (x-y == bestx - besty && y < besty)) {
            bestx = x;
            besty = y;
          }
        }
      }
    if(bestx == -1) out.println("IMPOSSIBLE");
    else out.println(bestx+":"+besty);
    out.close();
  }
  static boolean ok(int[][] v) {
    Team[] teams = new Team[4];
    for(int i=0; i<4; i++)
      teams[i] = new Team(rev.get(i), i);

    for(int i=0; i<4; i++)
      for(int j=0; j<4; j++) {
        if(i == j) continue;
        if(v[i][j] > v[j][i]) teams[i].points += 6;
        if(v[i][j] == v[j][i]) teams[i].points += 2;
        teams[i].goals += v[i][j];
        teams[i].misses += v[j][i];
      }

    Arrays.sort(teams);
    return teams[0].id == 0 || teams[1].id == 0;
  }
  static class Team implements Comparable<Team> {
    String name;
    int id, points, goals, misses;
    Team(String s, int v) {
      name = s; id = v;
    }
    public int compareTo(Team t) {
      if(points != t.points) return t.points - points;
      if(goals - misses != t.goals - t.misses) return (t.goals - t.misses) - (goals - misses);
      if(goals > t.goals) return t.goals - goals;
      return name.compareTo(t.name);
    }
  }
  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in,System.out);
    }
    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }
    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch(Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }
    public int numTokens() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }
    public String next() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }
    public double nextDouble() {
      return Double.parseDouble(next());
    }
    public long nextLong() {
      return Long.parseLong(next());
    }
    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}

import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.System.*; import static java.util.Arrays.*;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;

public class C {
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintStream out = System.out;

    static int m = 0, n = 0;
    static int result = 0;
    static String[] a;

    static class Team implements Comparable<Team> {

    	public String name;
    	public int matches, points, goalFor, goalAgainst;

		public Team(String name) {
			this.name = name;
			matches = 0;
			points = 0;
			goalFor = 0;
			goalAgainst = 0;
		}

		public void addMatch (int co, int u, int v) {
			if (u==v) points +=1 * co;
			if (u>v) points +=3 * co;
			goalFor += u * co;
			goalAgainst += v * co;
			matches += co;
		}

		public int compareTo(Team t) {
			if (points!= t.points) return t.points - points;
			if (goalFor-goalAgainst!= t.goalFor-t.goalAgainst) return (t.goalFor-t.goalAgainst) - (goalFor-goalAgainst);
			if (goalFor!= t.goalFor) return t.goalFor - goalFor;
			return name.compareTo(t.name);
		}

		void debug () {
			C.debug(name, matches, points, goalFor, goalAgainst);
		}
	}

    static ArrayList<Team> list;

	static void readInput() throws IOException {
		list = new ArrayList<C.Team> ();
		a = new String[5];
		for (int i = 0; i < 5; i++) {
			a[i] = in.readLine().trim();
			add (a[i]);
		}
	}

	static void add (String s) {
		String [] teams = s.split("[ ]+");
		String [] scores = teams[2].split(":");
		int u = -1, v = -1;
		int su = new Integer(scores[0]), sv = new Integer(scores[1]);
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).name .equals(teams[0])) u = i;
			if (list.get(i).name .equals(teams[1])) v = i;
		}
		if (u==-1) {
			list.add(new Team(teams[0]));
			u = list.size()-1;
		}
		if (v==-1) {
			list.add(new Team(teams[1]));
			v = list.size()-1;
		}

		list.get(u).addMatch(1, su, sv);
		list.get(v).addMatch(1, sv, su);
	}

	static int ru = -1, rv = -1;
	static void process() {
		ru = -1;
		rv = -1;
		Team berland = new Team(""), other = new Team("");
		for(Team team:list) if(team.matches ==2 && !team.name.equals("BERLAND")) other = team;
		for(Team team:list) if(team.name.equals("BERLAND")) berland = team;

		for (int i = 0; i < 50; i++) for (int j = 0; j < 50; j++) if (i>j) {
			berland.addMatch(1, i, j);
			other.addMatch(1, j,i);

			Collections.sort(list);
			if(list.get(0).name.equals("BERLAND") || list.get(1).name.equals("BERLAND")) update( i, j);

			berland.addMatch(-1, i, j);
			other.addMatch(-1, j,i);
		}

		if(ru==-1) out.println("IMPOSSIBLE");
		else out.println(ru+":"+rv);
	}

	private static void update(int u, int v) {
		if (ru==-1) {
			ru = u; rv = v; return;
		}
		if (ru-rv > u-v) {
			ru = u;rv = v;return;
		}
		if (rv > v) {
			ru = u;rv = v;return;
		}
	}

	public static void main(String[] args) throws IOException {
		readInput();
		process();
	}

	public static void debug(Object...os) {
		System.err.println(Arrays.deepToString(os));
	}

	static int[] readArrInt() throws IOException {
		return parseArrInt(in.readLine());
	}

	static int readInt() throws IOException {
		return new Integer(in.readLine());
	}

	static int[] parseArrInt(String s) {
		StringTokenizer st = new StringTokenizer(s);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while (st.hasMoreTokens()) {
			list.add(Integer.parseInt(st.nextToken()));
		}
		Integer[] temp = list.toArray(new Integer[]{});
		int[] res = new int[temp.length];
		for (int i = 0; i < temp.length; i++) {
			res[i] = temp[i];
		}
		return (res);
	}

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        in.useDelimiter("\n");
        int i,points[]=new int[4],scored[]=new int[4],missed[]=new int[4],j,index=0,num[]=new int[4];
        String tea1,tea2="";
        ArrayList<String> team=new ArrayList<String>();
        for(i=0;i<5;i++)
        {
            String s[]=in.next().split(" ");
            tea1=s[0];
            tea2=s[1];
            if(!team.contains(tea1))
            {
                team.add(tea1);

            }
            index=team.indexOf(tea1);
            scored[index]+=s[2].charAt(0)-48;
            missed[index]+=s[2].charAt(2)-48;
            if(s[2].charAt(0)>s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
            if(!team.contains(tea2))
            {
                team.add(tea2);

            }
            index=team.indexOf(tea2);
            scored[index]+=s[2].charAt(2)-48;
            missed[index]+=s[2].charAt(0)-48;
            if(s[2].charAt(0)<s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
        }
        table a[]=new table[4];
        for(i=0;i<4;i++)
            a[i]=new table(team.get(i),points[i],scored[i],missed[i]);
        for(i=0;i<4;i++)
        {
            if(num[i]==2&&(team.get(i).equals("BERLAND")==false))
                tea2=team.get(i);

        }
        Arrays.sort(a);
        int index2=0;
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
            out.println("1:0");
            return;
        }
        if(a[1].points-a[index].points>3)
        {
            out.println("IMPOSSIBLE");
            return;
        }
        if(a[1].points-a[index].points<3)
        {
            out.println("1:0");
            return;
        }
        a[index].points+=3;
        a[index].s+=1;
        a[index2].m+=1;
        Arrays.sort(a);
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
           out.println("1:0");
            return;
        }
        for(j=2;;j++)
        {
            a[index].s+=1;
            a[index2].m+=1;
            Arrays.sort(a);
            for(i=0;i<4;i++)
            {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

            }
            if(index<2)
            {
                out.println(j+":0");
                break;
            }
        }
	}
    class table implements Comparable<table>
    {
        String tname;
        int points,s,m;
        public table(String tname,int points,int s,int m)
        {
            this.tname=tname;
            this.points=points;
            this.s=s;
            this.m=m;
        }
        public int compareTo(table a)
        {
            if(a.points>this.points)
                return 1;
            else if(a.points<this.points)
                return -1;
            else
            {
                int diff1=a.s-a.m;
                int diff2=this.s-this.m;
                if(diff1>diff2)
                    return 1;
                else if(diff1<diff2) return -1;
                else
                {
                    if(a.s>this.s) return 1;
                    else if(a.s<this.s) return -1;
                    else
                    {
                        return ((a.tname).compareTo(this.tname)<0?1:-1);
                    }
                }
            }
        }
    }
}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else if(a==b){a=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1],bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb,p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; break;}
	  if(!g.equals("BERLAND"))que.add(map.get(g));
	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	//for(int i=0;i<4;i++)
	//{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<10;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3,bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , 0 ,opp.m + t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();

	//dd(r);
	//dd(rr);
	//while(!que.isEmpty())dd(que.poll());
	//db("");
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		// db(x,y);
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? 1:-1;
		   }

}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else if(a==b){a=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1],bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb,p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; }
	  if(!g.equals("BERLAND"))que.add(map.get(g));

	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	//for(int i=0;i<4;i++)
	//{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<50;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3,bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , 0 ,opp.m + t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();

//	dd(r);
	//dd(rr);
	///while(!que.isEmpty())dd(que.poll());
	//db("");
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		 db(x,y,"kitaaaaaaaaaaaaaaaaaaaaaaa");
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? 1:-1;
		   }

}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		for(int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if(val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			}
			else if(val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			}
			else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
		}
		String str = "BERLAND";
		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for(String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st);

		}
		Arrays.sort(arr);
		idx = 0;
		for(int x = 0; x < 4; x++) {
			if((arr[x].key).equals(str)) {
				req = idx;
			}
			idx++;
		}
		if(req < 2) {
			System.out.println("1:0");
			return;
		}
		else {
			if(arr[1].val - arr[req].val <= 1 ) {
				System.out.println("1:0");
			}
			else if(arr[1].val - arr[req].val <= 3 ) {
				int val = goals.get(arr[1].key) - goals.get(arr[req].key) + 1;
				if(val <= 0) {
					System.out.println("1:0");
				}
				else
					System.out.println(val + ":0");
			}
			else {
				System.out.println("IMPOSSIBLE");
			}
		}
	}

	static class pair implements Comparable<pair>{
		int val;
		String key;
		pair(int val, String key) {
			this.val = val;
			this.key = key;
		}

		public int compareTo(pair obj) {
			return obj.val - this.val;
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[4];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        Score other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = map.get(name);
                }

            } else {
                ber = map.get(name);
            }
            data[index++] = map.get(name);
        }
        ber.score += 1;
        ber.point += 3;

        other.miss += 1;
        Arrays.sort(data);
      //  System.out.println(ber.score + " "+ data[2].score);
        if (ber.point < data[2].point) {
            out.println("IMPOSSIBLE");
        } else {
            int left = 1;
            int right = 0;
       //     System.out.println(data[2].name + " ");
            while (!data[2].name.equals("BERLAND") && !data[3].name.equals("BERLAND")) {
                int difBer = ber.score - ber.miss;
                int difSe = data[2].score - data[2].miss;
                int need = difSe - difBer;
                if (need == 0) {
                 //   System.out.println("HE HE");
                    if (data[2].score > ber.score && !data[2].name.equals(other.name)) {
                        int more = data[2].score - ber.score + 1;
                        left += more;
                        right += more;
                        ber.score += more;
                        ber.miss += more;
                        other.miss += more;
                        other.miss += more;
                    } else {
                        ber.score += 1;
                        left++;
                        other.miss++;
                    }

                } else {
                    if (!data[2].name.equals(other.name)) {
                        int more = need;
                        int miss = 0;
                        while(data[2].score > ber.score + more){
                            more++;
                            miss++;
                        }
                        if(data[2].name.compareTo(ber.name) < 0){
                            more++;
                            miss++;
                        }
                        left += more;
                        right += miss;
                        ber.score += more;
                        ber.miss += miss;
                        other.miss += more;
                        other.score += miss;
                    } else {
                        int more = need + 1;
                        int a = more / 2;
                        if (more % 2 != 0) {
                            a++;
                        }
                        left += a;
                        ber.score += a;
                        other.miss += a;
                    }
                }
                Arrays.sort(data);
            }
            out.println(left + ":" + right);

        }
        // System.out.println(second.point);

        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static Pair cal(ArrayList<Integer>[] map, HashSet<Integer> result, HashSet<Pair> check, int pa, int node) {
        boolean taken = false;
        if (check.contains(new Pair(pa, node)) || check.contains(new Pair(node, pa))) {
            taken = true;
        }
        boolean leaf = true;

        ArrayList<Integer> list = new ArrayList();
        Pair store = null;
        for (int next : map[node]) {
            if (next != pa) {
                leaf = false;

                Pair p = cal(map, result, check, node, next);
                if (p.y == 1) {
                    store = p;
                    taken = false;

                } else {
                    if (store == null) {
                        store = p;
                    }
                }
            }
        }
        if (leaf) {
            if (taken) {
                result.add(node);
                return new Pair(node, 1);
            } else {
                return new Pair(node, 0);
            }
        }
        if (taken) {
            result.add(store.x);
            return new Pair(store.x, 1);
        }
        return store;

    }

    public static class Pair {

        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair other = (Pair) o;
                return x == other.x && y == other.y;
            }
            return false;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 29 * hash + this.x;
            hash = 29 * hash + this.y;
            return hash;
        }
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            d = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);

    }

    static class Line {

        double a, b, c;

        Line(double x1, double y1, double x2, double y2) {
            if (Math.abs(x1 - x2) < Epsilon && Math.abs(y1 - y2) < Epsilon) {
                throw new RuntimeException("Two point are the same");
            }
            a = y1 - y2;
            b = x2 - x1;
            c = -a * x1 - b * y1;
        }

        Line(Point x, Point y) {
            this(x.x, x.y, y.x, y.y);
        }

        public Line perpendicular(Point p) {
            return new Line(p, new Point(p.x + a, p.y + b));
        }

        public Point intersect(Line l) {
            double d = a * l.b - b * l.a;
            if (d == 0) {
                throw new RuntimeException("Two lines are parallel");
            }

            return new Point((l.c * b - c * l.b) / d, (l.a * c - l.c * a) / d);
        }
    }

    static void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {
        for (int i = 0; i < 4; i++) {
            int m = (i + index) % 4;
            int j = (i + 1 + index) % 4;
            Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));
            if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {
                Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);
                p.add(add(val, a));
                // System.out.println(a + " " + b + " " + rec[i] + " " + rec[j]);
                // System.out.println(add(val, a));
            }
        }
    }

    static Point intersect(Point a, Point b, Point c) {
        double D = cross(a, b);
        if (D != 0) {
            return new Point(cross(c, b) / D, cross(a, c) / D);
        }
        return null;
    }

    static Point convert(Point a, double angle) {
        double x = a.x * cos(angle) - a.y * sin(angle);
        double y = a.x * sin(angle) + a.y * cos(angle);
        return new Point(x, y);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;

    }

    static class Point {

        double x, y;

        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        in.useDelimiter("\n");
        int i,points[]=new int[4],scored[]=new int[4],missed[]=new int[4],j,index=0,num[]=new int[4];
        String tea1,tea2="";
        ArrayList<String> team=new ArrayList<String>();
        for(i=0;i<5;i++)
        {
            String s[]=in.next().split(" ");
            tea1=s[0];
            tea2=s[1];
            if(!team.contains(tea1))
            {
                team.add(tea1);

            }
            index=team.indexOf(tea1);
            scored[index]+=s[2].charAt(0)-48;
            missed[index]+=s[2].charAt(2)-48;
            if(s[2].charAt(0)>s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
            if(!team.contains(tea2))
            {
                team.add(tea2);

            }
            index=team.indexOf(tea2);
            scored[index]+=s[2].charAt(2)-48;
            missed[index]+=s[2].charAt(0)-48;
            if(s[2].charAt(0)<s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
        }
        table a[]=new table[4];
        for(i=0;i<4;i++)
            a[i]=new table(team.get(i),points[i],scored[i],missed[i]);
        for(i=0;i<4;i++)
        {
            if(num[i]==2&&(team.get(i).equals("BERLAND")==false))
                tea2=team.get(i);

        }
        Arrays.sort(a);
        int index2=0;
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
            out.println("1:0");
            return;
        }
        if(a[1].points-a[index].points>3)
        {
            out.println("IMPOSSIBLE");
            return;
        }
        if(a[1].points-a[index].points<3)
        {
            out.println("1:0");
            return;
        }
        a[index].points+=3;
        Arrays.sort(a);
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
           out.println("1:0");
            return;
        }
        int k;
        for(j=1;;j++)
        {
            a[index].s+=1;
            a[index2].m+=1;
            Arrays.sort(a);
            for(i=0;i<4;i++)
            {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

            }
            if(index<2)
            {
                for(k=1;;k++)
                {
                    a[index].m+=1;
                    a[index2].s+=1;
                    Arrays.sort(a);
                    for(i=0;i<4;i++)
                    {
                         if(a[i].tname.equals("BERLAND"))
                             index=i;
                             if(a[i].tname.equals(tea2))
                            index2=i;

                        }
                    if(index>=2)
                        break;
                }
                out.println(j+":"+(k-1));
                break;
            }

        }
	}
    class table implements Comparable<table>
    {
        String tname;
        int points,s,m;
        public table(String tname,int points,int s,int m)
        {
            this.tname=tname;
            this.points=points;
            this.s=s;
            this.m=m;
        }
        public int compareTo(table a)
        {
            if(a.points>this.points)
                return 1;
            else if(a.points<this.points)
                return -1;
            else
            {
                int diff1=a.s-a.m;
                int diff2=this.s-this.m;
                if(diff1>diff2)
                    return 1;
                else if(diff1<diff2) return -1;
                else
                {
                    if(a.s>this.s) return 1;
                    else if(a.s<this.s) return -1;
                    else
                    {
                        return ((a.tname).compareTo(this.tname)<0?1:-1);
                    }
                }
            }
        }
    }
}

import java.util.*;
public class Main {

    class C implements Comparable<C>{
        String name;
        int score, diff,goal,match;
        public C(String name, int score, int diff, int goal, int match) {
            this.name = name;
            this.score = score;
            this.diff = diff;
            this.goal = goal;
            this.match = match;
        }
        public int compareTo(C o) {
            if(this.score < o.score) return 1;
            if(this.score > o.score) return -1;
            if(this.diff < o.diff) return 1;
            if(this.diff > o.diff) return -1;
            if(this.goal < o.goal) return 1;
            if(this.goal > o.goal) return -1;
            int res = this.name.compareTo(o.name);
            return res;
        }
        @Override
        public String toString() {
            return "C [name=" + name + ", score=" + score + ", diff=" + diff
                    + ", goal=" + goal + ", match=" + match + "]";
        }

    }

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            HashMap<String,Integer>map = new HashMap<String,Integer>();
            C [] data = new C[4];
            for(int i = 0; i < 5;i++){
                String line = sc.nextLine();
                String [] linearr = line.split(" |:");
                int id1 = -1, id2 = -1;
                if(map.containsKey(linearr[0])){
                    id1 = map.get(linearr[0]);
                }
                else{
                    int res = map.size();
                    id1 = res;
                    map.put(linearr[0], res);
                    data[id1] = new C(linearr[0], 0,0,0,0);
                }
                if(map.containsKey(linearr[1])){
                    id2 = map.get(linearr[1]);
                }
                else{
                    int res = map.size();
                    id2 = res;
                    map.put(linearr[1], res);
                    data[id2] = new C(linearr[1], 0,0,0,0);
                }
                //score
                int goal1 = Integer.parseInt(linearr[2]);
                int goal2 = Integer.parseInt(linearr[3]);
                if(goal1 > goal2){
                    data[id1].score += 3;
                }
                else if(goal1 < goal2){
                    data[id2].score += 3;
                }
                else{
                    data[id1].score++;
                    data[id2].score++;
                }
                //diff
                data[id1].diff += goal1 - goal2;
                data[id2].diff += goal2 - goal1;
                //goal
                data[id1].goal += goal1;
                data[id2].goal += goal2;
                //match
                data[id1].match++;
                data[id2].match++;
            }
            Arrays.sort(data);
            //find a myteam
            int myid = -1,op = -1;
            for(int i = 0; i < 4; i++){
                if(data[i].name.equals("BERLAND")){
                    myid = i;
                    break;
                }
            }
            for(int i=0; i < 4; i++){
                if(i == myid) continue;
                if(data[i].match == 2){
                    op = i;
                    break;
                }
            }

            if(myid == 0 || myid == 1){
                System.out.println("0:0");
            }
            else{
                boolean flg = false;
                C [] work = new C[4];
                int ansx = -1, ansy = -1;
                for(int diff = 0; diff < 100; diff++){
                    for(int x = diff; x < 100; x++){
                        for(int i = 0; i < 4; i++){
                            work[i] = new C(data[i].name, 0,0,0,0);
                            work[i].diff = data[i].diff;
                            work[i].goal = data[i].goal;
                            work[i].match = data[i].match;
                            work[i].score = data[i].score;
                        }
                        int y = x - diff;
                        if(diff == 0){
                            work[myid].score += 1;
                            work[op].score += 1;
                        }
                        else{
                            work[myid].score += 3;
                        }
                        work[myid].diff += x - y;
                        work[op].diff += y - x;
                        work[myid].goal += x;
                        work[op].goal += y;
                        Arrays.sort(work);
                        if(work[0].name.equals("BERLAND") || work[1].name.equals("BERLAND")){
                            ansx = x;
                            ansy = y;
                            flg = true;
                            break;
                        }
                    }
                    if(flg)break;
                }
                if(flg){
                    System.out.println(ansx + ":" + ansy);
                }
                else{
                    System.out.println("IMPOSSIBLE");
                }
            }
        }
    }

    private int[] getS(C my, C opp) {
        int [] res = new int[2];

        return res;
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int m,n;

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			input();
			solve();
		}
	}

	void solve()
	{
		node[] arr = new node[4];
		String en="";
		int i =0;
		for(String x:hm2.keySet())
		{
			if(hm2.get(x)==2 && !x.equals(ber))
				en = x;
		}
		boolean b = false;
		for(i =0;i<1000 & !b;i++)
			for(int j =i-1;j>=0 & !b;j--)
			{
				arr = new node[4];
				int l = 0;
				for(String x:hm.keySet())
				{
					node t = hm.get(x);
					node n = new node(t.name,t.score,t.goals,t.opp);
					if(x.equals(en))
					{
						n.goals+=j;
						n.opp+=i;
					}
					if(x.equals(ber))
					{
						n.goals+=i;
						n.score+=3;
						n.opp+=j;
					}
					arr[l++] = n;
				}
				Arrays.sort(arr);
				if(arr[2].name.equals(ber)||arr[3].name.equals(ber))
				{
					System.out.println(i+":"+j);
					b = true;
					break;
				}
			}
		if(!b)
		System.out.println("IMPOSSIBLE");
	}
	class node implements Comparable<node>
	{
		String name;
		int score;
		int goals;
		int opp;

		node(String _name, int _s, int _g, int _opp)
		{
			name = _name;
			score = _s;
			goals = _g;
			opp = _opp;
		}

		public int compareTo(node x)
		{
			if(score>x.score)
				return 1;
			else if(score==x.score)
			{
				if(goals-opp>x.goals-x.opp)
					return 1;
				else if(goals-opp ==x.goals-x.opp)
				{
					if(goals>x.goals)
						return 1;
					else if(goals==x.goals)
						return name.compareTo(x.name);
					else
						return -1;
				}
				else
					return -1;
			}
			else
				return -1;
		}

		public String toString()
		{
			return "("+name+","+score+","+goals+","+opp+")";
		}
	}
	String a,b,c;
	String ber;
	int index;
	HashMap<String,node> hm;
	HashMap<String,Integer> hm2;
	boolean input() throws IOException
	{
		ber = "BERLAND";
		index = 0;
		hm = new HashMap<String,node>();
		hm2 = new HashMap<String,Integer>();
		for(int k =0;k<5;k++)
		{
			a = ns();
			b = ns();
			c = ns();
			if(hm2.containsKey(a))
				hm2.put(a,hm2.get(a)+1);
			else
				hm2.put(a,1);

			if(hm2.containsKey(b))
				hm2.put(b,hm2.get(b)+1);
			else
				hm2.put(b,1);
			String[] sc = c.split(":");
			int sa = Integer.parseInt(sc[0]);
			int sb = Integer.parseInt(sc[1]);
			if(!hm.containsKey(a))
				hm.put(a, new node(a,0,0,0));
			if(!hm.containsKey(b))
				hm.put(b, new node(b,0,0,0));
			node i = hm.get(a);
			node j = hm.get(b);
			if(sa>sb)
				i.score+=3;
			else if(sa==sb)
			{
				i.score+=1;
				j.score+=1;
			}
			else
				j.score+=3;

			i.goals+=sa;
			j.opp+=sa;
			j.goals+=sb;
			i.opp+=sb;
		}
	//	debug(hm);
		return true;
	}
}

import java.util.*;

public class Main {
	Scanner cin;
	String[] teamA, teamB, score;

	Boolean solve(int x, int y) {
		int cnt = 0;
		String[] teamName = new String[4];
		int[] winP = new int[4], db = new int[4], sg = new int[4];
		Arrays.fill(winP, 0);
		Arrays.fill(db, 0);
		Arrays.fill(sg, 0);

		Map<String, Integer> tn = new HashMap<String, Integer>();
		Map<String, Integer> counter = new HashMap<String, Integer>();

		for (int i = 0; i < 5; i++) {
			if (tn.containsKey(teamA[i]) == false) {
				teamName[cnt] = teamA[i];
				tn.put(teamA[i], cnt);
				cnt++;
			}
			if (tn.containsKey(teamB[i]) == false) {
				teamName[cnt] = teamB[i];
				tn.put(teamB[i], cnt);
				cnt++;
			}
		}
		for (int i = 0; i < 4; i++) {
			counter.put(teamName[i], 0);
		}

		for (int i = 0; i < 5; i++) {
			counter.put(teamA[i], counter.get(teamA[i]) + 1);
			counter.put(teamB[i], counter.get(teamB[i]) + 1);

			int X = Integer.parseInt(score[i].split(":")[0]);
			int Y = Integer.parseInt(score[i].split(":")[1]);
			if (X == Y) {
				winP[tn.get(teamA[i])] += 1;
				winP[tn.get(teamB[i])] += 1;
			} else if (X > Y) {
				winP[tn.get(teamA[i])] += 3;
				winP[tn.get(teamB[i])] += 0;
			} else {
				winP[tn.get(teamA[i])] += 0;
				winP[tn.get(teamB[i])] += 3;
			}
			db[tn.get(teamA[i])] += X - Y;
			db[tn.get(teamB[i])] -= X - Y;

			sg[tn.get(teamA[i])] += X;
			sg[tn.get(teamB[i])] += Y;
		}
		sg[tn.get("BERLAND")] += x;
		db[tn.get("BERLAND")] += x - y;
		winP[tn.get("BERLAND")] += 3;
		for (int i = 0; i < 4; i++) {
			if (teamName[i].equals("BERLAND"))
				continue;
			if (counter.get(teamName[i]) == 2) {
				db[i] += y - x;
				sg[i] += y;
			}
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				Boolean big = false;
				if (winP[j] != winP[j + 1]) {
					big = winP[j] < winP[j + 1];
				} else if (db[j] != db[j + 1]) {
					big = db[j] < db[j + 1];
				} else if (sg[j] != sg[j + 1]) {
					big = sg[j] < sg[j + 1];
				} else {
					big = teamName[j].compareTo(teamName[j + 1]) > 0;
				}
				if (big) {
					String tmp = teamName[j];
					teamName[j] = teamName[j + 1];
					teamName[j + 1] = tmp;
					int _tmp = winP[j];
					winP[j] = winP[j + 1];
					winP[j + 1] = _tmp;
					_tmp = db[j];
					db[j] = db[j + 1];
					db[j + 1] = _tmp;
					_tmp = sg[j];
					sg[j] = sg[j + 1];
					sg[j + 1] = _tmp;
				}
			}
		}

		for (int i = 0; i < 4; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
		}
		for (int i = 0; i < 2; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
			if (teamName[i].equals("BERLAND"))
				return true;
		}
		return false;
	}

	void run() {
		cin = new Scanner(System.in);
		teamA = new String[5];
		teamB = new String[5];
		score = new String[5];
		for (int i = 0; i < 5; i++) {
			teamA[i] = cin.next();
			teamB[i] = cin.next();
			score[i] = cin.next();
		}
		for (int y = 0; y <= 100; y++) {
			for (int x = 1; x <= 500; x++) {
				if (solve(x+y,y)) {
					System.out.printf("%d:%d", x+y,y);
					return;
				}
			}
		}

		System.out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

// practice with rainboy
import java.io.*;
import java.util.*;

public class CF200C extends PrintWriter {
	CF200C() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF200C o = new CF200C(); o.main(); o.flush();
	}

	String[] ss = new String[4];
	int n;
	int get(String s) {
		for (int i = 0; i < n; i++)
			if (ss[i].equals(s))
				return i;
		ss[n] = s;
		return n++;
	}
	void main() {
		int[] g1 = new int[4];
		int[] g0 = new int[4];
		int[] pp = new int[4];
		int[] dd = new int[4];
		for (int h = 0; h < 5; h++) {
			String s = sc.next();
			String t = sc.next();
			int i = get(s);
			int j = get(t);
			String z = sc.next();
			int x = z.charAt(0) - '0';
			int y = z.charAt(2) - '0';
			g1[i] += x; g0[j] += x;
			g0[i] += y; g1[j] += y;
			if (x > y)
				pp[i] += 3;
			else if (x < y)
				pp[j] += 3;
			else {
				pp[i]++;
				pp[j]++;
			}
			dd[i]++;
			dd[j]++;
		}
		int i = 0;
		while (!ss[i].equals("BERLAND"))
			i++;
		int j = 0;
		while (j == i || dd[j] != 2)
			j++;
		Integer[] ii = { 0, 1, 2, 3 };
		for (int x = 0, y = 0; x < 30; x++) {
			g1[i] += x; g0[j] += x;
			g0[i] += y; g1[j] += y;
			if (x > y)
				pp[i] += 3;
			else if (x < y)
				pp[j] += 3;
			else {
				pp[i]++;
				pp[j]++;
			}
			Arrays.sort(ii, (i_, j_) -> {
				if (pp[i_] != pp[j_])
					return pp[j_] - pp[i_];
				int gi = g1[i_] - g0[i_];
				int gj = g1[j_] - g0[j_];
				if (gi != gj)
					return gj - gi;
				if (g1[i_] != g1[j_])
					return g1[j_] - g1[i_];
				return ss[i_].compareTo(ss[j_]);
			});
			int r = 0;
			while ((int) ii[r] != i)
				r++;
			if (r < 2) {
				println(x + ":0");
				return;
			}
			g1[i] -= x; g0[j] -= x;
			g0[i] -= y; g1[j] -= y;
			if (x > y)
				pp[i] -= 3;
			else if (x < y)
				pp[j] -= 3;
			else {
				pp[i]--;
				pp[j]--;
			}
		}
		println("IMPOSSIBLE");
	}
}

import java.io.PrintWriter;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * User: vaibhav mittal
 * Date: 24/6/12
 * Time: 9:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int MAX_TEAMS = 4;
        final int LINES = 5;

        String[] data = new String[LINES];
        for (int i = 0; i < data.length; ++i)
            data[i] = in.nextLine();

        HashSet<String> teamNames = new HashSet<String>();
        for (int i = 0; i < data.length; ++i) {
            String[] tokens = data[i].split(" ");
            teamNames.add(tokens[0]);
            teamNames.add(tokens[1]);
        }

        Team[] teams = new Team[MAX_TEAMS];
        int idx = 0;
        for (String name : teamNames)
            teams[idx++] = new Team(name);

        for (int i = 0; i < data.length; ++i) {
            String[] tokens1 = data[i].split(" ");
            int idx1 = getIndex(tokens1[0], teams);
            int idx2 = getIndex(tokens1[1], teams);
            String[] tokens2 = tokens1[2].split(":");
            int x = Integer.parseInt(tokens2[0]);
            int y = Integer.parseInt(tokens2[1]);

            if (x > y) {
                teams[idx1].points += 3;
                teams[idx2].points += 0;
            }
            else if (x < y) {
                teams[idx1].points += 0;
                teams[idx2].points += 3;
            }
            else {
                teams[idx1].points += 1;
                teams[idx2].points += 1;
            }

            teams[idx1].scoredGoals += x;
            teams[idx1].missedGoals += y;
            teams[idx1].matches += 1;

            teams[idx2].scoredGoals += y;
            teams[idx2].missedGoals += x;
            teams[idx2].matches += 1;
        }

        String firstTeamName = "BERLAND";
        String otherTeamName = "";
        for (int i = 0; i < teams.length; ++i) {
            if (teams[i].matches == 2) {
                if (teams[i].name.compareTo(firstTeamName) != 0) {
                    otherTeamName = teams[i].name;
                }
            }
        }

        teams[getIndex(firstTeamName, teams)].points += 3;
        teams[getIndex(otherTeamName, teams)].points += 0;

        Arrays.sort(teams);

        int bestX = -1, bestY = -1;
        boolean done = false;
        for (int y = 0; y <= 200; ++y) {
            for (int x = y + 1; x <= 200; ++x) {
                teams[getIndex(firstTeamName, teams)].scoredGoals += x;
                teams[getIndex(firstTeamName, teams)].missedGoals += y;
                teams[getIndex(otherTeamName, teams)].scoredGoals += y;
                teams[getIndex(otherTeamName, teams)].missedGoals += x;

                Arrays.sort(teams);
                if (getIndex(firstTeamName, teams) <= 1) {
                    if (bestX == -1 || bestY == -1) {
                        bestX = x;
                        bestY = y;
                    }
                    else if ((x - y < bestX - bestY) || (x - y == bestX - bestY && y < bestY)) {
                        bestX = x;
                        bestY = y;
                    }
                    done = true;
                }

                teams[getIndex(firstTeamName, teams)].scoredGoals -= x;
                teams[getIndex(firstTeamName, teams)].missedGoals -= y;
                teams[getIndex(otherTeamName, teams)].scoredGoals -= y;
                teams[getIndex(otherTeamName, teams)].missedGoals -= x;
            }
        }
        if (!done) {
            out.println("IMPOSSIBLE");
        }
        else {
            out.println(bestX + ":" + bestY);
        }

        in.close();
        out.close();
    }

    public static int getIndex(String name, Team[] teams) {
        for (int idx = 0; idx < teams.length; ++idx) {
            if (name.compareTo(teams[idx].name) == 0) {
                return idx;
            }
        }
        return -1;
    }

    public static class Team implements Comparable<Team> {
        String name;
        int points;
        int scoredGoals;
        int missedGoals;
        int matches;

        public Team(String teamName) {
            this.name = teamName;
            this.points = 0;
            this.scoredGoals = 0;
            this.missedGoals = 0;
            this.matches = 0;
        }

        public int compareTo(Team team) {
            if (points != team.points) return team.points - points;
            if (scoredGoals - missedGoals != team.scoredGoals - team.missedGoals) return (team.scoredGoals - team.missedGoals) - (scoredGoals - missedGoals);
            if (scoredGoals != team.scoredGoals) return team.scoredGoals - scoredGoals;
            return -(name.compareTo(team.name));
        }

        public String toString() {
            return name + " " + points + " " + (scoredGoals - missedGoals) + " " + missedGoals;
        }
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * 111118315581
 *
 * -3 3 2 3 2 3 2 3 -3 3 -3 3 -3 3 2 3
 *
 * @author pttrung
 */
public class A {

    public static long x, y, gcd;
    public static int Mod = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[3];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        String other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = name;
                }
                data[index++] = map.get(name);
            } else {
                ber = map.get(name);
            }
        }

        // System.out.println(second.point);
        ber.point += 3;
        ber.score += 1;
        map.get(other).miss += 1;
        Arrays.sort(data);
        Score second = data[1];

        if (ber.point < second.point) {
            out.println("IMPOSSIBLE");
        } else {
            int total = 1;

            while (second.compareTo(ber) >= 0) {
                ber.score += 1;
                total++;
                if (second.name.equals(other)) {
                    second.miss += 1;
                }
                Arrays.sort(data);
                second = data[1];
            }
            out.println(total + ":0");
        }
        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            gcd = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //      br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("basketball_game.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		HashMap<String, Integer> diff = new HashMap();
		HashMap<String, Integer> nom = new HashMap();
		for (int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if (val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			} else if (val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			} else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			diff.put(str1, diff.getOrDefault(str1, 0) + val1 - val2);
			diff.put(str2, diff.getOrDefault(str2, 0) + val2 - val1);
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
			nom.put(str1, nom.getOrDefault(str1, 0) + 1);
			nom.put(str2, nom.getOrDefault(str2, 0) + 1);
		}

		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for (String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st, goals.get(st), diff.get(st));
		}
		Arrays.sort(arr);
		idx = 0;
		String str1 = "BERLAND", str2 = arr[1].key;
		for (int x = 0; x < 4; x++) {
			if ((arr[x].key).equals(str1)) {
				req = idx;
			}
			idx++;
		}
		if (req < 2) {
			System.out.println("1:0");
			return;
		} else if (arr[1].val - arr[req].val < 3) {
			System.out.println("1:0");
		} else if (arr[1].val - arr[req].val == 3) {
			int val = diff.get(str2) - diff.get(str1);
			if (val < 0) {
				System.out.println("1:0");
			} else {
				if(nom.get(str2) == 2) {
					if((val & 1) == 0) {
						val = val/2;
						if(goals.get(str1) + val <= goals.get(str2)) {
							val++;
						}
					}
					else {
						val = (val + 1)/2;
					}
				}
				else {
					if(goals.get(str1) + val <= goals.get(str2)) {
						val++;
					}
				}
				int extra = 0;
				if(req == 3 && arr[1].val == arr[2].val) {
					String str3 = arr[2].key;
					if(nom.get(str3) == 2) {
						int dif = diff.get(str3) - diff.get(str1) - val;
						if(dif < 0) {
							dif = 0;
						}
						else if((dif & 1) == 0) {
							extra = dif/2;
							if(goals.get(str1) + val + extra<= goals.get(str3)) {
								extra++;
							}
						}
						else {
							extra = (dif + 1)/2;
						}
					}
					else if(diff.get(str3) >= diff.get(str1) + val){
						extra = diff.get(str3) - diff.get(str1) - val;
						if(goals.get(str1) + val + extra <= goals.get(str3)) {
							extra++;
						}
					}
				}
				System.out.println(val + extra + ":0");
			}
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	static class pair implements Comparable<pair> {
		int val;
		int goals;
		int dif;
		String key;

		pair(int val, String key, int points, int dif) {
			this.val = val;
			this.key = key;
			this.goals = points;
			this.dif = dif;
		}

		public int compareTo(pair obj) {
			if (obj.val == val) {
				if (obj.dif == dif) {
					return obj.goals - goals;
				} else
					return obj.dif - dif;
			}
			return obj.val - this.val;
		}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		for(int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if(val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			}
			else if(val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			}
			else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
		}
		String str = "BERLAND";
		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for(String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st);

		}
		Arrays.sort(arr);
		for(int x = 0; x < 4; x++) {
			if(arr[x].key.equals(str)) {
				req = idx - 1;
			}
		}
		if(req < 2) {
			System.out.println("0:0");
			return;
		}
		else {
			if(arr[1].val - arr[req].val <= 1 ) {
				System.out.println("1:0");
			}
			else if(arr[1].val - arr[req].val <= 3 ) {
				int val = goals.get(arr[1].key) - goals.get(arr[req].key) + 1;
				if(val <= 0) {
					System.out.println("1:0");
				}
				else if(val < 10)
					System.out.println(val + ":0");
				else
					System.out.println("IMPOSSIBLE");
			}
			else {
				System.out.println("IMPOSSIBLE");
			}
		}
	}

	static class pair implements Comparable<pair>{
		int val;
		String key;
		pair(int val, String key) {
			this.val = val;
			this.key = key;
		}

		public int compareTo(pair obj) {
			return obj.val - this.val;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class First
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class Team
{
    String teamName;
    int score;
    int goalFor;
    int goalAgainst;
    int matchPlayed;

    public Team(String teamName, int score, int goalFor, int goalAgainst, int matchPlayed)
    {
        super();
        this.teamName = teamName;
        this.score = score;
        this.goalFor = goalFor;
        this.goalAgainst = goalAgainst;
        this.matchPlayed = matchPlayed;
    }
}

class MyComparator implements Comparator<Team>
{
    @Override
    public int compare(Team t1, Team t2)
    {

        if(t1.score < t2.score) return 1;
        if(t1.score > t2.score) return -1;
        if(t1.goalFor - t1.goalAgainst < t2.goalFor - t2.goalAgainst) return 1;
        if(t1.goalFor - t1.goalAgainst > t2.goalFor - t2.goalAgainst) return -1;
        if(t1.goalFor < t2.goalFor) return 1;
        if(t1.goalFor > t2.goalFor) return -1;
        return t1.teamName.compareTo(t2.teamName);
    }
}

class TaskA
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        Set <String> hset = new HashSet <String> ();
        String[] inputStr = new String[5];
        for(int i = 0; i < 5; i++)
        {
            inputStr[i] = in.nextLine();
        }

        Team[] team = new Team[4];
        for(int i = 0; i < 5; i++)
        {
            String str = inputStr[i];
            str = str.replace(":", " ");
            String[] ans = str.split("[ ]+");
            hset.add(ans[0]); hset.add(ans[1]);
        }
        int index = 0;
        for(String str : hset)
        {
            int myScore = 0;
            int myGoalFor = 0;
            int myGoalAgainst = 0;
            int matchPlayed = 0;
            for(int i = 0; i < 5; i++)
            {
                String current = inputStr[i];
                current = current.replace(":", " ");
                String[] ans = current.split("[ ]+");
                String firstTeam = ans[0];
                String secondTeam = ans[1];
                int firstScoreGoal = Integer.parseInt(ans[2]);
                int secondScoreGoal = Integer.parseInt(ans[3]);

                if(firstTeam.equals(str))
                {
                    myGoalFor += firstScoreGoal;
                    myGoalAgainst += secondScoreGoal;
                    if(firstScoreGoal > secondScoreGoal)
                    {
                        myScore += 3;
                    }
                    if(firstScoreGoal == secondScoreGoal)
                        myScore++;
                    matchPlayed++;
                }
                if(secondTeam.equals(str))
                {
                    myGoalFor += secondScoreGoal;
                    myGoalAgainst += firstScoreGoal;
                    if(secondScoreGoal > firstScoreGoal) myScore += 3;
                    if(secondScoreGoal == firstScoreGoal) myScore++;
                    matchPlayed++;
                }
            }
            team[index++] = new Team(str, myScore, myGoalFor, myGoalAgainst, matchPlayed);
        }
        Arrays.sort(team, new MyComparator());

        index = 0; int i = 0;
        for(Team item : team)
        {   if(item.teamName.equals("BERLAND"))
                index = i;
            i++;
            //System.out.println(item.teamName + " " + item.score + "  " + item.goalFor + "  " + item.goalAgainst + " " + item.matchPlayed);
        }
        if(team[0].teamName.equals("BERLAND") || team[1].teamName.equals("BERLAND"))
            out.println("1:0");

        else
        {
            String secondTeamName = team[1].teamName;
            int secondScore = team[1].score;
            int secondGoalFor = team[1].goalFor;
            int secondGoalAgainst = team[1].goalAgainst;
            int differenceSecond = secondGoalFor - secondGoalAgainst;

            int berlandScore = team[index].score;
            int berlandGoalFor = team[index].goalFor;
            int berlandGoalAgainst = team[index].goalAgainst;
            int differenceBerland = berlandGoalFor - berlandGoalAgainst;
            if(secondScore <= berlandScore + 2)
            {
                out.println("1:0");
            }
            else if (secondScore > berlandScore + 3)
            {
                out.println("IMPOSSIBLE");
            }
            else
            {
                int kk = 0;
                for(int k = 1; k < 4; k++)
                {
                    if(team[k].teamName.equals("BERLAND") == false && team[k].matchPlayed == 2)
                    {
                        kk = k;
                        break;
                    }
                }
                Team[] tempTeam = new Team[4];

                outer:for(int diff = 0; ; diff++)
                {
                for(int goals = diff; ; goals++)
                {
                    for(int step = 0; step < 4; step++)
                    {
                        tempTeam[step] = new Team(team[step].teamName, team[step].score, team[step].goalFor , team[step].goalAgainst, team[step].matchPlayed);
                    }

                    tempTeam[index].score += 3;
                    tempTeam[index].goalFor += goals;
                    tempTeam[index].goalAgainst += goals - diff;

                    tempTeam[kk].goalAgainst += goals;
                    tempTeam[kk].goalFor += goals - diff;

                    Arrays.sort(tempTeam, new MyComparator());
                    if(tempTeam[0].teamName.equals("BERLAND") || tempTeam[1].teamName.equals("BERLAND"))
                    {
                        out.println(goals + ":0");
                        break outer;
                    }
                    if(goals > 60) continue outer;
                }
                }
            }
        }
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next()
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
        {
            try
            {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public String nextLine()
    {
        String inputLine = "";
        try
        {
            inputLine = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return inputLine;
    }
}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else {a=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1],bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb,p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; continue;}
	  if(!g.equals("BERLAND"))que.add(map.get(g));

	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	//for(int i=0;i<4;i++)
	//{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<50;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3,bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , opp.v ,opp.m + t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();
/*	dd(r);
	dd(rr);
	while(!que.isEmpty())dd(que.poll());
	db("");
	*/
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		// db(x,y,"kitaaaaaaaaaaaaaaaaaaaaaaa");
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m,p.mm);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? 1:-1;
		   }

}

import java.util.*;

public class C {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Map<String, Integer> X = new HashMap<String, Integer>();
		int ber = -1;
		final int[] points = new int[5];
		final int[] scored = new int[5];
		final int[] let_in = new int[5];
		final int[] count = new int[5];
		final String[] names = new String[5];
		for(int i=0; i<5; i++) {
			String t1 = in.next();
			String t2 = in.next();
			String[] scores = in.next().split(":");

			if(!X.containsKey(t1)) X.put(t1, X.size());
			if(!X.containsKey(t2)) X.put(t2, X.size());
			int x1 = X.get(t1);
			int x2 = X.get(t2);
			names[x1] = t1;
			names[x2] = t2;
			if(t1.equals("BERLAND")) ber = x1;
			if(t2.equals("BERLAND")) ber = x2;
			int s1 = Integer.parseInt(scores[0]);
			int s2 = Integer.parseInt(scores[1]);

			count[x1]++; count[x2]++;
			if(s1 > s2) { points[x1]+=3; }
			else if(s1 == s2) { points[x1]++; points[x2]++; }
			else { points[x2]++; }
			scored[x1] += s1; scored[x2]+=s2;
			let_in[x1] += s2; let_in[x2]+=s1;
		}
		int opp = -1;
		for(int i=0; i<5; i++)
			if(count[i]==2 && i!=ber)
				opp = i;

		boolean ok = false;
		int best_x = 10000;
		int best_y = 0;
		points[ber]+=3;
		for(int x=0; x<100; x++)
			for(int y=0; y<x; y++) {
				final int[] new_scored = new int[5];
				final int[] new_let_in = new int[5];
				for(int i=0; i<5; i++) {
					new_scored[i] = scored[i];
					new_let_in[i] = let_in[i];
				}
				new_scored[ber] += x; new_scored[opp] += y;
				new_let_in[ber] += y; new_let_in[opp] += x;

				Integer[] sort = new Integer[5];
				for(int i=0; i<5; i++) sort[i] = i;
				Arrays.sort(sort, new Comparator<Integer>() {
					public int compare(Integer A, Integer B) {
						if(points[A] > points[B]) return -1;
						if(points[A] < points[B]) return 1;

						int s1 = new_scored[A]-new_let_in[A];
						int s2 = new_scored[B]-new_let_in[B];
						if(s1 > s2) return -1;
						if(s1 < s2) return 1;

						if(new_scored[A] > new_scored[B]) return -1;
						if(new_scored[A] < new_scored[B]) return 1;

						return (names[A].compareTo(names[B]));
					}
				});
				if(ber == sort[0] || ber==sort[1]) { // OK
					ok = true;
					int diff = x-y;
					int best_diff = best_x-best_y;
					if(diff < best_diff || (diff==best_diff && y < best_y)) {
						best_x = x;
						best_y = y;
					}
				}
			}

		if(!ok)
			System.out.println("IMPOSSIBLE");
		else System.out.println(best_x+":"+best_y);

		/*
		int more = 0;
		for(int i=0; i<5; i++)
			if(i != ber && points[i]>points[ber])
				more++;
		if(more >= 2) { System.out.println("IMPOSSIBLE"); return; }

		List<Integer> diff = new ArrayList<Integer>();
		int ix = 0;
		for(int i=0; i<5; i++)
			if(points[i]==points[ber] && i!=ber)
				diff.add(scored[i]-let_in[i]);
		Collections.sort(diff);

		int need = more==1 ? diff.get(diff.size()-1) : diff.get(diff.size()-2);
		int diff_needed = need - (scored[ber]-let_in[ber]);

		if(more == 0 && diff.get(
		*/
	}
}

import java.io.*;
import java.util.*;

public class C implements Runnable {
    private MyScanner in;
    private PrintWriter out;

    Team[] teams;
    Map<String, Integer> byName;
    int curNum;

    void addTeam(String name) {
        if (!byName.containsKey(name)) {
            byName.put(name, curNum);
            teams[curNum++] = new Team(name);
        }
    }

    void addScore(Team a, Team b, int asc, int bsc) {
        a.addResult(asc, bsc);
        b.addResult(bsc, asc);
    }

    private void solve() {
        teams = new Team[4];
        byName = new HashMap<String, Integer>();
        curNum = 0;
        for (int i = 0; i < 5; ++i) {
            String a = in.next();
            String b = in.next();
            String sc = in.next();
            int asc = sc.charAt(0) - '0', bsc = sc.charAt(2) - '0';
            addTeam(a);
            addTeam(b);
            addScore(teams[byName.get(a)], teams[byName.get(b)], asc, bsc);
        }
        final String NAME = "BERLAND";
        Team our = teams[byName.get(NAME)];
        Team other = null;
        for (Team t : teams) {
            if (t != our && t.played == 2) {
                other = t;
                break;
            }
        }
        for (int d = 1; d < 10; ++d) {
            for (int miss = 0; miss + d < 10; ++miss) {
                int asc = miss + d, bsc = miss;
                our.addResult(asc, bsc);
                other.addResult(bsc, asc);
                Arrays.sort(teams);
                for (int i = 0; i < 2; ++i) {
                    if (teams[i] == our) {
                        out.println(asc + ":" + bsc);
                        return;
                    }
                }
                our.rollBackResult(asc, bsc);
                other.rollBackResult(bsc, asc);
            }
        }
        out.println("IMPOSSIBLE");
    }

    @Override
    public void run() {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    public static void main(String[] args) {
        new C().run();
    }

    class Team implements Comparable<Team> {
        public String name;
        public int scored, missed, points, played;

        public Team(String name) {
            this.name = name;
            this.scored = this.missed = this.points = this.played = 0;
        }

        public void addResult(int scored, int missed) {
            this.played++;
            this.scored += scored;
            this.missed += missed;
            if (scored > missed) {
                points += 3;
            } else if (scored == missed) {
                points++;
            }
        }

        public void rollBackResult(int scored, int missed) {
            this.played--;
            this.scored -= scored;
            this.missed -= missed;
            if (scored > missed) {
                points -= 3;
            } else if (scored == missed) {
                points--;
            }
        }

        @Override
        public int compareTo(Team o) {
            if (points != o.points) {
                return o.points - points;
            }
            if (scored - missed != o.scored - o.missed) {
                return (o.scored - o.missed) - (scored - missed);
            }
            if (scored != o.scored) {
                return o.scored - scored;
            }
            return name.compareTo(o.name);
        }
    }

    class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        public boolean hasNext() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String s = br.readLine();
                    if (s == null) {
                        return false;
                    }
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    return false;
                }
            }
            return st != null && st.hasMoreTokens();
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String s = br.readLine();
                    if (s == null) {
                        return null;
                    }
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            try {
                st = null;
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else if(a==b){a=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1],bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb,p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; }
	  if(!g.equals("BERLAND"))que.add(map.get(g));

	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	//for(int i=0;i<4;i++)
	//{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<10;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3,bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , 0 ,opp.m + t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();

//	dd(r);
	//dd(rr);
	///while(!que.isEmpty())dd(que.poll());
	//db("");
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		 db(x,y,"kitaaaaaaaaaaaaaaaaaaaaaaa");
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? 1:-1;
		   }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 *
 * @author pttrung
 */
public class C {

    public static double Epsilon = 1e-6;
    public static long x, y, d;

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        HashMap<String, Score> map = new HashMap();
        HashSet<String> op = new HashSet();
        Score[] data = new Score[4];
        Score ber = null;
        for (int i = 0; i < 5; i++) {
            String a = in.next();
            String b = in.next();
            String[] score = in.next().split(":");
            int c = Integer.parseInt(score[0]);
            int d = Integer.parseInt(score[1]);

            if (!map.containsKey(a)) {
                map.put(a, new Score(a, 0, 0, 0));
            }
            if (!map.containsKey(b)) {
                map.put(b, new Score(b, 0, 0, 0));
            }
            if (a.equals("BERLAND")) {
                op.add(b);
            }
            if (b.equals("BERLAND")) {
                op.add(a);
            }

            Score tempA = map.get(a);
            tempA.score += c;
            tempA.miss += d;
            Score tempB = map.get(b);
            tempB.score += d;
            tempB.miss += c;
            if (c > d) {

                tempA.point += 3;

            } else if (c == d) {
                tempA.point += 1;
                tempB.point += 1;
            } else {
                tempB.point += 3;
            }
            map.put(a, tempA);
            map.put(b, tempB);
        }
        int index = 0;
        Score other = null;
        for (String name : map.keySet()) {
            if (!name.equals("BERLAND")) {
                if (!op.contains(name)) {
                    other = map.get(name);
                }

            } else {
                ber = map.get(name);
            }
            data[index++] = map.get(name);
        }
        ber.score += 1;
        ber.point += 3;

        other.miss += 1;
        Arrays.sort(data);
      //  System.out.println(ber.score + " "+ data[2].score);
        if (ber.point < data[2].point) {
            out.println("IMPOSSIBLE");
        } else {
            int left = 1;
            int right = 0;
       //     System.out.println(data[2].name + " ");
            while (!data[2].name.equals("BERLAND") && !data[3].name.equals("BERLAND")) {
                int difBer = ber.score - ber.miss;
                int difSe = data[2].score - data[2].miss;
                int need = difSe - difBer;
                if (need == 0) {
                    //System.out.println("HE HE");
                    if (data[2].score > ber.score && !data[2].name.equals(other.name)) {
                        int more = data[2].score - ber.score + 1;
                        left += more;
                        right += more;
                        ber.score += more;
                        ber.miss += more;
                        other.miss += more;
                        other.miss += more;
                    } else {
                        ber.score += 1;
                        left++;
                        other.miss++;
                    }

                } else {
                    if (!data[2].name.equals(other.name)) {

                        int more = need;
                        int miss = 0;
                        while(data[2].score > ber.score + more){
                            more++;
                            miss++;
                        }
                        if(data[2].name.compareTo(ber.name) < 0){
                            more++;
                            miss++;
                        }
                        left += more;
                        right += miss;
                        ber.score += more;
                        ber.miss += miss;
                        other.miss += more;
                        other.score += miss;
                    } else {
                        int more = need;
                        int a = more / 2;
                        if (more % 2 != 0) {
                            a++;
                        }
                        left += a;
                        ber.score += a;
                        other.miss += a;
                    }
                }
                Arrays.sort(data);
            }
            out.println(left + ":" + right);

        }
        // System.out.println(second.point);

        out.close();
    }

    public static class Score implements Comparable<Score> {

        String name;
        int score, miss;
        int point;

        public Score(String name, int score, int miss, int point) {
            this.name = name;
            this.score = score;
            this.miss = miss;
            this.point = point;
        }

        @Override
        public int compareTo(Score o) {
            if (point != o.point) {
                return point - o.point;
            } else {
                int a = score - miss;
                int b = o.score - o.miss;
                if (a != b) {
                    return a - b;
                } else if (score != o.score) {
                    return score - o.score;
                } else {
                    return -name.compareTo(o.name);
                }
            }
        }
    }

    public static Pair cal(ArrayList<Integer>[] map, HashSet<Integer> result, HashSet<Pair> check, int pa, int node) {
        boolean taken = false;
        if (check.contains(new Pair(pa, node)) || check.contains(new Pair(node, pa))) {
            taken = true;
        }
        boolean leaf = true;

        ArrayList<Integer> list = new ArrayList();
        Pair store = null;
        for (int next : map[node]) {
            if (next != pa) {
                leaf = false;

                Pair p = cal(map, result, check, node, next);
                if (p.y == 1) {
                    store = p;
                    taken = false;

                } else {
                    if (store == null) {
                        store = p;
                    }
                }
            }
        }
        if (leaf) {
            if (taken) {
                result.add(node);
                return new Pair(node, 1);
            } else {
                return new Pair(node, 0);
            }
        }
        if (taken) {
            result.add(store.x);
            return new Pair(store.x, 1);
        }
        return store;

    }

    public static class Pair {

        int x, y;

        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair other = (Pair) o;
                return x == other.x && y == other.y;
            }
            return false;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 29 * hash + this.x;
            hash = 29 * hash + this.y;
            return hash;
        }
    }

    public static void extendEuclid(long a, long b) {
        if (b == 0) {
            x = 1;
            y = 0;
            d = a;
            return;
        }
        extendEuclid(b, a % b);
        long x1 = y;
        long y1 = x - (a / b) * y;
        x = x1;
        y = y1;

    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);

    }

    static class Line {

        double a, b, c;

        Line(double x1, double y1, double x2, double y2) {
            if (Math.abs(x1 - x2) < Epsilon && Math.abs(y1 - y2) < Epsilon) {
                throw new RuntimeException("Two point are the same");
            }
            a = y1 - y2;
            b = x2 - x1;
            c = -a * x1 - b * y1;
        }

        Line(Point x, Point y) {
            this(x.x, x.y, y.x, y.y);
        }

        public Line perpendicular(Point p) {
            return new Line(p, new Point(p.x + a, p.y + b));
        }

        public Point intersect(Line l) {
            double d = a * l.b - b * l.a;
            if (d == 0) {
                throw new RuntimeException("Two lines are parallel");
            }

            return new Point((l.c * b - c * l.b) / d, (l.a * c - l.c * a) / d);
        }
    }

    static void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {
        for (int i = 0; i < 4; i++) {
            int m = (i + index) % 4;
            int j = (i + 1 + index) % 4;
            Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));
            if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {
                Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);
                p.add(add(val, a));
                // System.out.println(a + " " + b + " " + rec[i] + " " + rec[j]);
                // System.out.println(add(val, a));
            }
        }
    }

    static Point intersect(Point a, Point b, Point c) {
        double D = cross(a, b);
        if (D != 0) {
            return new Point(cross(c, b) / D, cross(a, c) / D);
        }
        return null;
    }

    static Point convert(Point a, double angle) {
        double x = a.x * cos(angle) - a.y * sin(angle);
        double y = a.x * sin(angle) + a.y * cos(angle);
        return new Point(x, y);
    }

    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;

    }

    static class Point {

        double x, y;

        Point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.*;
import java.util.*;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class Code implements Runnable {

    String in = "", out = "";
    BufferedReader reader;
    PrintWriter writer;
    StringTokenizer st;

    public static void main(String[] args) throws IOException {
        new Thread(new Code()).start();
    }

    class Pair {
        public int first, second;
        Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object obj) {
            Pair other = (Pair)obj;
            return first == other.first && second == other.second;
        }
    }

    class Team implements Comparable {
        private String name;
        private int score, difference, goals, matches;

        public Team(String name, int score, int difference, int goals) {
            this.name = name;
            this.score = score;
            this.goals = goals;
            this.difference = difference;
            this.matches = 1;
        }

        public Team(String name) {
            this.name = name;
        }

        @Override
        public int compareTo(Object other) {
            Team what = (Team)other;
            if(score != what.score) return score - what.score;
            if(difference != what.difference)   return difference - what.difference;
            if(goals != what.goals) return goals - what.goals;
            return what.name.compareTo(name);
        }

        @Override
        public boolean equals(Object other) {
            return name.equals(((Team)other).name);
        }
    }

    void solve() throws IOException {
        Map relation = new HashMap<String, Integer>();
        Team[] teams = new Team[4];
        int k = 0;
        for(int i = 0; i < 5; ++i) {
            String target1 = nextToken(), target2 = nextToken();
            StringTokenizer tokenizer = new StringTokenizer(nextToken(), ":");
            int goals1 = Integer.parseInt(tokenizer.nextToken()), goals2 = Integer.parseInt(tokenizer.nextToken()), id = 0;
            if(relation.containsKey(target1)) {
                id = (Integer)relation.get(target1);
                teams[id].score += goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals1 - goals2;
                teams[id].goals += goals1;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target1, id);
                teams[id] = new Team(target1, goals1 > goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals1 - goals2, goals1);
            }

            if(relation.containsKey(target2)) {
                id = (Integer)relation.get(target2);
                teams[id].score += goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0;
                teams[id].difference += goals2 - goals1;
                teams[id].goals += goals2;
                ++teams[id].matches;
            } else {
                id = k++;
                relation.put(target2, id);
                teams[id] = new Team(target2, goals1 < goals2 ? 3 : goals1 == goals2 ? 1 : 0, goals2 - goals1, goals2);
            }
        }

        Arrays.sort(teams);
        //for(Team team : teams)  writer.println(team.name + " " + team.score + " " + team.difference + " " + team.goals + " " + team.matches);

        int berland = 0, otherland = 0;
        for(int i = 0; i < 4; ++i) {
            if(teams[i].matches == 2)
                if(teams[i].name.equals("BERLAND")) berland = i;
                else    otherland = i;
        }

        if(berland > 1) writer.println("1:0");
        else if(teams[2].score <= teams[berland].score + 3) {
            if(teams[2].score - 3 < teams[berland].score)   writer.println("1:0");
            else    writer.println(teams[2].difference - teams[berland].difference + 1 + ":0");
        } else  writer.println("IMPOSSIBLE");
    }

    public void run() {
        try {
            if(in.equals(""))   reader = new BufferedReader(new InputStreamReader(System.in));
            else    reader = new BufferedReader(new FileReader(in));

            if(out.equals(""))  writer = new PrintWriter(new OutputStreamWriter(System.out));
            else    writer = new PrintWriter(new FileWriter(out));
            solve();
        } catch(IOException e) {
            e.printStackTrace();
        } finally {
            try {
                reader.close();
                writer.close();
            } catch(IOException e) {
                e.printStackTrace();
            }
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while(st == null || !st.hasMoreTokens())    st = new StringTokenizer(reader.readLine());
        return st.nextToken();
    }
}

import java.util.*;

/**
 *
 *

 * Unsolved
 *

 *

 * Created on Jun 24, 2012, 11:16:48 AM
 *

 * @Author Andy Y.F. Huang
 */
public class p200C {
  class Team implements Comparable<Team> {
    String name;
    int gd;
    int goals;
    int points;

    public Team(Team x) {
      this.name = x.name;
      this.gd = x.gd;
      this.goals = x.goals;
      this.points = x.points;
    }

    public Team(String name) {
      this.name = name;
    }

    public int compareTo(Team o) {
      if (points != o.points)
        return o.points - points;
      if (gd != o.gd)
        return o.gd - gd;
      if (goals != o.goals)
        return o.goals - goals;
      return name.compareTo(o.name);
    }

    public String toString() {
      return name + ";" + points +"," + gd + "," + goals;
    }

  }

  private final String ber = "BERLAND";

  private void solve(int test_number) {
    Map<String, Integer> names = new HashMap<String, Integer>();
    Team teams[] = new Team[4];
    int games[] = new int[4];
    int cur = 1;
    names.put(ber, 0);
    for (int i = 0; i < 5; i++) {
      String a = in.next();
      String b = in.next();
      StringTokenizer st = new StringTokenizer(in.next(), "\t\r\n :");
      if (!names.containsKey(a))
        names.put(a, cur++);
      if (!names.containsKey(b))
        names.put(b, cur++);
      int x = names.get(a);
      int y = names.get(b);
      if (teams[x] == null)
        teams[x] = new Team(a);
      if (teams[y] == null)
        teams[y] = new Team(b);
      games[x]++;
      games[y]++;
      int sc1 = Integer.parseInt(st.nextToken());
      int sc2 = Integer.parseInt(st.nextToken());
      if (sc1 == sc2) {
        teams[x].points++;
        teams[y].points++;
      }
      else if (sc1 > sc2) {
        teams[x].points += 3;
      }
      else
        teams[y].points += 3;
      teams[x].goals += sc1;
      teams[y].goals += sc2;
      teams[x].gd += sc1 - sc2;
      teams[y].gd += sc2 - sc1;

    }

    int other = 1;
    while (games[other] == 3)
      other++;
    int x = 1500, y = 100;
    boolean poss = false;
    for (int a = 0; a < 100; a++) {
      for (int b = 0; b < a; b++) {
        Team copy[] = copy(teams);
        copy[0].points += 3;
        copy[0].goals += a;
        copy[0].gd += a - b;
        copy[other].goals += b;
        copy[other].gd += b - a;
        Arrays.sort(copy);
        int i = 0;
        while (!copy[i].name.equals(ber))
          i++;
        if (i <= 1 && a - b < x - y && b < y) {//poss
          //pln(Arrays.toString(copy));
          poss = true;
          x = a;
          y = b;
        }
      }
    }
    if (!poss)
      out.appendln("IMPOSSIBLE");
    else
      out.appendln(x+":"+y);

  }

  private Team[] copy(Team orig[]) {
    Team ans[] = new Team[orig.length];
    for (int i = 0; i < ans.length; i++)
      ans[i] = new Team(orig[i]);
    return ans;
  }

  private Input in;
  private Output out;

  void solve() {
    in = new Input("");
    out = new Output("");
    int tests = 1;
    for (int i = 1; i <= tests; i++)
      solve(i);
    out.flush();
  }

  public static void main(String[] args) {
    // if (System.getProperty("AZN") != null) {
    // try {
    // System.setIn(new java.io.FileInputStream("input.txt"));
    // System.setOut(new java.io.PrintStream(new java.io.FileOutputStream(
    // "output.txt")));
    // }
    // catch (java.io.FileNotFoundException e) {
    // throw new RuntimeException(e);
    // }
    // }
    p200C solver = new p200C();
    solver.solve();
  }

  static void pln(Object... obj) {
    pf(obj);
    System.out.println();
  }

  static void pf(Object... obj) {
    for (int i = 0; i < obj.length; i++) {
      if (i != 0)
        System.out.print(' ');
      System.out.print(obj[i]);

    }
  }
}

final class Input {
  private java.io.BufferedReader reader;
  private java.util.StringTokenizer tokenizer;

  Input(String filename) {
    if (!filename.isEmpty()) {
      try {
        reader = new java.io.BufferedReader(new java.io.FileReader(filename));
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    }
    else
      reader = new java.io.BufferedReader(new java.io.InputStreamReader(
          System.in));
    tokenizer = new java.util.StringTokenizer("");
  }

  String next() {
    while (!tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      }
      catch (java.io.IOException e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  String nextLine() {
    try {
      return reader.readLine();
    }
    catch (java.io.IOException e) {
      throw new RuntimeException(e);
    }
  }

  long nextLong() {
    return Long.parseLong(next());
  }

  int nextInt() {
    return Integer.parseInt(next());
  }

  double nextDouble() {
    return Double.parseDouble(next());
  }

}

final class Output {
  private java.io.PrintWriter buffer;

  Output(String filename) {
    if (!filename.isEmpty())
      try {
        buffer = new java.io.PrintWriter(filename);
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException();
      }
    else
      buffer = new java.io.PrintWriter(System.out);
  }

  void flush() {
    buffer.flush();
  }

  void close() {
    buffer.close();
  }

  void append(Object... obj) {
    for (int i = 0; i < obj.length; i++) {
      if (i != 0)
        buffer.write(' ');
      buffer.print(obj[i]);
    }
  }

  void appendln(Object... obj) {
    append(obj);
    buffer.write('\n');
  }

}

import java.util.*;
public class Main {

    class C implements Comparable<C>{
        String name;
        int score, diff,goal,match;
        public C(String name, int score, int diff, int goal, int match) {
            this.name = name;
            this.score = score;
            this.diff = diff;
            this.goal = goal;
            this.match = match;
        }
        public int compareTo(C o) {
            if(this.score < o.score) return 1;
            if(this.score > o.score) return -1;
            if(this.diff < o.diff) return 1;
            if(this.diff > o.diff) return -1;
            if(this.goal < o.goal) return 1;
            if(this.goal > o.goal) return -1;
            int res = this.name.compareTo(o.name);
            return res;
        }
        @Override
        public String toString() {
            return "C [name=" + name + ", score=" + score + ", diff=" + diff
                    + ", goal=" + goal + ", match=" + match + "]";
        }

    }

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            HashMap<String,Integer>map = new HashMap<String,Integer>();
            C [] data = new C[4];
            for(int i = 0; i < 5;i++){
                String line = sc.nextLine();
                String [] linearr = line.split(" |:");
                int id1 = -1, id2 = -1;
                if(map.containsKey(linearr[0])){
                    id1 = map.get(linearr[0]);
                }
                else{
                    int res = map.size();
                    id1 = res;
                    map.put(linearr[0], res);
                    data[id1] = new C(linearr[0], 0,0,0,0);
                }
                if(map.containsKey(linearr[1])){
                    id2 = map.get(linearr[1]);
                }
                else{
                    int res = map.size();
                    id2 = res;
                    map.put(linearr[1], res);
                    data[id2] = new C(linearr[1], 0,0,0,0);
                }
                //score
                int goal1 = Integer.parseInt(linearr[2]);
                int goal2 = Integer.parseInt(linearr[3]);
                if(goal1 > goal2){
                    data[id1].score += 3;
                }
                else if(goal1 < goal2){
                    data[id2].score += 3;
                }
                else{
                    data[id1].score++;
                    data[id2].score++;
                }
                //diff
                data[id1].diff += goal1 - goal2;
                data[id2].diff += goal2 - goal1;
                //goal
                data[id1].goal += goal1;
                data[id2].goal += goal2;
                //match
                data[id1].match++;
                data[id2].match++;
            }
            Arrays.sort(data);
            //find a myteam
            int myid = -1,op = -1;
            for(int i = 0; i < 4; i++){
                if(data[i].name.equals("BERLAND")){
                    myid = i;
                    break;
                }
            }
            for(int i=0; i < 4; i++){
                if(i == myid) continue;
                if(data[i].match == 2){
                    op = i;
                    break;
                }
            }

            if(myid == 0 || myid == 1){
                System.out.println("1:0");
            }
            else{
                boolean flg = false;
                C [] work = new C[4];
                int ansx = -1, ansy = -1;
                for(int diff = 0; diff < 100; diff++){
                    for(int x = diff; x < 100; x++){
                        for(int i = 0; i < 4; i++){
                            work[i] = new C(data[i].name, 0,0,0,0);
                            work[i].diff = data[i].diff;
                            work[i].goal = data[i].goal;
                            work[i].match = data[i].match;
                            work[i].score = data[i].score;
                        }
                        int y = x - diff;
                        if(diff == 0){
                            work[myid].score += 1;
                            work[op].score += 1;
                        }
                        else{
                            work[myid].score += 3;
                        }
                        work[myid].diff += x - y;
                        work[op].diff += y - x;
                        work[myid].goal += x;
                        work[op].goal += y;
                        Arrays.sort(work);
                        if(work[0].name.equals("BERLAND") || work[1].name.equals("BERLAND")){
                            ansx = x;
                            ansy = y;
                            flg = true;
                            break;
                        }
                    }
                    if(flg)break;
                }
                if(flg){
                    System.out.println(ansx + ":" + ansy);
                }
                else{
                    System.out.println("IMPOSSIBLE");
                }
            }
        }
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.util.*;

/**
 *
 *

 * Unsolved
 *

 *

 * Created on Jun 24, 2012, 11:16:48 AM
 *

 * @Author Andy Y.F. Huang
 */
public class p200C {
  class Team implements Comparable<Team> {
    String name;
    int gd;
    int goals;
    int points;

    public Team(Team x) {
      this.name = x.name;
      this.gd = x.gd;
      this.goals = x.goals;
      this.points = x.points;
    }

    public Team(String name) {
      this.name = name;
    }

    public int compareTo(Team o) {
      if (points != o.points)
        return o.points - points;
      if (gd != o.gd)
        return o.gd - gd;
      if (goals != o.goals)
        return o.goals - goals;
      return name.compareTo(o.name);
    }

    public String toString() {
      return name + ";" + points +"," + gd + "," + goals;
    }

  }

  private final String ber = "BERLAND";

  private void solve(int test_number) {
    Map<String, Integer> names = new HashMap<String, Integer>();
    Team teams[] = new Team[4];
    int games[] = new int[4];
    int cur = 1;
    names.put(ber, 0);
    for (int i = 0; i < 5; i++) {
      String a = in.next();
      String b = in.next();
      StringTokenizer st = new StringTokenizer(in.next(), "\t\r\n :");
      if (!names.containsKey(a))
        names.put(a, cur++);
      if (!names.containsKey(b))
        names.put(b, cur++);
      int x = names.get(a);
      int y = names.get(b);
      if (teams[x] == null)
        teams[x] = new Team(a);
      if (teams[y] == null)
        teams[y] = new Team(b);
      games[x]++;
      games[y]++;
      int sc1 = Integer.parseInt(st.nextToken());
      int sc2 = Integer.parseInt(st.nextToken());
      if (sc1 == sc2) {
        teams[x].points++;
        teams[y].points++;
      }
      else if (sc1 > sc2) {
        teams[x].points += 3;
      }
      else
        teams[y].points += 3;
      teams[x].goals += sc1;
      teams[y].goals += sc2;
      teams[x].gd += sc1 - sc2;
      teams[y].gd += sc2 - sc1;

    }

    int other = 1;
    while (games[other] == 3)
      other++;
    int x = 1500, y = 100;
    boolean poss = false;
    for (int a = 0; a < 100; a++) {
      for (int b = 0; b < a; b++) {
        Team copy[] = copy(teams);
        copy[0].points += 3;
        copy[0].goals += a;
        copy[0].gd += a - b;
        copy[other].goals += b;
        copy[other].gd += b - a;
        Arrays.sort(copy);
        int i = 0;
        while (!copy[i].name.equals(ber))
          i++;
        if (i <= 1 && a - b < x - y && b < y) {//poss
          //pln(Arrays.toString(copy));
          poss = true;
          x = a;
          y = b;
        }
      }
    }
    if (!poss)
      out.appendln("IMPOSSIBLE");
    else
      out.appendln(x, y);

  }

  private Team[] copy(Team orig[]) {
    Team ans[] = new Team[orig.length];
    for (int i = 0; i < ans.length; i++)
      ans[i] = new Team(orig[i]);
    return ans;
  }

  private Input in;
  private Output out;

  void solve() {
    in = new Input("");
    out = new Output("");
    int tests = 1;
    for (int i = 1; i <= tests; i++)
      solve(i);
    out.flush();
  }

  public static void main(String[] args) {
    // if (System.getProperty("AZN") != null) {
    // try {
    // System.setIn(new java.io.FileInputStream("input.txt"));
    // System.setOut(new java.io.PrintStream(new java.io.FileOutputStream(
    // "output.txt")));
    // }
    // catch (java.io.FileNotFoundException e) {
    // throw new RuntimeException(e);
    // }
    // }
    p200C solver = new p200C();
    solver.solve();
  }

  static void pln(Object... obj) {
    pf(obj);
    System.out.println();
  }

  static void pf(Object... obj) {
    for (int i = 0; i < obj.length; i++) {
      if (i != 0)
        System.out.print(' ');
      System.out.print(obj[i]);

    }
  }
}

final class Input {
  private java.io.BufferedReader reader;
  private java.util.StringTokenizer tokenizer;

  Input(String filename) {
    if (!filename.isEmpty()) {
      try {
        reader = new java.io.BufferedReader(new java.io.FileReader(filename));
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    }
    else
      reader = new java.io.BufferedReader(new java.io.InputStreamReader(
          System.in));
    tokenizer = new java.util.StringTokenizer("");
  }

  String next() {
    while (!tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      }
      catch (java.io.IOException e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  String nextLine() {
    try {
      return reader.readLine();
    }
    catch (java.io.IOException e) {
      throw new RuntimeException(e);
    }
  }

  long nextLong() {
    return Long.parseLong(next());
  }

  int nextInt() {
    return Integer.parseInt(next());
  }

  double nextDouble() {
    return Double.parseDouble(next());
  }

}

final class Output {
  private java.io.PrintWriter buffer;

  Output(String filename) {
    if (!filename.isEmpty())
      try {
        buffer = new java.io.PrintWriter(filename);
      }
      catch (java.io.FileNotFoundException e) {
        throw new RuntimeException();
      }
    else
      buffer = new java.io.PrintWriter(System.out);
  }

  void flush() {
    buffer.flush();
  }

  void close() {
    buffer.close();
  }

  void append(Object... obj) {
    for (int i = 0; i < obj.length; i++) {
      if (i != 0)
        buffer.write(' ');
      buffer.print(obj[i]);
    }
  }

  void appendln(Object... obj) {
    append(obj);
    buffer.write('\n');
  }

}

import java.io.*;
import java.util.*;

/**
 * */
public class Solution {

	public static List<Team> listTeams=Collections.synchronizedList(new ArrayList<Team>(4));
	public static Team BERLAND=null;
	public static TeamComparator teamComparator=null;

	public class Team{
		public String name;
		public Map<String,Integer> selfScores=Collections.synchronizedMap(new HashMap<String,Integer>());
		public Map<String,Integer> oppScores=Collections.synchronizedMap(new HashMap<String,Integer>());

		public Integer points=0;
		public Integer goalDiff=0;
		public Integer goalFor=0;

		public Team(String name){
			this.name=name;
		}
	}
	public Team newTeam(String name){
		return new Team(name);
	}

	public static Team getTeam(String name){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			if(team.name.equals(name))
				return team;
		}
		return null;
	}

	public static int getBerlandRanking(){
		Iterator<Team> iter=listTeams.iterator();
		while(iter.hasNext()){
			Team team=iter.next();
			team.points=team.goalDiff=team.goalFor=0;
			Iterator<String> iterOpp=team.selfScores.keySet().iterator();
			while(iterOpp.hasNext()){
				String oppName=iterOpp.next();
				int selfScore=team.selfScores.get(oppName);
				int oppScore=team.oppScores.get(oppName);
				team.points+=(selfScore>oppScore)?3:(selfScore==oppScore)?1:0;
				team.goalDiff+=(selfScore-oppScore);
				team.goalFor+=selfScore;
				}}
		Collections.sort(listTeams,teamComparator);
		return listTeams.indexOf(BERLAND);
	}

	public class TeamComparator implements Comparator<Team>{

		@Override
		public int compare(Team team1, Team team2) {
			if(team1.points.equals(team2.points)){
				if(team1.goalDiff.equals(team2.goalDiff)){
					if(team1.goalFor.equals(team2.goalFor))
						return team1.name.compareTo(team2.name);
					return team1.goalFor.compareTo(team2.goalFor);
				}
				return team1.goalDiff.compareTo(team2.goalDiff);
			}
			return team1.points.compareTo(team2.points);
		}}
	public TeamComparator newTeamComparator(){
		return new TeamComparator(); }

	/**
	 * @param args
	 */
	public static void main(String[] args){
	    try {

	    	BufferedReader reader =new BufferedReader( new InputStreamReader( System.in)); // STDIN

	    	// Teams
	    	Solution solution=new Solution();
	    	listTeams.add(solution.newTeam("BERLAND"));
	    	BERLAND=getTeam("BERLAND");
	    	teamComparator=solution.newTeamComparator();

	    	//
	    	for(int i=0;i!=5;i++){
	    		String[] result=reader.readLine().trim().split(" ",3);
	    		// Team1
	    		String name1=result[0].trim();
	    		Team team1=getTeam(name1);
	    		if(team1==null){
	    			listTeams.add(solution.newTeam(name1));
	    			team1=getTeam(name1);
	    		}
	    		// Team2
	    		String name2=result[1].trim();
	    		Team team2=getTeam(name2);
	    		if(team2==null){
	    			listTeams.add(solution.newTeam(name2));
	    			team2=getTeam(name2);
	    		}
	    		String[] score=result[2].trim().split(":",2);
	    		Integer score1=Integer.valueOf(score[0].trim());
	    		Integer score2=Integer.valueOf(score[1].trim());
	    		team1.selfScores.put(team2.name,score1);
	    		team1.oppScores.put(team2.name,score2);
	    		team2.selfScores.put(team1.name,score2);
	    		team2.oppScores.put(team1.name,score1);
	    	}

	    	String oppName="";
	    	Iterator<Team> iterTeam=listTeams.iterator();
	    	while(iterTeam.hasNext()&&(oppName=="")){
	    		Team team=iterTeam.next();
	    		if((team.oppScores.size()==2)&&(team.name!="BERLAND"))
	    			oppName=team.name; }

	    	//
	    	boolean bPossible=false;
	    	for(int diff=0;diff<=30;diff++){
	    		for(int opp=0;opp<=30;opp++){
	    			int selfScore=diff+opp;
	    			Team oppTeam=getTeam(oppName);
	    			oppTeam.selfScores.put(BERLAND.name,opp);
	    			oppTeam.oppScores.put(BERLAND.name,selfScore);
	    			BERLAND.selfScores.put(oppName,selfScore);
	    			BERLAND.oppScores.put(oppName,opp);
	    			if(getBerlandRanking()>=2){
	    				System.out.println(selfScore+":"+opp);
	    				bPossible=true;
	    				break;
	    			}
	    		}
	    		if(bPossible)
	    			break;
	    	}
	    	if(!bPossible)
	    		System.out.println("IMPOSSIBLE");

		    }catch(Exception e){
		    	e.printStackTrace(System.err);
		}
	}
}

import java.io.*;
import java.util.*;

public class Main {

   static class Assertion {
      static void check(boolean e) {
         if (!e) {
            throw new Error();
         }
      }
   }

   // class Scanner {
   // StreamTokenizer in;
   //
   // Scanner(InputStream s) {
   // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(s)));
   // in.resetSyntax();
   // in.whitespaceChars(0, 32);
   // in.wordChars(33, 255);
   // }
   //
   // String next() {
   // try {
   // in.nextToken();
   // return in.sval;
   // } catch (Exception e) {
   // throw new Error();
   // }
   // }
   //
   // int nextInt() {
   // return Integer.parseInt(next());
   // }
   //
   // long nextLong() {
   // return Long.parseLong(next());
   // }
   //
   // double nextDobule() {
   // return Double.parseDouble(next());
   // }
   // }

   Scanner in;
   PrintWriter out;

   class Team implements Comparable<Team> {
      int nGoals;
      int nleaves;
      String name;
      int nPoints;

      public Team(String name) {
         this.name = name;
      }

      @Override
      public int compareTo(Team second) {
         if (this.nPoints != second.nPoints) {
            return this.nPoints - second.nPoints;
         } else if (this.nGoals - this.nleaves != second.nGoals - second.nleaves) {
            return (this.nGoals - this.nleaves) - (second.nGoals - second.nleaves);
         } else if (this.nGoals != second.nGoals) {
            return this.nGoals - second.nGoals;
         } else {
            return -this.name.compareTo(second.name);

         }
      }
   }

   void solve() {
      TreeMap<String, Team> teams = new TreeMap<String, Main.Team>();
      for (int i = 0; i < 5; i++) {
         String first = in.next();
         String second = in.next();
         if (!teams.containsKey(first)) {
            teams.put(first, new Team(first));
         }
         if (!teams.containsKey(second)) {
            teams.put(second, new Team(second));
         }
         Team fTeam = teams.get(first);
         Team sTeam = teams.get(second);
         String score = in.next();
         int fTeamGoals = Integer.parseInt(score.substring(0, 1));
         int sTeamGoals = Integer.parseInt(score.substring(2, 3));
         Assertion.check(score.length()==3);
         if (fTeamGoals == sTeamGoals) {
            fTeam.nPoints++;
            fTeam.nGoals++;
            fTeam.nleaves++;
            sTeam.nPoints++;
            sTeam.nGoals++;
            sTeam.nleaves++;
         } else if (fTeamGoals > sTeamGoals) {
            fTeam.nPoints += 3;
            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;

            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;
         } else {
            sTeam.nPoints += 3;
            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;

            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;
         }
         teams.put(first, fTeam);
         teams.put(second, sTeam);
      }
      String berTeamSt = "BERLAND";
      Team berTeam = teams.get(berTeamSt);
      ArrayList<Team> teamList = new ArrayList<Main.Team>();
      for (String teamSt : teams.keySet()) {
         teamList.add(teams.get(teamSt));
      }
      Collections.sort(teamList);
      Team fTeam = berTeam;
      ArrayList<Team> teamBackUp = copy(teamList);
      boolean found = false;
      int bestNGoals = 0;
      int bestNLeaves = 100;
      for (Team sTeam : teamList) {
         if (!sTeam.name.equals(berTeam.name)) {
            for (int nG = 1; nG < 40; nG++) {
               for (int nL = 0; nL < nG; nL++) {
                  int fTeamGoals = nG;
                  int sTeamGoals = nL;
                  int tt = 0;
                  if (fTeamGoals == sTeamGoals) {
                     fTeam.nPoints++;
                     fTeam.nGoals++;
                     fTeam.nleaves++;
                     sTeam.nPoints++;
                     sTeam.nGoals++;
                     sTeam.nleaves++;
                     tt = 1;
                  } else if (fTeamGoals > sTeamGoals) {
                     fTeam.nPoints += 3;
                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;

                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;
                     tt = 2;
                  } else {
                     sTeam.nPoints += 3;
                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;

                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;
                     tt = 3;
                  }
                  Collections.sort(teamBackUp);
                  if (teamBackUp.get(2).name.equals(berTeamSt) || teamBackUp.get(3).name.equals(berTeamSt)) {
                     if (!found) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                     found = true;

                     if (nG - nL < bestNGoals - bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     } else if (nG - nL == bestNGoals - bestNLeaves && nL < bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                  }
                  if (tt == 1) {
                     fTeam.nPoints--;
                     fTeam.nGoals--;
                     fTeam.nleaves--;
                     sTeam.nPoints--;
                     sTeam.nGoals--;
                     sTeam.nleaves--;
                  } else if (tt == 2) {
                     fTeam.nPoints -= 3;
                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;

                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;
                  } else if (tt == 3) {
                     sTeam.nPoints -= 3;
                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;

                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;
                  }
               }
            }
         }
      }
      if (found) {
         Assertion.check(bestNGoals>0 && bestNLeaves<bestNGoals);
         out.print(bestNGoals + ":" + bestNLeaves);
      } else {
         out.println("IMPOSSIBLE");
      }
   }

   ArrayList<Team> copy(ArrayList<Team> from) {
      ArrayList<Team> copyList = new ArrayList<Main.Team>();
      for (Team team : from) {
         copyList.add(team);
      }
      return copyList;
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();
   }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int m,n;

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			input();
			solve();
		}
	}

	void solve()
	{
		node[] arr = new node[4];
		String en="";
		int i =0;
		for(String x:hm2.keySet())
		{
			if(hm2.get(x)==2 && !x.equals(ber))
				en = x;
		}
		boolean b = false;
		for(i =0;i<1000 & !b;i++)
			for(int j =i-1;j>=0 & !b;j--)
			{
				arr = new node[4];
				int l = 0;
				for(String x:hm.keySet())
				{
					node t = hm.get(x);
					node n = new node(t.name,t.score,t.goals,t.opp);
					if(x.equals(en))
					{
						n.goals+=j;
						n.opp+=i;
					}
					if(x.equals(ber))
					{
						n.goals+=i;
						n.score+=3;
						n.opp+=j;
					}
					arr[l++] = n;
				}
				Arrays.sort(arr);
				if(arr[2].name.equals(ber)||arr[3].name.equals(ber))
				{
					System.out.println(i+":"+j);
					b = true;
					break;
				}
			}
		if(!b)
		System.out.println("IMPOSSIBLE");
	}
	class node implements Comparable<node>
	{
		String name;
		int score;
		int goals;
		int opp;

		node(String _name, int _s, int _g, int _opp)
		{
			name = _name;
			score = _s;
			goals = _g;
			opp = _opp;
		}

		public int compareTo(node x)
		{
			if(score>x.score)
				return 1;
			else if(score==x.score)
			{
				if(goals-opp>x.goals-x.opp)
					return 1;
				else if(goals-opp ==x.goals-x.opp)
				{
					if(goals>x.goals)
						return 1;
					else if(goals==x.goals)
						return name.compareTo(x.name);
					else
						return -1;
				}
				else
					return -1;
			}
			else
				return -1;
		}

		public String toString()
		{
			return "("+name+","+score+","+goals+","+opp+")";
		}
	}
	String a,b,c;
	String ber;
	int index;
	HashMap<String,node> hm;
	HashMap<String,Integer> hm2;
	boolean input() throws IOException
	{
		ber = "BERLAND";
		index = 0;
		hm = new HashMap<String,node>();
		hm2 = new HashMap<String,Integer>();
		for(int k =0;k<5;k++)
		{
			a = ns();
			b = ns();
			c = ns();
			if(hm2.containsKey(a))
				hm2.put(a,hm2.get(a)+1);
			else
				hm2.put(a,1);

			if(hm2.containsKey(b))
				hm2.put(b,hm2.get(b)+1);
			else
				hm2.put(b,1);
			String[] sc = c.split(":");
			int sa = Integer.parseInt(sc[0]);
			int sb = Integer.parseInt(sc[1]);
			if(!hm.containsKey(a))
				hm.put(a, new node(a,0,0,0));
			if(!hm.containsKey(b))
				hm.put(b, new node(b,0,0,0));
			node i = hm.get(a);
			node j = hm.get(b);
			if(sa>sb)
				i.score+=3;
			else if(sa==sb)
			{
				i.score+=1;
				j.score+=1;
			}
			else
				j.score+=3;

			i.goals+=sa;
			j.opp+=sa;
			j.goals+=sb;
			i.opp+=sb;
		}
	//	debug(hm);
		return true;
	}
}

import java.util.*;

public class Main {
	Scanner cin;
	String[] teamA, teamB, score;

	Boolean solve(int x, int y) {
		int cnt = 0;
		String[] teamName = new String[4];
		int[] winP = new int[4], db = new int[4], sg = new int[4];
		Arrays.fill(winP, 0);
		Arrays.fill(db, 0);
		Arrays.fill(sg, 0);

		Map<String, Integer> tn = new HashMap<String, Integer>();
		Map<String, Integer> counter = new HashMap<String, Integer>();

		for (int i = 0; i < 5; i++) {
			if (tn.containsKey(teamA[i]) == false) {
				teamName[cnt] = teamA[i];
				tn.put(teamA[i], cnt);
				cnt++;
			}
			if (tn.containsKey(teamB[i]) == false) {
				teamName[cnt] = teamB[i];
				tn.put(teamB[i], cnt);
				cnt++;
			}
		}
		for (int i = 0; i < 4; i++) {
			counter.put(teamName[i], 0);
		}

		for (int i = 0; i < 5; i++) {
			counter.put(teamA[i], counter.get(teamA[i]) + 1);
			counter.put(teamB[i], counter.get(teamB[i]) + 1);

			int X = Integer.parseInt(score[i].split(":")[0]);
			int Y = Integer.parseInt(score[i].split(":")[1]);
			if (X == Y) {
				winP[tn.get(teamA[i])] += 1;
				winP[tn.get(teamB[i])] += 1;
			} else if (X > Y) {
				winP[tn.get(teamA[i])] += 3;
				winP[tn.get(teamB[i])] += 0;
			} else {
				winP[tn.get(teamA[i])] += 0;
				winP[tn.get(teamB[i])] += 3;
			}
			db[tn.get(teamA[i])] += X - Y;
			db[tn.get(teamB[i])] -= X - Y;

			sg[tn.get(teamA[i])] += X;
			sg[tn.get(teamB[i])] += Y;
		}
		sg[tn.get("BERLAND")] += x;
		db[tn.get("BERLAND")] += x - y;
		winP[tn.get("BERLAND")] += 3;
		for (int i = 0; i < 4; i++) {
			if (teamName[i].equals("BERLAND"))
				continue;
			if (counter.get(teamName[i]) == 2) {
				db[i] += y - x;
				sg[i] += y;
			}
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				Boolean big = false;
				if (winP[j] != winP[j + 1]) {
					big = winP[j] < winP[j + 1];
				} else if (db[j] != db[j + 1]) {
					big = db[j] < db[j + 1];
				} else if (sg[j] != sg[j + 1]) {
					big = sg[j] < sg[j + 1];
				} else {
					big = teamName[j].compareTo(teamName[j + 1]) > 0;
				}
				if (big) {
					String tmp = teamName[j];
					teamName[j] = teamName[j + 1];
					teamName[j + 1] = tmp;
					int _tmp = winP[j];
					winP[j] = winP[j + 1];
					winP[j + 1] = _tmp;
					_tmp = db[j];
					db[j] = db[j + 1];
					db[j + 1] = _tmp;
					_tmp = sg[j];
					sg[j] = sg[j + 1];
					sg[j + 1] = _tmp;
				}
			}
		}

		for (int i = 0; i < 4; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
		}
		for (int i = 0; i < 2; i++) {
			// System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
			if (teamName[i].equals("BERLAND"))
				return true;
		}
		return false;
	}

	void run() {
		cin = new Scanner(System.in);
		teamA = new String[5];
		teamB = new String[5];
		score = new String[5];
		for (int i = 0; i < 5; i++) {
			teamA[i] = cin.next();
			teamB[i] = cin.next();
			score[i] = cin.next();
		}
		for (int y = 0; y <= 100; y++) {
			for (int x = y+1; x <= 500; x++) {
				if (solve(x,y)) {
					System.out.printf("%d:%d", x,y);
					return;
				}
			}
		}

		System.out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class First
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class Team
{
    String teamName;
    int score;
    int goalFor;
    int goalAgainst;
    int matchPlayed;

    public Team(String teamName, int score, int goalFor, int goalAgainst, int matchPlayed)
    {
        super();
        this.teamName = teamName;
        this.score = score;
        this.goalFor = goalFor;
        this.goalAgainst = goalAgainst;
        this.matchPlayed = matchPlayed;
    }
}

class MyComparator implements Comparator<Team>
{
    @Override
    public int compare(Team t1, Team t2)
    {

        if(t1.score < t2.score) return 1;
        if(t1.score > t2.score) return -1;
        if(t1.goalFor - t1.goalAgainst < t2.goalFor - t2.goalAgainst) return 1;
        if(t1.goalFor - t1.goalAgainst > t2.goalFor - t2.goalAgainst) return -1;
        if(t1.goalFor < t2.goalFor) return 1;
        if(t1.goalFor > t2.goalFor) return -1;
        return t1.teamName.compareTo(t2.teamName);
    }
}

class TaskA
{
    public void solve(int testNumber, InputReader in, PrintWriter out)
    {
        Set <String> hset = new HashSet <String> ();
        String[] inputStr = new String[5];
        for(int i = 0; i < 5; i++)
        {
            inputStr[i] = in.nextLine();
        }

        Team[] team = new Team[4];
        for(int i = 0; i < 5; i++)
        {
            String str = inputStr[i];
            str = str.replace(":", " ");
            String[] ans = str.split("[ ]+");
            hset.add(ans[0]); hset.add(ans[1]);
        }
        int index = 0;
        for(String str : hset)
        {
            int myScore = 0;
            int myGoalFor = 0;
            int myGoalAgainst = 0;
            int matchPlayed = 0;
            for(int i = 0; i < 5; i++)
            {
                String current = inputStr[i];
                current = current.replace(":", " ");
                String[] ans = current.split("[ ]+");
                String firstTeam = ans[0];
                String secondTeam = ans[1];
                int firstScoreGoal = Integer.parseInt(ans[2]);
                int secondScoreGoal = Integer.parseInt(ans[3]);

                if(firstTeam.equals(str))
                {
                    myGoalFor += firstScoreGoal;
                    myGoalAgainst += secondScoreGoal;
                    if(firstScoreGoal > secondScoreGoal)
                    {
                        myScore += 3;
                    }
                    if(firstScoreGoal == secondScoreGoal)
                        myScore++;
                    matchPlayed++;
                }
                if(secondTeam.equals(str))
                {
                    myGoalFor += secondScoreGoal;
                    myGoalAgainst += firstScoreGoal;
                    if(secondScoreGoal > firstScoreGoal) myScore += 3;
                    if(secondScoreGoal == firstScoreGoal) myScore++;
                    matchPlayed++;
                }
            }
            team[index++] = new Team(str, myScore, myGoalFor, myGoalAgainst, matchPlayed);
        }
        Arrays.sort(team, new MyComparator());

        index = 0; int i = 0;
        for(Team item : team)
        {   if(item.teamName.equals("BERLAND"))
                index = i;
            i++;
            //System.out.println(item.teamName + " " + item.score + "  " + item.goalFor + "  " + item.goalAgainst + " " + item.matchPlayed);
        }
        if(team[0].teamName.equals("BERLAND") || team[1].teamName.equals("BERLAND"))
            out.println("1:0");

        else
        {
            String secondTeamName = team[1].teamName;
            int secondScore = team[1].score;
            int secondGoalFor = team[1].goalFor;
            int secondGoalAgainst = team[1].goalAgainst;
            int differenceSecond = secondGoalFor - secondGoalAgainst;

            int berlandScore = team[index].score;
            int berlandGoalFor = team[index].goalFor;
            int berlandGoalAgainst = team[index].goalAgainst;
            int differenceBerland = berlandGoalFor - berlandGoalAgainst;
            if(secondScore <= berlandScore + 2)
            {
                out.println("1:0");
            }
            else if (secondScore > berlandScore + 3)
            {
                out.println("IMPOSSIBLE");
            }
            else
            {
                int kk = 0;
                for(int k = 1; k < 4; k++)
                {
                    if(team[k].teamName.equals("BERLAND") == false && team[k].matchPlayed == 2)
                    {
                        kk = k;
                        break;
                    }
                }
                Team[] tempTeam = new Team[4];

                outer:for(int diff = 1; ; diff++)
                {
                for(int goals = diff; ; goals++)
                {
                    for(int step = 0; step < 4; step++)
                    {
                        tempTeam[step] = new Team(team[step].teamName, team[step].score, team[step].goalFor , team[step].goalAgainst, team[step].matchPlayed);
                    }

                    int myGoals = goals;
                    int hisGoals = goals - diff;
                    tempTeam[index].score += 3;
                    tempTeam[index].goalFor += myGoals;
                    tempTeam[index].goalAgainst += myGoals - hisGoals;

                    tempTeam[kk].goalAgainst += myGoals;
                    tempTeam[kk].goalFor += myGoals - hisGoals;

                    Arrays.sort(tempTeam, new MyComparator());
                    if(tempTeam[0].teamName.equals("BERLAND") || tempTeam[1].teamName.equals("BERLAND"))
                    {
                        out.println(goals + ":0");
                        break outer;
                    }
                    if(goals > 60) continue outer;
                }
                }
            }
        }
    }
}

class InputReader
{
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream)
    {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next()
    {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
        {
            try
            {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt()
    {
        return Integer.parseInt(next());
    }

    public String nextLine()
    {
        String inputLine = "";
        try
        {
            inputLine = reader.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return inputLine;
    }
}

import java.util.*;

public class Main {
	Scanner cin;
	String[] teamA,teamB,score;

	Boolean solve(int x){
		int cnt=0;
		String[] teamName= new String[4];
		int[] winP=new int[4],db=new int[4],sg=new int[4];
		Map<String,Integer> tn=new HashMap<String,Integer>();
		Map<String,Integer> counter=new HashMap<String,Integer>();

		for(int i=0;i<5;i++){
			if(tn.containsKey(teamA[i])==false){
				teamName[cnt]=teamA[i];
				tn.put(teamA[i], cnt);
				cnt++;
			}
			if(tn.containsKey(teamB[i])==false){
				teamName[cnt]=teamB[i];
				tn.put(teamB[i], cnt);
				cnt++;
			}
		}
		for(int i=0;i<4;i++){
			counter.put(teamName[i], 0);
		}

		for(int i=0;i<5;i++){
			counter.put(teamA[i], counter.get(teamA[i])+1);
			counter.put(teamB[i], counter.get(teamB[i])+1);

			int X=Integer.parseInt(score[i].split(":")[0]);
			int Y=Integer.parseInt(score[i].split(":")[1]);
			if(X==Y){
				winP[tn.get(teamA[i])]+=1;
				winP[tn.get(teamB[i])]+=1;
			}else if(X>Y){
				winP[tn.get(teamA[i])]+=3;
				winP[tn.get(teamB[i])]+=0;
			}else{
				winP[tn.get(teamA[i])]+=0;
				winP[tn.get(teamB[i])]+=3;
			}
			db[tn.get(teamA[i])]+=X-Y;
			db[tn.get(teamB[i])]-=X-Y;

			sg[tn.get(teamA[i])]+=X;
			sg[tn.get(teamB[i])]+=Y;
		}
		sg[tn.get("BERLAND")]+=x;
		db[tn.get("BERLAND")]+=x;
		winP[tn.get("BERLAND")]+=3;
		for(int i=0;i<4;i++){
			if(teamName[i].equals("BERLAND"))continue;
			if(counter.get(teamName[i])==2){
				db[i]-=x;
			}
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<3;j++){
				Boolean big=false;
				if(winP[j]!=winP[j+1]){
					big=winP[j]<winP[j+1];
				}else if(db[j]!=db[j+1]){
					big=db[j]<db[j+1];
				}else if(sg[j]!=sg[j+1]){
					big=sg[j]<sg[j+1];
				}else{
					big=teamName[j].compareTo(teamName[j+1])>0;
				}
				if(big){
					String tmp=teamName[j];teamName[j]=teamName[j+1];teamName[j+1]=tmp;
					int _tmp=winP[j];winP[j]=winP[j+1];winP[j+1]=_tmp;
					_tmp=db[j];db[j]=db[j+1];db[j+1]=_tmp;
					_tmp=sg[j];sg[j]=sg[j+1];sg[j+1]=_tmp;
				}
			}
		}

		for(int i=0;i<2;i++){
			//System.out.printf("%s:%d:%d:%d\n",teamName[i],winP[i],db[i],sg[i]);
			if(teamName[i].equals("BERLAND"))return true;
		}
		return false;
	}
	void run() {
		cin = new Scanner(System.in);
		teamA=new String[5];
		teamB=new String[5];
		score=new String[5];
		for(int i=0;i<5;i++){
			teamA[i]=cin.next();
			teamB[i]=cin.next();
			score[i]=cin.next();
		}
		for(int x=1;x<=100;x++){
			if(solve(x)){
				System.out.printf("%d:0",x);
				return;
			}
		}

		System.out.println("IMPOSSIBLE");
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer tokenizer=null;

	public static void main(String[] args) throws IOException
	{
		new Main().execute();
	}

	void debug(Object...os)
	{
		System.out.println(Arrays.deepToString(os));
	}

	int ni() throws IOException
	{
		return Integer.parseInt(ns());
	}

	long nl() throws IOException
	{
		return Long.parseLong(ns());
	}

	double nd() throws IOException
	{
		return Double.parseDouble(ns());
	}

	String ns() throws IOException
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(br.readLine());
		return tokenizer.nextToken();
	}

	String nline() throws IOException
	{
		tokenizer=null;
		return br.readLine();
	}

	//Main Code starts Here
	int totalCases, testNum;
	int m,n;

	void execute() throws IOException
	{
		totalCases = 1;
		for(testNum = 1; testNum <= totalCases; testNum++)
		{
			input();
			solve();
		}
	}

	void solve()
	{
		node[] arr = new node[4];
		String en="";
		int i =0;
		for(String x:hm2.keySet())
		{
			if(hm2.get(x)==2 && !x.equals(ber))
				en = x;
		}
		boolean b = false;
		for(i =0;i<1000 & !b;i++)
			for(int j =i-1;j>=0 & !b;j--)
			{
				arr = new node[4];
				int l = 0;
				for(String x:hm.keySet())
				{
					node t = hm.get(x);
					node n = new node(t.name,t.score,t.goals,t.opp);
					if(x.equals(en))
					{
						n.goals+=j;
						n.opp+=i;
					}
					if(x.equals(ber))
					{
						n.goals+=i;
						n.score+=3;
						n.opp+=j;
					}
					arr[l++] = n;
				}
				Arrays.sort(arr);
				//debug(i,j,arr);
				if(arr[2].name.equals(ber)||arr[3].name.equals(ber))
				{
					System.out.println(i+":"+j);
					b = true;
					break;
				}
			}
		if(!b)
		System.out.println("IMPOSSIBLE");
	}
	class node implements Comparable<node>
	{
		String name;
		int score;
		int goals;
		int opp;

		node(String _name, int _s, int _g, int _opp)
		{
			name = _name;
			score = _s;
			goals = _g;
			opp = _opp;
		}

		public int compareTo(node x)
		{
			if(score>x.score)
				return 1;
			else if(score==x.score)
			{
				if(goals-opp>x.goals-x.opp)
					return 1;
				else if(goals-opp ==x.goals-x.opp)
				{
					if(goals>x.goals)
						return 1;
					else if(goals==x.goals)
						return -name.compareTo(x.name);
					else
						return -1;
				}
				else
					return -1;
			}
			else
				return -1;
		}

		public String toString()
		{
			return "("+name+","+score+","+goals+","+opp+")";
		}
	}
	String a,b,c;
	String ber;
	int index;
	HashMap<String,node> hm;
	HashMap<String,Integer> hm2;
	boolean input() throws IOException
	{
		ber = "BERLAND";
		index = 0;
		hm = new HashMap<String,node>();
		hm2 = new HashMap<String,Integer>();
		for(int k =0;k<5;k++)
		{
			a = ns();
			b = ns();
			c = ns();
			if(hm2.containsKey(a))
				hm2.put(a,hm2.get(a)+1);
			else
				hm2.put(a,1);

			if(hm2.containsKey(b))
				hm2.put(b,hm2.get(b)+1);
			else
				hm2.put(b,1);
			String[] sc = c.split(":");
			int sa = Integer.parseInt(sc[0]);
			int sb = Integer.parseInt(sc[1]);
			if(!hm.containsKey(a))
				hm.put(a, new node(a,0,0,0));
			if(!hm.containsKey(b))
				hm.put(b, new node(b,0,0,0));
			node i = hm.get(a);
			node j = hm.get(b);
			if(sa>sb)
				i.score+=3;
			else if(sa==sb)
			{
				i.score+=1;
				j.score+=1;
			}
			else
				j.score+=3;

			i.goals+=sa;
			j.opp+=sa;
			j.goals+=sb;
			i.opp+=sb;
		}
	//	debug(hm);
		return true;
	}
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class FootballChampionship200C {
	private static final String B_TEAM_NAME = "BERLAND";
	private static final int MAX_GOAL = 100;

	public static void main(String[] args) {
		String[] teams = new String[4];
		int[] goals = new int[4];
		int[] misses = new int[4];
		int[] scores = new int[4];
		int[] matches = new int[4];
		HashMap<String, Integer> teamMap = new HashMap<String, Integer>();
		Scanner in = new Scanner(System.in);
		int index = 0;
		for (int i = 0; i < 5; i++) {
			String team1 = in.next();
			if (teamMap.get(team1) == null) {
				teamMap.put(team1, index);
				teams[index++] = team1;
			}
			String team2 = in.next();
			if (teamMap.get(team2) == null) {
				teamMap.put(team2, index);
				teams[index++] = team2;
			}
			String score = in.next();
			int g1 = Integer.parseInt(score.substring(0, 1));
			int g2 = Integer.parseInt(score.substring(2));
			int t1 = teamMap.get(team1);
			int t2 = teamMap.get(team2);
			goals[t1] += g1;
			misses[t2] += g1;
			goals[t2] += g2;
			misses[t1] += g2;
			if (g1 == g2) {
				scores[t1]++;
				scores[t2]++;
			} else if (g1 > g2) {
				scores[t1] += 3;
			} else {
				scores[t2] += 3;
			}
			matches[t1]++;
			matches[t2]++;
		}
		int tb = teamMap.get("BERLAND");
		int to = 0;
		for (int i = 0; i < 4; i++)
			if (matches[i] != 3 && i != tb)
				to = i;
		int rx = -1, ry = -1;
		for (int x = 0; x <= MAX_GOAL; x++)
			for (int y = 0; y <= MAX_GOAL; y++) {
				int[] gs = goals.clone();
				int[] ms = misses.clone();
				int[] ss = scores.clone();
				gs[tb] += x;
				ms[to] += x;
				gs[to] += y;
				ms[tb] += y;
				if (x == y) {
					ss[tb]++;
					ss[to]++;
				} else if (x > y)
					ss[tb] += 3;
				else
					ss[to] += 3;
				if (satisfied(gs, ms, ss, teams, tb)) {
					if (rx == -1) {
						rx = x;
						ry = y;
					} else if (x - y < rx - ry) {
						rx = x;
						ry = y;
					} else if (x - y == rx - ry && y < ry) {
						rx = x;
						ry = y;
					}
				}
			}
		if (rx != -1 && ry != -1) {
			System.out.printf("%d:%d\n", rx, ry);
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	private static boolean satisfied(int[] gs, int[] ms, int[] ss, String[] ts,
			int tb) {
		Team[] teams = new Team[4];
		for (int i = 0; i < 4; i++) {
			Team t = new Team();
			t.id = i;
			t.goal = gs[i];
			t.miss = ms[i];
			t.score = ss[i];
			t.name = ts[i];
			teams[i] = t;
		}
		Arrays.sort(teams);
		if (teams[0].name.equalsIgnoreCase(B_TEAM_NAME)
				|| teams[1].name.equalsIgnoreCase(B_TEAM_NAME))
			return true;
		else
			return false;
	}

	static class Team implements Comparable<Team> {
		int goal, miss, score, id;
		String name;

		private int diff() {
			return goal - miss;
		}

		@Override
		public int compareTo(Team other) {
			if (this.score > other.score)
				return -1;
			if (this.score < other.score)
				return 1;
			if (this.diff() > other.diff())
				return -1;
			if (this.diff() < other.diff())
				return 1;
			if (this.goal > other.goal)
				return -1;
			if (this.goal < other.goal)
				return 1;
			if (this.name.compareTo(other.name) < 0)
				return -1;
			if (this.name.compareTo(other.name) > 0)
				return 1;
			return 0;
		}
	}
}

import java.io.*;
import java.util.*;

public class Main {

   static class Assertion {
      static void check(boolean e) {
         if (!e) {
            throw new Error();
         }
      }
   }

   // class Scanner {
   // StreamTokenizer in;
   //
   // Scanner(InputStream s) {
   // in = new StreamTokenizer(new BufferedReader(new InputStreamReader(s)));
   // in.resetSyntax();
   // in.whitespaceChars(0, 32);
   // in.wordChars(33, 255);
   // }
   //
   // String next() {
   // try {
   // in.nextToken();
   // return in.sval;
   // } catch (Exception e) {
   // throw new Error();
   // }
   // }
   //
   // int nextInt() {
   // return Integer.parseInt(next());
   // }
   //
   // long nextLong() {
   // return Long.parseLong(next());
   // }
   //
   // double nextDobule() {
   // return Double.parseDouble(next());
   // }
   // }

   Scanner in;
   PrintWriter out;

   class Team implements Comparable<Team> {
      int nGoals;
      int nleaves;
      String name;
      int nPoints;

      public Team(String name) {
         this.name = name;
      }

      @Override
      public int compareTo(Team second) {
         if (this.nPoints != second.nPoints) {
            return this.nPoints - second.nPoints;
         } else if (this.nGoals - this.nleaves != second.nGoals - second.nleaves) {
            return (this.nGoals - this.nleaves) - (second.nGoals - second.nleaves);
         } else if (this.nGoals != second.nGoals) {
            return this.nGoals - second.nGoals;
         } else {
            return -this.name.compareTo(second.name);

         }
      }
   }

   void solve() {
      TreeMap<String, Team> teams = new TreeMap<String, Main.Team>();
      for (int i = 0; i < 5; i++) {
         String first = in.next();
         String second = in.next();
         if (!teams.containsKey(first)) {
            teams.put(first, new Team(first));
         }
         if (!teams.containsKey(second)) {
            teams.put(second, new Team(second));
         }
         Team fTeam = teams.get(first);
         Team sTeam = teams.get(second);
         String score = in.next();
         int fTeamGoals = Integer.parseInt(score.substring(0, 1));
         int sTeamGoals = Integer.parseInt(score.substring(2, 3));
         if (fTeamGoals == sTeamGoals) {
            fTeam.nPoints++;
            fTeam.nGoals++;
            fTeam.nleaves++;
            sTeam.nPoints++;
            sTeam.nGoals++;
            sTeam.nleaves++;
         } else if (fTeamGoals > sTeamGoals) {
            fTeam.nPoints += 3;
            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;

            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;
         } else {
            sTeam.nPoints += 3;
            sTeam.nGoals += sTeamGoals;
            sTeam.nleaves += fTeamGoals;

            fTeam.nGoals += fTeamGoals;
            fTeam.nleaves += sTeamGoals;
         }
         teams.put(first, fTeam);
         teams.put(second, sTeam);
      }
      String berTeamSt = "BERLAND";
      Team berTeam = teams.get(berTeamSt);
      ArrayList<Team> teamList = new ArrayList<Main.Team>();
      for (String teamSt : teams.keySet()) {
         teamList.add(teams.get(teamSt));
      }
      Team fTeam = berTeam;
      ArrayList<Team> teamBackUp = copy(teamList);
      boolean found = false;
      int bestNGoals = 0;
      int bestNLeaves = 100;
      for (Team sTeam : teamList) {
         if (!sTeam.name.equals(berTeam.name)) {
            for (int nG = 1; nG < 40; nG++) {
               for (int nL = 0; nL < nG; nL++) {
                  int fTeamGoals = nG;
                  int sTeamGoals = nL;
                  int tt = 0;
                  if (fTeamGoals == sTeamGoals) {
                     fTeam.nPoints++;
                     fTeam.nGoals++;
                     fTeam.nleaves++;
                     sTeam.nPoints++;
                     sTeam.nGoals++;
                     sTeam.nleaves++;
                     tt = 1;
                  } else if (fTeamGoals > sTeamGoals) {
                     fTeam.nPoints += 3;
                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;

                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;
                     tt = 2;
                  } else {
                     sTeam.nPoints += 3;
                     sTeam.nGoals += sTeamGoals;
                     sTeam.nleaves += fTeamGoals;

                     fTeam.nGoals += fTeamGoals;
                     fTeam.nleaves += sTeamGoals;
                     tt = 3;
                  }
                  Collections.sort(teamBackUp);
                  if (teamBackUp.get(2).name.equals(berTeamSt) || teamBackUp.get(3).name.equals(berTeamSt)) {
                     if (!found) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                     found = true;

                     if (nG - nL < bestNGoals - bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     } else if (nG - nL == bestNGoals - bestNLeaves && nL < bestNLeaves) {
                        bestNGoals = nG;
                        bestNLeaves = nL;
                     }
                  }
                  if (tt == 1) {
                     fTeam.nPoints--;
                     fTeam.nGoals--;
                     fTeam.nleaves--;
                     sTeam.nPoints--;
                     sTeam.nGoals--;
                     sTeam.nleaves--;
                  } else if (tt == 2) {
                     fTeam.nPoints -= 3;
                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;

                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;
                  } else if (tt == 3) {
                     sTeam.nPoints -= 3;
                     sTeam.nGoals -= sTeamGoals;
                     sTeam.nleaves -= fTeamGoals;

                     fTeam.nGoals -= fTeamGoals;
                     fTeam.nleaves -= sTeamGoals;
                  }
               }
            }
         }
      }
      if (found) {
         Assertion.check(bestNGoals>0 && bestNLeaves<bestNGoals);
         out.print(bestNGoals + ":" + bestNLeaves);
      } else {
         out.println("IMPOSSIBLE");
      }
   }

   ArrayList<Team> copy(ArrayList<Team> from) {
      ArrayList<Team> copyList = new ArrayList<Main.Team>();
      for (Team team : from) {
         copyList.add(team);
      }
      return copyList;
   }

   void run() {
      in = new Scanner(System.in);
      out = new PrintWriter(System.out);
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();
   }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        PrintWriter out = new PrintWriter(System.out,true);
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Map<String,Team> teams = new HashMap<>();
        for(int i = 0;i < 5;i++) {
            StringTokenizer st = new StringTokenizer(in.readLine()," :");
            String team1 = st.nextToken();
            String team2 = st.nextToken();
            if(!teams.containsKey(team1)) teams.put(team1,new Team(team1));
            if(!teams.containsKey(team2)) teams.put(team2,new Team(team2));
            int goals1 = Integer.parseInt(st.nextToken());
            int goals2 = Integer.parseInt(st.nextToken());
            if(goals1 > goals2) {
                teams.get(team1).points += 3;
                teams.get(team1).dist += goals1 - goals2;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 0;
                teams.get(team2).dist += goals2 - goals1;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
            if(goals1 < goals2) {
                teams.get(team1).points += 0;
                teams.get(team1).dist += goals1 - goals2;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 3;
                teams.get(team2).dist += goals2 - goals1;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
            if(goals1 == goals2) {
                teams.get(team1).points += 1;
                teams.get(team1).dist += 0;
                teams.get(team1).goals += goals1;
                teams.get(team1).matches++;
                teams.get(team2).points += 1;
                teams.get(team2).dist += 0;
                teams.get(team2).goals += goals2;
                teams.get(team2).matches++;
            }
        }
        Team[] mas = new Team[4];
        int i = 0;
        for(Map.Entry<String,Team> a : teams.entrySet()) {
            mas[i] = a.getValue();
            i++;
        }
        for(int j = 0;i <= 500;i++) {
            for(int k = 0;k <= 500;k++) {
                if(k <= j) continue;
                for(int p = 0;p < mas.length;p++) {
                    if(mas[p].name.equals("BERLAND")) {
                        mas[p].points += 3;
                        mas[p].dist += k-j;
                        mas[p].goals += k;
                    }
                    if(mas[p].matches == 2 && !mas[p].name.equals("BERLAND")) {
                        mas[p].points += 0;
                        mas[p].dist += j-k;
                        mas[p].goals += j;
                    }
                }
                Arrays.sort(mas, new Comparator<Team>() {
                    @Override
                    public int compare(Team t1, Team t2) {
                        if(t1.points > t2.points) return -1;
                        if(t1.points < t2.points) return 1;
                        if(t1.dist > t2.dist) return -1;
                        if(t1.dist < t2.dist) return 1;
                        if(t1.goals > t2.goals) return -1;
                        if(t1.goals < t2.goals) return 1;
                        return t1.name.compareTo(t2.name);
                    }
                });
                for(int p = 0;p < mas.length;p++) {
                    if(mas[p].name.equals("BERLAND")) {
                        mas[p].points -= 3;
                        mas[p].dist -= k-j;
                        mas[p].goals -= k;
                    }
                    if(mas[p].matches == 2 && !mas[p].name.equals("BERLAND")) {
                        mas[p].points -= 0;
                        mas[p].dist -= j-k;
                        mas[p].goals -= j;
                    }
                }
                if(mas[0].name.equals("BERLAND") || mas[1].name.equals("BERLAND")) {
                    out.println(k+":"+j);
                    return;
                }
            }

        }
        out.println("IMPOSSIBLE");
    }

    public static boolean T1bolT2(Team t1, Team t2) {
        if(t1.points > t2.points) return true;
        else if(t1.dist > t2.dist) return true;
        else if(t1.goals > t2.goals) return true;
        else if(t1.name.compareTo(t2.name) < 0) return true;
        return false;
    }
}

class Team {
    String name;
    int points = 0;
    int dist = 0;
    int goals = 0;
    int matches = 0;
    Team(String name) {
        this.name = name;
    }
}

import java.io.*;
import java.rmi.server.UID;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Q200C implements Runnable {
    Map<String, Data> table = new HashMap<String, Data>();
    static String BERLAND = "BERLAND";
    private void solve() throws IOException {
        //solve

        for (int i = 0; i < 5; i++) {
            String t1 = nextToken();
            String t2 = nextToken();
            String score = nextToken();
            int s1 = Integer.parseInt(score.substring(0, score.indexOf(":")));
            int s2 = Integer.parseInt(score.substring(score.indexOf(":") + 1));
            addRes(t1, t2, s1, s2);
        }
        Data[] t = new Data[4];
        int i = 1;
        int other =0;
        t[0]=table.remove(BERLAND);
        for (Data d : table.values()) {
            t[i++] = d;
            if(d.games==2)other = i-1;
        }

        int x1=-1;
        int x2=-1;
        t[0].points+=3;
        for (int s1 = 1; s1 < 50; s1++) {
            for (int s2 = 0; s2 < s1; s2++) {
                int betterThen=0;
                t[0].s+=s1;
                t[0].m+=s2;
                t[other].s+=s2;
                t[other].m+=s1;

                for (int j = 0; j < 3; j++) {
                    if(t[0].compareTo(t[1+j])>0)betterThen++;
                }
                t[0].s-=s1;
                t[0].m-=s2;
                t[other].s-=s2;
                t[other].m-=s1;

                if(betterThen>=2 && (x1==-1 || (s1-s2)<(x1-x2) || ((s1-s2)==(x1-x2) && s2<x2))){
                    x1=s1;x2=s2;
                }
            }
        }

        if(x1==-1)writer.println("IMPOSSIBLE");
        else{
            writer.println(x1+":"+x2);
        }
    }

    private void addRes(String t1, String t2, int s1, int s2) {
        if (!table.containsKey(t1)) {
            table.put(t1, new Data(t1));
        }
        if (!table.containsKey(t2)) {
            table.put(t2, new Data(t2));
        }

        Data d1 = table.get(t1);
        Data d2 = table.get(t2);
        d1.s += s1;
        d1.m += s2;
        d2.s += s2;
        d2.m += s1;
        d1.points += s1 > s2 ? 3 : s1 == s2 ? 1 : 0;
        d2.points += s2 > s1 ? 3 : s2 == s1 ? 1 : 0;

        d1.games++;
        d2.games++;
    }

    private static class Data implements Comparable<Data>{
        int games;
        String name;
        int points;
        int s;
        int m;

        public Data(String t1) {
            name = t1;
        }

        public int compareTo(Data o) {
            if(points>o.points)return 1;
            else if(points<o.points)return -1;
            else{
                if(s-m>o.s-o.m)return 1;
                else if(s-m<o.s-o.m)return -1;
                else{
                    if(s>o.s)return 1;
                    else if(s<o.s)return -1;
                    else{
                        return name.compareTo(o.name);
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        new Q200C().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            boolean oj = System.getProperty("ONLINE_JUDGE") != null;
            reader = oj ? new BufferedReader(new InputStreamReader(System.in)) :
                    new BufferedReader(new FileReader(new File("input.txt")));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            long start = System.currentTimeMillis();
            solve();
            reader.close();
            if (!oj) writer.print("\nTime: " + (System.currentTimeMillis() - start) + "\n");
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class FootballChampionship200C {
	private static final String B_TEAM_NAME = "BERLAND";

	public static void main(String[] args) {
		String[] teams = new String[4];
		int[] goals = new int[4];
		int[] misses = new int[4];
		int[] scores = new int[4];
		int[] matches = new int[4];
		HashMap<String, Integer> teamMap = new HashMap<String, Integer>();
		Scanner in = new Scanner(System.in);
		int index = 0;
		for (int i = 0; i < 5; i++) {
			String team1 = in.next();
			if (teamMap.get(team1) == null) {
				teamMap.put(team1, index);
				teams[index++] = team1;
			}
			String team2 = in.next();
			if (teamMap.get(team2) == null) {
				teamMap.put(team2, index);
				teams[index++] = team2;
			}
			String score = in.next();
			int g1 = Integer.parseInt(score.substring(0, 1));
			int g2 = Integer.parseInt(score.substring(2));
			int t1 = teamMap.get(team1);
			int t2 = teamMap.get(team2);
			goals[t1] += g1;
			misses[t2] += g1;
			goals[t2] += g2;
			misses[t1] += g2;
			if (g1 == g2) {
				scores[t1]++;
				scores[t2]++;
			} else if (g1 > g2) {
				scores[t1] += 3;
			} else {
				scores[t2] += 3;
			}
			matches[t1]++;
			matches[t2]++;
		}
		int tb = teamMap.get("BERLAND");
		int to = 0;
		for (int i = 0; i < 4; i++)
			if (matches[i] != 3 && i != tb)
				to = i;
		int rx = -1, ry = -1;
		for (int x = 0; x <= 9; x++)
			for (int y = 0; y <= 9; y++) {
				int[] gs = goals.clone();
				int[] ms = misses.clone();
				int[] ss = scores.clone();
				gs[tb] += x;
				ms[to] += x;
				gs[to] += y;
				ms[tb] += y;
				if (x == y) {
					ss[tb]++;
					ss[to]++;
				} else if (x > y)
					ss[tb] += 3;
				else
					ss[to] += 3;
				if (satisfied(gs, ms, ss, teams, tb)) {
					if (rx == -1) {
						rx = x;
						ry = y;
					} else if (x - y < rx - ry) {
						rx = x;
						ry = y;
					} else if (x - y == rx - ry && y < ry) {
						rx = x;
						ry = y;
					}
				}
			}
		if (rx != -1 && ry != -1) {
			System.out.printf("%d:%d\n", rx, ry);
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	private static boolean satisfied(int[] gs, int[] ms, int[] ss, String[] ts,
			int tb) {
		Team[] teams = new Team[4];
		for (int i = 0; i < 4; i++) {
			Team t = new Team();
			t.id = i;
			t.goal = gs[i];
			t.miss = ms[i];
			t.score = ss[i];
			t.name = ts[i];
			teams[i] = t;
		}
		Arrays.sort(teams);
		if (teams[0].name.equalsIgnoreCase(B_TEAM_NAME)
				|| teams[1].name.equalsIgnoreCase(B_TEAM_NAME))
			return true;
		else
			return false;
	}

	static class Team implements Comparable<Team> {
		int goal, miss, score, id;
		String name;

		private int diff() {
			return goal - miss;
		}

		@Override
		public int compareTo(Team other) {
			if (this.score > other.score)
				return -1;
			if (this.score < other.score)
				return 1;
			if (this.diff() > other.diff())
				return -1;
			if (this.diff() < other.diff())
				return 1;
			if (this.goal > other.goal)
				return -1;
			if (this.goal < other.goal)
				return 1;
			return this.name.compareTo(other.name);
		}
	}
}

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class FootballChampionship {
    static class Team implements Comparable<Team> {
        String name;
        int scored, missed, points;

        public Team(String n) {
            name = n;
        }

        @Override
        public int compareTo(Team t2) {
            if (points == t2.points) {
                int ad = scored - missed;
                int bd = t2.scored - t2.missed;
                if (ad == bd)
                    if (scored == t2.scored)
                        return -(t2.name.compareTo(name));
                    else
                        return t2.scored - scored;
                else
                    return bd - ad;

            }
            return t2.points - points;
        }

    }

    public static void main(String[] args) throws Exception {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        HashMap<String, Team> map = new HashMap<String, Team>();
        HashMap<String, Integer> count = new HashMap<String, Integer>();
        for (int i = 0; i < 5; i++) {
            String str = r.readLine();
            str = str.replace(":", " ");
            String[] sp = str.split("[ ]+");
            String a = sp[0];
            String b = sp[1];
            int as = new Integer(sp[2]);
            int bs = new Integer(sp[3]);
            Team t1, t2;
            if (!map.containsKey(a))
                map.put(a, new Team(a));
            if (!map.containsKey(b))
                map.put(b, new Team(b));
            t1 = map.get(a);
            t2 = map.get(b);
            if (as > bs) {
                t1.points += 3;
            } else if (as < bs) {
                t2.points += 3;
            } else {
                t1.points++;
                t2.points++;
            }
            t1.scored += as;
            t2.missed += as;

            t1.missed += bs;
            t2.scored += bs;
            if (!count.containsKey(a))
                count.put(a, 0);
            if (!count.containsKey(b))
                count.put(b, 0);
            int c1 = count.remove(a) + 1, c2 = count.remove(b) + 1;
            count.put(a, c1);
            count.put(b, c2);
        }
        String team2="";
        for (Entry<String, Integer> e : count.entrySet()) {
            if (e.getValue() == 2 && !e.getKey().equals("BERLAND")) {
                team2 = e.getKey();
            }
        }
        Team[] teams = new Team[4];
        Team[] copy = new Team[4];
        int berlandIndex=-1,otherIndex=-1;
        int k = 0;
        for (Entry<String, Team> e : map.entrySet()) {
            teams[k] = e.getValue();
            if(e.getKey().equals("BERLAND"))berlandIndex=k;
            if(e.getKey().equals(team2))otherIndex=k;
            k++;

        }
        for(int dif=1;dif<300;dif++){
        for (int X = 1; X < 300; X++) {
                for (k = 0; k < 4; k++) {
                    copy[k] = new Team(teams[k].name);
                    copy[k].points = teams[k].points;
                    copy[k].scored = teams[k].scored;
                    copy[k].missed = teams[k].missed;
                }
                int Y=X-dif;
                if(X<=Y)continue;
                copy[berlandIndex].points+=3;
                copy[berlandIndex].scored+=X;
                copy[berlandIndex].missed+=Y;

                copy[otherIndex].scored+=Y;
                copy[otherIndex].missed+=X;
                Arrays.sort(copy);
                if(copy[0].name.equals("BERLAND")||copy[1].name.equals("BERLAND")){
                    System.out.println(X+":"+Y);
                    return;
                }
            }
        }
        System.out.println("IMPOSSIBLE");
    }
}

import java.util.*;
public class Main {

    class C implements Comparable<C>{
        String name;
        int score, diff,goal,match;
        public C(String name, int score, int diff, int goal, int match) {
            this.name = name;
            this.score = score;
            this.diff = diff;
            this.goal = goal;
            this.match = match;
        }
        public int compareTo(C o) {
            if(this.score < o.score) return 1;
            if(this.score > o.score) return -1;
            if(this.diff < o.diff) return 1;
            if(this.diff > o.diff) return -1;
            if(this.goal < o.goal) return 1;
            if(this.goal > o.goal) return -1;
            int res = this.name.compareTo(o.name);
            return res;
        }
        @Override
        public String toString() {
            return "C [name=" + name + ", score=" + score + ", diff=" + diff
                    + ", goal=" + goal + ", match=" + match + "]";
        }

    }

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            HashMap<String,Integer>map = new HashMap<String,Integer>();
            C [] data = new C[4];
            for(int i = 0; i < 5;i++){
                String line = sc.nextLine();
                String [] linearr = line.split(" |:");
                int id1 = -1, id2 = -1;
                if(map.containsKey(linearr[0])){
                    id1 = map.get(linearr[0]);
                }
                else{
                    int res = map.size();
                    id1 = res;
                    map.put(linearr[0], res);
                    data[id1] = new C(linearr[0], 0,0,0,0);
                }
                if(map.containsKey(linearr[1])){
                    id2 = map.get(linearr[1]);
                }
                else{
                    int res = map.size();
                    id2 = res;
                    map.put(linearr[1], res);
                    data[id2] = new C(linearr[1], 0,0,0,0);
                }
                //score
                int goal1 = Integer.parseInt(linearr[2]);
                int goal2 = Integer.parseInt(linearr[3]);
                if(goal1 > goal2){
                    data[id1].score += 3;
                }
                else if(goal1 < goal2){
                    data[id2].score += 3;
                }
                else{
                    data[id1].score++;
                    data[id2].score++;
                }
                //diff
                data[id1].diff += goal1 - goal2;
                data[id2].diff += goal2 - goal1;
                //goal
                data[id1].goal += goal1;
                data[id2].goal += goal2;
                //match
                data[id1].match++;
                data[id2].match++;
            }
            Arrays.sort(data);
            //find a myteam
            int myid = -1,op = -1;
            for(int i = 0; i < 4; i++){
                if(data[i].name.equals("BERLAND")){
                    myid = i;
                    break;
                }
            }
            for(int i=0; i < 4; i++){
                if(i == myid) continue;
                if(data[i].match == 2){
                    op = i;
                    break;
                }
            }

            if(myid == 0 || myid == 1){
                System.out.println("1:0");
            }
            else{
                boolean flg = false;
                C [] work = new C[4];
                int ansx = -1, ansy = -1;
                for(int diff = 0; diff < 100; diff++){
                    for(int x = diff; x < 100; x++){
                        for(int i = 0; i < 4; i++){
                            work[i] = new C(data[i].name, 0,0,0,0);
                            work[i].diff = data[i].diff;
                            work[i].goal = data[i].goal;
                            work[i].match = data[i].match;
                            work[i].score = data[i].score;
                        }
                        int y = x - diff;
                        if(diff == 0){
                            work[myid].score += 1;
                            work[op].score += 1;
                        }
                        else{
                            work[myid].score += 3;
                        }
                        work[myid].diff += x - y;
                        work[op].diff += y - x;
                        work[myid].goal += x;
                        work[op].goal += y;
                        Arrays.sort(work);
                        if(work[0].name.equals("BERLAND") || work[1].name.equals("BERLAND")){
                            ansx = x;
                            ansy = y;
                            flg = true;
                            break;
                        }
                    }
                    if(flg)break;
                }
                if(flg){
                    System.out.println(ansx + ":" + ansy);
                }
                else{
                    System.out.println("IMPOSSIBLE");
                }
            }
        }
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Lokesh Khandelwal aka (codeKNIGHT | phantom11)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, Scanner in, PrintWriter out) {
        in.useDelimiter("\n");
        int i,points[]=new int[4],scored[]=new int[4],missed[]=new int[4],j,index=0,num[]=new int[4];
        String tea1,tea2="";
        ArrayList<String> team=new ArrayList<String>();
        for(i=0;i<5;i++)
        {
            String s[]=in.next().split(" ");
            tea1=s[0];
            tea2=s[1];
            if(!team.contains(tea1))
            {
                team.add(tea1);

            }
            index=team.indexOf(tea1);
            scored[index]+=s[2].charAt(0)-48;
            missed[index]+=s[2].charAt(2)-48;
            if(s[2].charAt(0)>s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
            if(!team.contains(tea2))
            {
                team.add(tea2);

            }
            index=team.indexOf(tea2);
            scored[index]+=s[2].charAt(2)-48;
            missed[index]+=s[2].charAt(0)-48;
            if(s[2].charAt(0)<s[2].charAt(2))
                points[index]+=3;
            else if(s[2].charAt(0)==s[2].charAt(2))
                points[index]+=1;
            num[index]+=1;
        }
        table a[]=new table[4];
        for(i=0;i<4;i++)
            a[i]=new table(team.get(i),points[i],scored[i],missed[i]);
        for(i=0;i<4;i++)
        {
            if(num[i]==2&&(team.get(i).equals("BERLAND")==false))
                tea2=team.get(i);

        }
        Arrays.sort(a);
        int index2=0;
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
            out.println("1:0");
            return;
        }
        if(a[1].points-a[index].points>3)
        {
            out.println("IMPOSSIBLE");
            return;
        }
        if(a[1].points-a[index].points<3)
        {
            out.println("1:0");
            return;
        }
        a[index].points+=3;
        Arrays.sort(a);
        for(i=0;i<4;i++)
        {
            if(a[i].tname.equals("BERLAND"))
                index=i;
            if(a[i].tname.equals(tea2))
                index2=i;

        }
        if(index<2)
        {
           out.println("1:0");
            return;
        }
        int k,min=Integer.MAX_VALUE,x=0,y=0;
        for(i=1;i<=50;i++)
        {
            for(j=0;j<i;j++)
            {
                table fin[]=new table[4];
                for(k=0;k<4;k++)
                {
                    if(team.get(k).equals("BERLAND"))
                        fin[k]=new table("BERLAND",points[k]+3,scored[k]+i,missed[k]+j);
                    else if(team.get(k).equals(tea2))
                        fin[k]=new table(tea2,points[k],scored[k]+j,missed[k]+i);
                    else
                        fin[k]=new table(team.get(k),points[k],scored[k],missed[k]);
                }
                Arrays.sort(fin);
                index=0;
                for(k=0;k<4;k++)
                    if(fin[k].tname.equals("BERLAND"))
                        index=k;
                if(index<2)
                {
                    min=Math.min(min,i-j);
                    x=i;
                    y=j;
                }
            }
        }
        out.println(x+":"+y);

	}
    class table implements Comparable<table>
    {
        String tname;
        int points,s,m;
        public table(String tname,int points,int s,int m)
        {
            this.tname=tname;
            this.points=points;
            this.s=s;
            this.m=m;
        }
        public int compareTo(table a)
        {
            if(a.points>this.points)
                return 1;
            else if(a.points<this.points)
                return -1;
            else
            {
                int diff1=a.s-a.m;
                int diff2=this.s-this.m;
                if(diff1>diff2)
                    return 1;
                else if(diff1<diff2) return -1;
                else
                {
                    if(a.s>this.s) return 1;
                    else if(a.s<this.s) return -1;
                    else
                    {
                        return ((a.tname).compareTo(this.tname)<0?1:-1);
                    }
                }
            }
        }
    }
}

import java.io.FileNotFoundException;
import java.util.*;

import static java.lang.System.out;

public class Main {
    private static void debug(Object...os) {
        out.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) throws FileNotFoundException {
        Scanner cin = new Scanner(System.in);
        Map<String, Integer> occurrence = new HashMap<String, Integer>();
        Set<String> names = new HashSet<String>();
        String[] scoreBoard = new String[5];
        for (int i = 0; i < 5; ++i) {
            scoreBoard[i] = cin.nextLine();
            String[] parts = scoreBoard[i].split(" ");
            Integer value = occurrence.get(parts[0]);
            if (value == null)
                occurrence.put(parts[0], 1);
            else
                occurrence.put(parts[0], value + 1);
            value = occurrence.get(parts[1]);
            if (value == null)
                occurrence.put(parts[1], 1);
            else
                occurrence.put(parts[1], value + 1);
            names.add(parts[0]);
            names.add(parts[1]);
        }
        Team[] teams = new Team[names.size()];
        int index = 0;
        for (String name : names) {
            teams[index++] = new Team(name);
        }
        for (int i = 0; i < scoreBoard.length; ++i) {
            String[] parts = scoreBoard[i].split(" ");
            int teamOneIndex = getIndex(teams, parts[0]);
            int teamTwoIndex = getIndex(teams, parts[1]);
            int teamOneGoals = parts[2].charAt(0) - '0';
            int teamTwoGoals = parts[2].charAt(2) - '0';
            teams[teamOneIndex].outGoals += teamOneGoals;
            teams[teamTwoIndex].inMeGoals += teamOneGoals;
            teams[teamOneIndex].inMeGoals += teamTwoGoals;
            teams[teamTwoIndex].outGoals += teamTwoGoals;
            if (teamOneGoals > teamTwoGoals) {
                teams[teamOneIndex].points += 3;
            } else if (teamTwoGoals > teamOneGoals) {
                teams[teamTwoIndex].points += 3;
            } else {
                ++teams[teamOneIndex].points;
                ++teams[teamTwoIndex].points;
            }
        }
        String secondTeamName = "";
        for (Map.Entry<String, Integer> entry : occurrence.entrySet())
            if (!entry.getKey().equals("BERLAND") && entry.getValue() == 2) {
                secondTeamName = entry.getKey();
                break;
            }
        int teamOneIndex = getIndex(teams, "BERLAND");
        int teamTwoIndex = getIndex(teams, secondTeamName);
        int resX = -1;
        int resY = -1;
        long min = Long.MAX_VALUE;
        for (int x = 0; x <= 100; ++x)
            for (int y = x - 1; y >= 0; --y) {
                Team oneTemp = new Team(teams[teamOneIndex].name, teams[teamOneIndex].points, teams[teamOneIndex].outGoals, teams[teamOneIndex].inMeGoals);
                Team twoTemp = new Team(teams[teamTwoIndex].name, teams[teamTwoIndex].points, teams[teamTwoIndex].outGoals, teams[teamTwoIndex].inMeGoals);
                teams[teamOneIndex].outGoals += x;
                teams[teamTwoIndex].inMeGoals += x;
                teams[teamOneIndex].inMeGoals += y;
                teams[teamTwoIndex].outGoals += y;
                teams[teamOneIndex].points += 3;
                Arrays.sort(teams);
                if (teams[0].name.equals("BERLAND") || teams[1].name.equals("BERLAND") && (long) (x - y) < min) {
                    resX = x;
                    resY = y;
                    min = x - y;
                }
                teamOneIndex = getIndex(teams, "BERLAND");
                teamTwoIndex = getIndex(teams, secondTeamName);
                teams[teamOneIndex].name = oneTemp.name;
                teams[teamOneIndex].inMeGoals = oneTemp.inMeGoals;
                teams[teamOneIndex].outGoals = oneTemp.outGoals;
                teams[teamOneIndex].points = oneTemp.points;
                teams[teamTwoIndex].name = twoTemp.name;
                teams[teamTwoIndex].inMeGoals = twoTemp.inMeGoals;
                teams[teamTwoIndex].outGoals = twoTemp.outGoals;
                teams[teamTwoIndex].points = twoTemp.points;
            }
        if (resX == -1)
            out.println("IMPOSSIBLE");
        else
            out.printf("%d:%d\n", resX, resY);
    }

    private static void printTeams(Team[] teams) {
        for (Team team : teams)
            debug(team.name, team.points, team.outGoals, team.inMeGoals, team.outGoals - team.inMeGoals);
    }

    private static int getIndex(Team[] teams, String teamName) {
        for (int i = 0; i < teams.length; ++i)
            if (teams[i].name.equals(teamName))
                return i;
        return -1;
    }

    static class Team implements Comparable<Team> {
        String name;
        int inMeGoals;
        int outGoals;
        int points;

        Team(String name) {
            this.name = name;
            this.inMeGoals = 0;
            this.outGoals = 0;
            this.points = 0;
        }

        Team(String name, int points, int outGoals, int inGoals) {
            this.name = name;
            this.points = points;
            this.outGoals = outGoals;
            this.inMeGoals = inGoals;
        }

        public int compareTo(Team team) {
            if (team.points != points)
                return team.points - points;
            int teamDiff = Math.abs(team.outGoals - team.inMeGoals);
            int thisDiff = Math.abs(outGoals - inMeGoals);
            if (teamDiff != thisDiff)
                return thisDiff - teamDiff;
            if (team.outGoals != outGoals)
                return team.outGoals - outGoals;
            return name.compareTo(team.name);
        }
    }
}

import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//
//	static long sum=0;
	//int a,b,c;
	//1000000007 (10^9+7)
	//static int mod = 1000000007;
   // static int d[][];
	//static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) {

   Scanner sc =new Scanner(System.in);
   while(sc.hasNext()){
		 // =ni(sc)
	   //long sum=0;
		//int  n=sc.nextInt();
  String s[]=new String[5];
  HashMap<String,P> map = new HashMap<String,P>();
	for(int i=0;i<5;i++)s[i]=sc.nextLine();
	ArrayList<String> lis = new ArrayList<String>();

	for(int i=0;i<5;i++){

	  String x[]=s[i].split(" ");
	  int a=x[2].charAt(0)-'0';
	  int b=x[2].charAt(2)-'0';

	  int aa=0,bb=0;

	  if(a<b)bb=3;
	  else if(b<a)aa=3;
	  else if(a==b){a=1;bb=1;}
	if( !lis.contains(x[0]) )lis.add(x[0]);
	if( !lis.contains(x[1]) )lis.add(x[1]);

	 if( !map.containsKey(x[0]))map.put(x[0], new P(x[0],aa,a-b, a ,1) );
	 else {P p=map.get(x[0]);  map.put(x[0], new P(x[0],p.v+aa,p.m+a-b, p.mm+a ,p.t+1) );}

	 if( !map.containsKey(x[1]))map.put(x[1], new P(x[1],bb,b-a, b ,1) );
	 else {P p=map.get(x[1]);  map.put(x[1], new P(x[1],p.v+bb,p.m+b-a,  p.mm+b ,p.t+1) );}

	}

	 PriorityQueue<P> que = new PriorityQueue<P>();
	 String op="";

	for(int i=0;i<4;i++)
	{ String g=lis.get(i); if( map.get(g).t<3 && !g.equals("BERLAND") ){op=g; break;}
	  if(!g.equals("BERLAND"))que.add(map.get(g));
	}

	P bp=map.get("BERLAND"),opp=map.get(op);
	int x=100,y=50;

	//for(int i=0;i<4;i++)
	//{P  p= map.get(lis.get(i)); db(p.na,p.v,p.m,p.t  );}

	for(int i=1;i<10;i++)for(int t=0;t<i;t++){

		que.add( new P("BERLAND" ,bp.v+3,bp.m+i-t, bp.mm+i ,0  ) );
		que.add( new P(op , 0 ,opp.m + t-i, opp.mm+t ,0  ) );

	P r=que.poll(),rr=que.poll();

	//dd(r);
	//dd(rr);
	//while(!que.isEmpty())dd(que.poll());
	//db("");
	 if( r.na.equals("BERLAND") || rr.na.equals("BERLAND") ) {

		 if(x-y > i-t ) { x=i; y=t;  }
		 if(x-y > i-t && y>i){ x=i; y=t; }
		// db(x,y);
	 }

		que.clear();

		for(int u=0;u<4;u++)
		{ String g=lis.get(u); if( !g.equals("BERLAND")&& !g.equals(op))que.add(map.get(g) ) ;
		}

	}

	if(x==100)  System.out.println("IMPOSSIBLE");
	else System.out.println(x+":"+y);

   }

}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static void dd(P p){

	db(p.na,p.v,p.m);

}

}

class P implements Comparable<P>{
    String na;
	int v,m,t,mm;
	P(String na,int v,int m,int mm,int t){
		this.na=na;
	    this.v=v;
	    this.m=m;
	    this.mm=mm;
	    this.t=t;
	}

	   public int compareTo(P x){
		   	if(x.v-v!=0) return x.v-v;
		   	else if( x.m-m!=0 )return x.m-m;
		 	else if( x.mm-mm!=0 )return x.mm-mm;
		   	 return  na.compareTo(x.na)<0 ? 1:-1;
		   }

}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

	static class FastScanner {
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(InputStream InputStream) {
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(InputStream));
		}

		public FastScanner(File f) throws FileNotFoundException {
			st = new StringTokenizer("");
			s = new BufferedReader(new FileReader(f));
		}

		public int nextInt() throws IOException {
			if (st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public BigInteger big() throws IOException {
			if (st.hasMoreTokens())
				return new BigInteger(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return big();
			}
		}

		public double nextDouble() throws IOException {
			if (st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException {
			if (st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else {
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String next() throws IOException {
			if (st.hasMoreTokens())
				return st.nextToken();
			else {
				st = new StringTokenizer(s.readLine());
				return next();
			}

		}

		public String nextLine() throws IOException {
			return s.readLine();
		}

		public void close() throws IOException {
			s.close();
		}

	}

	public static void main(String[] args) throws java.lang.Exception {
		FastScanner in = new FastScanner(System.in);
		HashMap<String, Integer> points = new HashMap();
		HashMap<String, Integer> goals = new HashMap();
		HashMap<String, Integer> diff = new HashMap();
		HashMap<String, Integer> nom = new HashMap();
		for (int x = 0; x < 5; x++) {
			String str1 = in.next();
			String str2 = in.next();
			String str = in.next();
			String arr[] = str.split(":");
			int val1 = Integer.parseInt(arr[0]);
			int val2 = Integer.parseInt(arr[1]);
			if (val1 > val2) {
				points.put(str1, points.getOrDefault(str1, 0) + 3);
				points.put(str2, points.getOrDefault(str2, 0));
			} else if (val2 > val1) {
				points.put(str2, points.getOrDefault(str2, 0) + 3);
				points.put(str1, points.getOrDefault(str1, 0));
			} else {
				points.put(str1, points.getOrDefault(str1, 0) + 1);
				points.put(str2, points.getOrDefault(str2, 0) + 1);
			}
			diff.put(str1, diff.getOrDefault(str1, 0) + val1 - val2);
			diff.put(str2, diff.getOrDefault(str2, 0) + val2 - val1);
			goals.put(str1, goals.getOrDefault(str1, 0) + val1);
			goals.put(str2, goals.getOrDefault(str2, 0) + val2);
			nom.put(str1, nom.getOrDefault(str1, 0) + 1);
			nom.put(str2, nom.getOrDefault(str2, 0) + 1);
		}

		pair[] arr = new pair[4];
		int idx = 0, req = 0;
		for (String st : points.keySet()) {
			arr[idx++] = new pair(points.get(st), st, goals.get(st), diff.get(st));
		}
		Arrays.sort(arr);

		idx = 0;
		String str1 = "BERLAND";
		for (int x = 0; x < 4; x++) {
			if ((arr[x].key).equals(str1)) {
				req = idx;
			}
			idx++;
		}
		if(req < 2) {
			System.out.println("1:0");
			return;
		}
		else if(arr[1].val - arr[req].val > 3) {
			System.out.println("IMPOSSIBLE");
			return;
		}
		String str2 = "";
		int idx2 = 0;
		for(String str : nom.keySet()) {
			if(nom.get(str) == 2 && !str.equals(str1)) {
				str2 = str;
				break;
			}

		}
		for(int x = 0; x < 4; x++) {
			if(arr[x].key.equals(str2)) {
				idx2 = x;
				break;
			}
		}
		String ans = "";
		for(int x = 1; x < 29; x++) {
			boolean flag = false;
			for(int y = 0; y < x; y++) {
				arr[req].dif += x - y;
				arr[req].val += 3;
				arr[req].goals += x - y;
				arr[idx2].dif += y - x;
				arr[idx2].goals += y - x;
				pair[] arr1 = arr.clone();
				Arrays.sort(arr1);
				arr[req].dif -= (x - y);
				arr[req].val -= 3;
				arr[req].goals -= (x - y);
				arr[idx2].dif -= (y - x);
				arr[idx2].goals -= (y -x);
				if(arr1[1].key.equals(str1) || arr1[0].key.equals(str1)) {
					flag = true;
					ans = x+":"+y;
				}
				else {
					break;
				}

			}
			if(flag) break;
		}
		System.out.println(ans);
	}

	static class pair implements Comparable<pair> {
		int val;
		int goals;
		int dif;
		String key;

		pair(int val, String key, int points, int dif) {
			this.val = val;
			this.key = key;
			this.goals = points;
			this.dif = dif;
		}

		public int compareTo(pair obj) {
			if (obj.val == val) {
				if (obj.dif == dif) {
					return obj.goals - goals;
				} else
					return obj.dif - dif;
			}
			return obj.val - this.val;
		}
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		long time_beg = -1;
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		if (args.length > 0 && args[0].equals("outside")) {
			time_beg = System.currentTimeMillis();
			try {
				inputStream = new FileInputStream("io/in.txt");
//				outputStream = new FileOutputStream("io/out.txt");
			} catch (Exception e) {
				System.err.println(e);
				System.exit(1);
			}
		} else {
//			try {
//				inputStream = new FileInputStream("file_name");
//				outputStream = new FileOutputStream("file_name");
//			} catch (Exception e) {
//				System.err.println(e);
//				System.exit(1);
//			}
		}
		Solver s = new Solver();
		s.in = new InputReader(inputStream);
		s.out = new OutputWriter(outputStream);
		s.solve();
		s.out.close();
		if (args.length > 0 && args[0].equals("outside")) {
			System.err.printf("*** Total time: %.3f ***\n", (System.currentTimeMillis() - time_beg) / 1000.0);
		}
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printLine(Object... objects) {
		print(objects);
		writer.println();
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object... objects) {
		writer.printf(format, objects);
	}

	public void close() {
		writer.close();
	}

	public void flush() {
		writer.flush();
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public static boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c == 'e' || c == 'E')
				return res * Math.pow(10, readInt());
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}
}

class Solver {
	InputReader in;
	OutputWriter out;

	void solve() {
		HashMap<String, Integer> M = new HashMap<>();
		String[] MR = new String[4];
		int count = 0;
		int[][] mas = new int[4][4];
		for (int j = 0; j < 4; ++j)
			for (int i = 0; i < 4; ++i)
				mas[j][i] = -1;
		for (int i = 0; i < 5; ++i) {
			String s = in.readLine();
			s = s.replace(':', ' ');
			String[] temp = s.split(" ");
			if (!M.containsKey(temp[0])) {
				MR[count] = temp[0];
				M.put(temp[0], count++);
			}
			if (!M.containsKey(temp[1])) {
				MR[count] = temp[1];
				M.put(temp[1], count++);
			}
			mas[M.get(temp[0])][M.get(temp[1])] = Integer.parseInt(temp[2]);
			mas[M.get(temp[1])][M.get(temp[0])] = Integer.parseInt(temp[3]);
		}
		int me = M.get("BERLAND");
		int he;
		for (he = 0; he < 4; ++he)
			if (he != me) {
				boolean flag = false;
				for (int i = 0; i < 4; ++i)
					if (he != i && mas[he][i] == -1) {
						flag = true;
						break;
					}
				if (flag) break;
			}
		int a = -1, b = -1;
		for (int x = 1; x < 100; ++x)
			for (int y = x - 1; y >= 0; --y) {
				mas[me][he] = x;
				mas[he][me] = y;
				int[] P = new int[4];
				int[] miss = new int[4];
				int[] hit = new int[4];
				for (int j = 0; j < 4; ++j)
					for (int i = 0; i < 4; ++i)
						if (j != i) {
							if (mas[j][i] > mas[i][j]) P[j] += 3;
							if (mas[j][i] == mas[i][j]) P[j] += 1;
							hit[j] += mas[j][i];
							miss[j] += mas[i][j];
						}
				ArrayList<Pair<Pair<Integer, Integer>, Pair<Integer, String>>> A = new ArrayList<>();
				for (int i = 0; i < 4; ++i)
					A.add(new Pair<Pair<Integer, Integer>, Pair<Integer, String>>(
							new Pair<Integer, Integer>(-P[i], -hit[i] + miss[i]),
							new Pair<Integer, String>(-hit[i], MR[i])));
				Collections.sort(A);
				if (A.get(0).second.second == MR[me] || A.get(1).second.second == MR[me]) {
					if (a - b > x - y || (a - b == x - y && b > y)) {
						a = x;
						b = y;
					}
				}
			}
		if (a != -1) out.printFormat("%d:%d\n", a, b);
		else out.printLine("IMPOSSIBLE");
	}
}

class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
	U first;
	V second;

	Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair<U, V> o) {
		int value = first.compareTo(o.first);
		if (value != 0) return value;
		return second.compareTo(o.second);
	}

	@Override
	public String toString() {
		return "(" + first + ", " + second + ")";
	}
}