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.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;



public class solver {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;
    
    String readString() throws IOException{
        while (tok==null || !tok.hasMoreTokens()){
            try{
                tok=new StringTokenizer(in.readLine());             
            }
            catch(Exception e){
                return null;
            }            
        }
        return tok.nextToken();
    }
    int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(readString());
    }
    long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(readString());
    }
    double readDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(readString());
    }
    
    final static boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;
    
    
    void init() throws FileNotFoundException{        
        if (OJ){
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);  
        }else{
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);  
        }
    }    
    int[] iMas(int n) throws NumberFormatException, IOException{
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=readInt();
        }
        return a;
    }
    
    
    int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }    
       
    
    
    
    int compare(char a1,char a2,char b1,char b2){
        if (a1==b1 && a2==b2) return 0;
        if ((a1=='8' || a2=='8') && b1=='[') return 1;
        if ((b1=='8' || b2=='8') && a1=='[') return -1;
        
        if (a1=='(' && (b1=='8' || b2=='8')) return 1;
        if (b1=='(' && (a1=='8' || a2=='8')) return -1;
        
        if (a1=='[' && b1=='(') return 1;
        if (a1=='(' && b1=='[') return -1;
        
        return 0;
        
    }
    
    
    
        
    void solve() throws IOException{
        char[] a1=readString().toCharArray();
        char[] a2=readString().toCharArray();
        int res=0;
        for (int i=0;i<a1.length;i+=2){
             res+=compare(a1[i], a1[i+1], a2[i], a2[i+1]);  
        }
        if (res>0) {
            out.println("TEAM 1 WINS");
            return;
        }
        if (res<0) {
            out.println("TEAM 2 WINS");
            return;
        }
        out.println("TIE");
        
        
                
        
        
        
            
          
    }
    
    
    void run() throws NumberFormatException, IOException{
        init();
        // long h=System.currentTimeMillis();        
        solve();
        // System.err.println(System.currentTimeMillis()-h);
        out.close();
    }
    
    
    

    
    public static void main(String[] args) throws NumberFormatException, IOException {
        new solver().run();
    }

}