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.*;
import java.util.StringTokenizer;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
    private static BufferedReader br;
    private static StringTokenizer st;
    private static PrintWriter pw;

    static String rock = "()";
    static String paper = "[]";
    static String scissor = "8<";

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        // () : rock
        // [] : paper
        // 8< : scissor

        String me = nextToken();
        String you = nextToken();
        int p1 = 0;
        int p2 = 0;

        for (int i = 0; i < me.length(); i += 2) {
            String t1 = me.substring(i, i + 2);
            String t2 = you.substring(i, i + 2);

            if (isWin(t1, t2)) p1++;
            if (isWin(t2, t1)) p2++;
//            System.out.printf("%d, %d\n", p1, p2);
        }

        if (p1 > p2) {
            pw.println("TEAM 1 WINS");
        } else if (p2 > p1) {
            pw.println("TEAM 2 WINS");
        } else {
            pw.println("TIE");
        }
        pw.close();
    }

    static boolean isWin(String me, String you) {
        if (me.equals(rock)) return you.equals(scissor);
        else if (me.equals(scissor)) return you.equals(paper);
        else return you.equals(rock);
    }

    private static int sum(String str) {
        int res = 0;
        for (int i = 0; i < str.length(); i++)
            res += str.charAt(i);
        return res;
    }

    private static void exitImmediately() {
        pw.close();
        System.exit(0);
    }

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

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

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

    private static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
//            if (!br.ready()) {
//                exitImmediately();
//            }
            st = new StringTokenizer(br.readLine().trim());
        }
        return st.nextToken();
    }
}