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.IOException;

public class A {

	private static final int IN_BUFFER_SIZE = 1 << 16;
	private static final int OUT_BUFFER_SIZE = 1 << 16;
	private byte[] input = new byte[IN_BUFFER_SIZE];
	private int ix = IN_BUFFER_SIZE;
	private int bytesRead = ix;
	private byte[] output = new byte[OUT_BUFFER_SIZE];
	private int ox = 0;

	private void readMore() {
		try {
			bytesRead = System.in.read(input, 0, IN_BUFFER_SIZE);
			if (bytesRead <= 0)
				throw new RuntimeException();
			ix = 0;
		} catch (IOException e) {
			throw new RuntimeException();
		}
	}

	private void flushOut() {
		System.out.write(output, 0, ox);
		ox = 0;
	}

	private void append(String s) {
		char[] ca = s.toCharArray();
		for (int i = 0; i < ca.length; i++) {
			append(ca[i]);
		}
	}

	private void append(char c) {
		if (ox == OUT_BUFFER_SIZE)
			flushOut();
		output[ox++] = (byte) c;
	}

	private String nextString() {
		try {
			skipSpaces();
		} catch (RuntimeException e) {
			return null;
		}
		StringBuilder sb = new StringBuilder();
		while (true) {
			if (ix == bytesRead) {
				try {
					readMore();
				} catch (RuntimeException e) {
					return sb.toString();
				}
			}
			if (input[ix] <= ' ')
				break;
			sb.append((char) input[ix++]);
		}
		return sb.toString();
	}

	int cntSize;

	private void skipSpaces() {
		while (true) {
			if (ix == bytesRead) {
				readMore();
			}
			if (input[ix] > ' ')
				break;
			ix++;
		}
	}

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

	private void work() {
		char[] a = nextString().toCharArray();
		char[] b = nextString().toCharArray();
		int[] score = new int[2];
		for (int i = 0; i < a.length; i += 2) {
			if (a[i] == b[i])
				continue;
			if (a[i] == '8') {
				if (b[i] == '[')
					score[0]++;
				else
					score[1]++;
			} else if (a[i] == '[') {
				if (b[i] == '(')
					score[0]++;
				else
					score[1]++;
			} else {
				if (b[i] == '8')
					score[0]++;
				else
					score[1]++;
			}
		}
		if (score[0] == score[1]) {
			append("TIE\n");
		} else {
			append("TEAM ");
			append(score[0] > score[1] ? '1' : '2');
			append(" WINS\n");
		}
		if (ox > 0)
			flushOut();
		System.out.close();
	}
}