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 PYTHON):

Solution:
import sys

def compare_figures(first, second):
    #print 'Compare_figures called. First: {0}, second: {1}'.format(first, second)
    return \
        first == '[]' and second == '8<' or \
        first == '()' and second == '[]' or \
        first == '8<' and second == '()'

class Figure(object):
    def __init__(self, word):
        if not word in ['8<', '[]', '()']:
            raise RuntimeError('Wrong word')
        self.word = word

    def __lt__(self, other):
        return compare_figures(self.word, other.word)
    
    def __eq__(self, other):
        return self.word == other.word

    def __repr__(self):
        return {'8<' : 'Scissors', '[]' : 'Paper', '()' : 'Stone'}[self.word]


def test_compare():
    scissors = Figure('8<')
    paper = Figure('[]')
    paper2 = Figure('[]')
    stone = Figure('()')
    print (paper < stone)
    print (stone < paper)
    print (paper < paper)
    print (paper == paper2)
    #print party_score(paper, scissors)

def party_score(first, second):
    if (first == second):
        return 0
    if (first > second):
        return 1
    return -1

def parse_game(line):
    return [Figure(line[2*i :2*i+2]) for i in xrange(len(line) / 2)]

def main():
    first = sys.stdin.readline().strip()
    second = sys.stdin.readline().strip()
    first = parse_game(first)
    second = parse_game(second)
    parties = zip(first, second)
    results = [party_score(left, right) for (left, right) in zip(first, second)]
    #print results
    #print sum(results)
    result = sum(results)
    if (result < 0):
        print "TEAM 2 WINS"
    elif (result > 0):
        print "TEAM 1 WINS"
    else:
        print "TIE"

if __name__ == "__main__":
    main()