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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C12 {

	public C12() 
	{
		Scanner s = new Scanner();
		PrintStream p = System.out;
		
		String s1 = s.next();
		String s2 = s.next();
		
		String r = "";
		
		int t1 = 0;
		int t2  = 0;
		for (int i = 0; i < s1.length(); i+=2)
		{
			char c1 = s1.charAt(i);
			char c2 = s2.charAt(i);
			
			if (c1 == '8')
			{
				if (c2 == '[')
					t1++;
				else if (c2 == '(')
					t2++;
			}
			else if (c1 == '[')
			{
				if (c2 == '8')
					t2++;
				else if (c2 == '(')
					t1++;
			}
			else if (c1 == '(')
			{
				if (c2 == '8')
					t1++;
				else if (c2 == '[')
					t2++;
			}
			
			
				
		}
		if (t2 > t1)
			System.out.println("TEAM 2 WINS");
		else if (t2 == t1)
			System.out.println("TIE");
		else
			System.out.println("TEAM 1 WINS");
	}
	
	
	
	
	
	
	public static void main(String[] args) {
		new C12();
	}

	public static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(Reader in) {
			br = new BufferedReader(in);
		}

		public Scanner() {
			this(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		// Slightly different from java.util.Scanner.nextLine(),
		// which returns any remaining characters in current line,
		// if any.
		String readNextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		public int[] readNextLineInts(int numberOfInts) {
			int[] ints = new int[numberOfInts];
			for (int i = 0; i < numberOfInts; i++)
				ints[i] = nextInt();
			return ints;
		}
		
		public double[] readNextLineDoubles(int numberOfDoubles) {
			double[] doubles = new double[numberOfDoubles];
			for (int i = 0; i < numberOfDoubles; i++)
				doubles[i] = nextDouble();
			return doubles;
		}
		// --------------------------------------------------------
	}

	
	public boolean isPrime(int n)
	{
		for (int i = 2; i <= Math.sqrt(n);i++)
		{
			if (n % i == 0)
			{
				return false;
			}
		}
		return true;
	}
	
	/**
	 * Precondition: n is at least 0
	 * Note: it is many times more efficient to use isPrime(int n)
	 * for a single or a few numbers. This method is just for a large number of
	 * primes and is more efficient at exactly what it does.
	 * 
	 * It utilizes all previous primes to calculate all the next few primes. 
	 * Suprisingly, isPrime is not called here due to the difference.
	 * 
	 * @param n The number of primes you want. 
	 * If n=0, an empty array is returned
	 * @return  An array of the first n primes
	 */
	public ArrayList<Integer> firstNPrimes(int n)
	{
		ArrayList<Integer> primes = new ArrayList<Integer>();
		
		int numToTest = 2;
		
		while (primes.size() < n)
		{
			boolean prime = true;
			for (int i = 0; i < primes.size() && primes.get(i) <= Math.sqrt(numToTest); i++)
			{
				if (numToTest % primes.get(i) == 0)
					prime = false;
			}
			if (prime)
			{
				primes.add(numToTest);
				System.out.println(numToTest);
			}
			numToTest++;
		}
		return primes;
	}
	
	public class Loc implements Comparable<Loc>, Cloneable
	{
		public int x, y;
		public Loc(int x, int y)
		{
			this.x = x;
			this.y = y;
		}
		
		public int compareTo(Loc other) {
			return this.x - other.x;
		}
		
		public boolean equals(Object other)
		{
			return other instanceof Loc && ((Loc)other).x == this.x
					&& ((Loc)other).y == this.y;
		}
		
		public Loc clone()
		{
			return new Loc(this.x, this.y);
		}
		
		public String toString()
		{
			return x + " " + y;
		}
	}
	
	
//	public int[] largestIncreasingSubSequence()
//	{
//		
//	}
	
	
	/**
	 * ArrayList is NOT modified
	 * @param ints
	 * @return
	 */
	public ArrayList<Integer> firstIncreasingSequence(ArrayList<Integer> ints)
	{
		ArrayList<Integer> toReturn = new ArrayList<Integer>();
		if (ints.size() == 0)
			return toReturn;
		toReturn.add(ints.get(0));
		for (int i = 1; i < ints.size(); i++)
			if (ints.get(i) > ints.get(i - 1))
				toReturn.add(ints.get(i));
			else
				break;
		return toReturn;
	}
	
	
	/**
	 * ArrayList is NOT modified
	 * @param ints
	 * @return
	 */
	public ArrayList<Integer> lastDecreasingSequence(ArrayList<Integer> ints)
	{
		ArrayList<Integer> toReturn = new ArrayList<Integer>();
		if (ints.size() == 0)
			return toReturn;
		toReturn.add(0, ints.get(ints.size() - 1));
		for (int i = ints.size() - 2; i >= 0; i--)
		{
			if (ints.get(i) > ints.get(i + 1))
			{	
				toReturn.add(0, ints.get(i));
			}
			else
				break;
		}
		return toReturn;
	}
	
	/**
	 * ArrayList is NOT modified
	 * @param ints
	 * @return
	 */
	public ArrayList<Integer> firstIncreasingOrEqualSequence(ArrayList<Integer> ints)
	{
		ArrayList<Integer> toReturn = new ArrayList<Integer>();
		if (ints.size() == 0)
			return toReturn;
		toReturn.add(ints.get(0));
		for (int i = 1; i < ints.size(); i++)
			if (ints.get(i) >= ints.get(i - 1))
				toReturn.add(ints.get(i));
			else
				break;
		return toReturn;
	}
	
	public ArrayList<Integer> lastDecreasingOrEqualSequence(ArrayList<Integer> ints)
	{
		ArrayList<Integer> toReturn = new ArrayList<Integer>();
		if (ints.size() == 0)
			return toReturn;
		toReturn.add(0, ints.get(ints.size() - 1));
		for (int i = ints.size() - 2; i >= 0; i--)
		{
			if (ints.get(i) >= ints.get(i + 1))
			{	
				toReturn.add(0, ints.get(i));
			}
			else
				break;
		}
		return toReturn;
	}
}