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 PrA implements Runnable {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    void solve() throws IOException {
        String s = nextToken();
        int[] a = new int[10];
        int l = s.length() / 2;
        for (int i = 0; i < l; i++) {
            if (s.charAt(i * 2) == '[')
                a[i] = 1;
            if (s.charAt(i * 2) == '(')
                a[i] = 2;
            if (s.charAt(i * 2) == '8')
                a[i] = 3;
        }
        s = nextToken();
        int[] b = new int[10];
        for (int i = 0; i < l; i++) {
            if (s.charAt(i * 2) == '[')
                b[i] = 1;
            if (s.charAt(i * 2) == '(')
                b[i] = 2;
            if (s.charAt(i * 2) == '8')
                b[i] = 3;
        }
        int ans = 0;
        for (int i = 0; i < l; i++) {
            if (a[i] == 1 && b[i] == 3 || a[i] == 2 && b[i] == 1 || a[i] == 3 && b[i] == 2)
                ans++;
            else if (b[i] == 1 && a[i] == 3 || b[i] == 2 && a[i] == 1 || b[i] == 3 && a[i] == 2)
                ans--;
        }
        if (ans > 0)
            out.println("TEAM 2 WINS");
        else if (ans < 0)
            out.println("TEAM 1 WINS");
        else
            out.println("TIE");
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
        }
    }

    public static void main(String[] args) {
        new Thread(new PrA()).start();
    }
}