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

public class Tasker1 {

    PrintWriter out;
    BufferedReader input;

    Tasker1() {
        try {
            input = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(new FileWriter("output.txt"), true);
            solver();
        } catch (IOException ex) {
            input = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out,true);
            try {
                solver();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } finally {
            try {
                input.close();
            } catch (IOException e) {

            }
            out.close();
        }
    }

    StringTokenizer st = new StringTokenizer("");

    private String nextToken() throws IOException {
        while (!st.hasMoreElements()) {
            st = new StringTokenizer(input.readLine());
        }
        return st.nextToken();
    }

    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.valueOf(nextToken());
    }

    public void solver() throws IOException {
        String str1 = input.readLine();
        String str2 = input.readLine();
        int win = 0;
        int max = Math.max(str1.length(), str2.length());
        for (int i = 0; i < max; i+=2) {
            
            if (str1.charAt(i) == '8' && str2.charAt(i) == '8') {} 
            else if (str1.charAt(i) == '[' && str2.charAt(i) == '[') {}
            else if (str1.charAt(i) == '(' && str2.charAt(i) == '(') {}
            else {
                    if (str1.charAt(i) == '8' && str2.charAt(i) == '[') { 
                        win++;
                    } else if (str2.charAt(i) == '8' && str1.charAt(i) == '[') {
                        win--;
                    } else if (str1.charAt(i) == '8'  && str2.charAt(i) == '(') {
                        win--;
                    } else if (str2.charAt(i) == '8'  && str1.charAt(i) == '(') {
                        win++;
                    } else if (str1.charAt(i) == '['  && str2.charAt(i) == '(') {
                        win++;
                    } else if (str2.charAt(i) == '['  && str1.charAt(i) == '(') {
                        win--;
                    } 
            }
        }
        if (win == 0) {
            System.out.println("TIE");
        } else if (win < 0) {
            System.out.println("TEAM 2 WINS");
        } else
            System.out.println("TEAM 1 WINS");
    }
    
    public static void main(String[] args) {
        new Tasker1();
    }

}