Problem: Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion.

Input

The input contains two strings of equal length (between 2 and 20 characters, inclusive). Each line describes the actions of one team.

Output

Output "TEAM 1 WINS" if the first team won, "TEAM 2 WINS" if the second team won, and "TIE" if there was a tie.

Examples

Input

[]()[]8&lt;
8&lt;[]()8&lt;


Output

TEAM 2 WINS


Input

8&lt;8&lt;()
[]8&lt;[]


Output

TIE

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
public class Main {
	static BufferedReader br; 
	static FileInputStream fis;
	static InputStreamReader isr;
	static FileWriter fw;

	public static void main(String[] args) throws IOException{
		//fis = new FileInputStream("input.txt");
		//isr = new InputStreamReader(fis);
		isr = new InputStreamReader(System.in);
		br = new BufferedReader(isr);       
		//File file = new File("output.txt");
		//fw = new FileWriter(file);
		solve();
		//fis.close();
		isr.close();
		br.close();
		//fw.close();
		return;
	}

	// the followings are methods to take care of inputs.
	static int nextInt(){
		return Integer.parseInt(nextLine());
	}
	static long nextLong(){
		return Long.parseLong(nextLine());
	}
	static int[] nextIntArray(){
		String[] inp = nextLine().split("\\s+");
		int[] ary = new int[inp.length];
		for (int i = 0; i < ary.length; i++){
			ary[i] = Integer.parseInt(inp[i]);
		}
		return ary;
	}
	static int[] nextIntArrayFrom1(){
		String[] inp = nextLine().split("\\s+");
		int[] ary = new int[inp.length + 1];
		for (int i = 0; i < inp.length; i++){
			ary[i+1] = Integer.parseInt(inp[i]);
		}
		return ary;
	}
	static long[] nextLongArray(){
		String[] inp = nextLine().split("\\s+");
		long[] ary = new long[inp.length];
		for (int i = 0; i < inp.length; i++){
			ary[i] = Long.parseLong(inp[i]);
		}
		return ary;
	}
	static long[] nextLongArrayFrom1(){
		String[] inp = nextLine().split("\\s+");
		long[] ary = new long[inp.length + 1];
		for (int i = 0; i < inp.length; i++){
			ary[i+1] = Long.parseLong(inp[i]);
		}
		return ary;
	}
	static String nextLine(){
		try { 
			return br.readLine().trim();
		} catch (Exception e){}
		return null;
	}
	static void write(String str){
		try{
			fw.write(str);
		}catch (Exception e){
			System.out.println(e);
		}
		return;
	}
	static void solve(){
		String team1 = nextLine();
		String team2 = nextLine();
		int count=0;
		for(int i=0;i<team1.length();i+=2){
			char ch1 = team1.charAt(i);
			char ch2 = team2.charAt(i);
			if(((check(ch1)+2) % 3) == check(ch2)){
				count--;
			}
			else if(((check(ch1)+1) % 3) == check(ch2)){
				count++;
			}
			//System.out.println("count:" + count);
		}
		if(count > 0){
			System.out.println("TEAM 1 WINS");
			return;
		}
		else if(count < 0){
			System.out.println("TEAM 2 WINS");
			return;
		}
		else if(count == 0){
			System.out.println("TIE");
		}
		return;
	}
	static int check(char act){
		if(act == '('){
			return 0;
		}
		if(act == '8'){
			return 1;
		}
		if(act == '['){
			return 2;
		}
		return -1;
	}
}