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

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
class InputHandlerObject(object):
	inputs = []

	def getInput(self, n=0):
		res = ''
		inputs = self.inputs
		if not inputs:
			inputs.extend(input().split(' '))
		if n == 0:
			res = inputs[:]
			inputs[:] = []
		while n > len(inputs):
			inputs.extend(input().split(' '))
		if n > 0:
			res = inputs[:n]
			inputs[:n] = []
		return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput
plays = ['()', '[]', '8<']
x = input()
y = input()
w = 0
for i in range(0, len(x) // 2):
	m = plays.index(x[2 * i:2 * i + 2])
	n = plays.index(y[2 * i:2 * i + 2])
	if m == n + 1 or m == n - 2:
		w += 1
	if m == n + 2 or m == n - 1:
		w -= 1
if w > 0:
	print('TEAM 1 WINS')
if w == 0:
	print('TIE')
if w < 0:
	print('TEAM 2 WINS')


cnt = 0
t1 = input()
t2 = input()
for i in range(0, len(t1), 2):
	p1 = t1[i:i + 2]
	p2 = t2[i:i + 2]
	if p1 == '8<':
		if p2 == '[]':
			cnt += 1
		elif p2 == '()':
			cnt -= 1
	elif p1 == '[]':
		if p2 == '()':
			cnt += 1
		elif p2 == '8<':
			cnt -= 1
	elif p2 == '8<':
		cnt += 1
	elif p2 == '[]':
		cnt -= 1
if cnt == 0:
	print('TIE')
elif cnt > 0:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
s = si()
t = si()
c = d = 0
for i in range(0, len(s) - 1, 2):
	if s[i] == '8':
		if t[i] == '[':
			c += 1
		elif t[i] == '(':
			d += 1
	elif s[i] == '(':
		if t[i] == '8':
			c += 1
		elif t[i] == '[':
			d += 1
	elif t[i] == '(':
		c += 1
	elif t[i] == '8':
		d += 1
if c > d:
	print('TEAM 1 WINS')
elif d > c:
	print('TEAM 2 WINS')
else:
	print('TIE')


a = input()
b = input()
pa = 0
pb = 0
wins = {'8': '[', '[': '(', '(': '8'}
for i in range(int(len(a) / 2)):
	if b[2 * i] == wins[a[2 * i]]:
		pa += 1
	elif a[2 * i] != b[2 * i]:
		pb += 1
if pa > pb:
	print('TEAM 1 WINS')
elif pa < pb:
	print('TEAM 2 WINS')
else:
	print('TIE')


s1 = input()
s2 = input()
n = len(s1)
bal = 0
for i in range(0, n, 2):
	if s1[i] == '8' and s2[i] == '[':
		bal += 1
	if s1[i] == '8' and s2[i] == '(':
		bal -= 1
	if s1[i] == '(' and s2[i] == '[':
		bal -= 1
	if s1[i] == '(' and s2[i] == '8':
		bal += 1
	if s1[i] == '[' and s2[i] == '(':
		bal += 1
	if s1[i] == '[' and s2[i] == '8':
		bal -= 1
if bal == 0:
	print('TIE')
elif bal > 0:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


a = input()
b = input()
a = [a[i:i + 2] for i in range(0, len(a), 2)]
b = [b[i:i + 2] for i in range(0, len(b), 2)]

def win(x, y):
	if x == '8<':
		return y == '[]'
	if x == '[]':
		return y == '()'
	if x == '()':
		return y == '8<'
	return False
ac = sum((win(x, y) for (x, y) in zip(a, b)))
bc = sum((win(x, y) for (x, y) in zip(b, a)))
if ac == bc:
	print('TIE')
elif ac > bc:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


team1 = input()
score1 = 0
team2 = input()
score2 = 0
for i in range(len(team1)):
	if team1[i] == '[' and team2[i] == '8':
		score2 += 1
	if team1[i] == '[' and team2[i] == '(':
		score1 += 1
	if team1[i] == '8' and team2[i] == '[':
		score1 += 1
	if team1[i] == '8' and team2[i] == '(':
		score2 += 1
	if team1[i] == '(' and team2[i] == '8':
		score1 += 1
	if team1[i] == '(' and team2[i] == '[':
		score2 += 1
if score1 > score2:
	print('TEAM 1 WINS')
elif score2 > score1:
	print('TEAM 2 WINS')
else:
	print('TIE')


bot = True
t = 0
(a, b, c) = (input(), input(), '8([')
for i in range(0, len(a), 2):
	k = c.index(a[i])
	t += 1 if b[i] == c[k - 1] else 0 if b[i] == c[k] else -1
print('TEAM %d WINS' % (1 if t > 0 else 2) if t else 'TIE')


import sys

def solve():
	first = input()
	second = input()
	res = 0
	for i in range(0, len(first), 2):
		res += helper(first[i:i + 2], second[i:i + 2])
	return 'TIE' if res == 0 else 'TEAM 1 WINS' if res > 0 else 'TEAM 2 WINS'

def helper(f, s):
	if f == s:
		return 0
	if f == '[]':
		if s == '()':
			return 1
		return -1
	if f == '()':
		if s == '[]':
			return -1
		return 1
	if s == '[]':
		return 1
	return -1
if sys.hexversion == 50594544:
	sys.stdin = open('test.txt')
print(solve())


D = {'8<': '[]', '[]': '()', '()': '8<'}
cnt = 0
(s1, s2) = (input(), input())
for i in range(0, len(s1), 2):
	(t1, t2) = (s1[i:i + 2], s2[i:i + 2])
	if D[t1] == t2:
		cnt += 1
	elif D[t2] == t1:
		cnt -= 1
if cnt > 0:
	print('TEAM 1 WINS')
elif cnt < 0:
	print('TEAM 2 WINS')
else:
	print('TIE')


team1 = input().replace('[', '7').replace('(', '6')
team2 = input().replace('[', '7').replace('(', '6')
s = 0
for i in range(0, len(team1), 2):
	if team1[i] > team2[i]:
		s += 1
	elif team1[i] < team2[i]:
		s -= 1
	if team1[i] == '8' and team2[i] == '6':
		s -= 2
	if team1[i] == '6' and team2[i] == '8':
		s += 2
if s > 0:
	print('TEAM 1 WINS')
elif s < 0:
	print('TEAM 2 WINS')
else:
	print('TIE')


s1 = input()
s2 = input()
win = {'()': '8<', '[]': '()', '8<': '[]'}
score = [0, 0]
n = len(s1)
for i in range(0, n, 2):
	a = s1[i:i + 2]
	b = s2[i:i + 2]
	if a == b:
		continue
	if win[a] == b:
		score[0] += 1
	else:
		score[1] += 1
if score[0] == score[1]:
	print('TIE')
elif score[0] > score[1]:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


a = input()
b = input()
ans = chk = 0
for i in range(1, len(a), 2):
	(o, t) = (a[i - 1] + a[i], b[i - 1] + b[i])
	if o == '8<' and t == '[]' or (o == '[]' and t == '()') or (o == '()' and t == '8<'):
		ans += 1
	elif t != o:
		chk += 1
print('TEAM 2 WINS' if chk > ans else 'TEAM 1 WINS' if ans > chk else 'TIE')


s1 = input()
s2 = input()
num1 = 0
num2 = 0
for i in range(0, len(s1), 2):
	c1 = s1[i:i + 2]
	c2 = s2[i:i + 2]
	if c1 != c2:
		if c1 == '8<' and c2 == '[]':
			num1 += 1
		elif c1 == '()' and c2 == '8<':
			num1 += 1
		elif c1 == '[]' and c2 == '()':
			num1 += 1
		else:
			num2 += 1
if num1 == num2:
	print('TIE')
else:
	print('TEAM {} WINS'.format(int(num2 > num1) + 1))


from math import *

def winner(a, b):
	if a == '[]':
		if b == '()':
			return 1
		elif b == '[]':
			return 0
		else:
			return -1
	elif a == '8<':
		if b == '()':
			return -1
		elif b == '[]':
			return 1
		else:
			return 0
	elif b == '()':
		return 0
	elif b == '[]':
		return -1
	else:
		return 1
s1 = input()
s2 = input()
i = 0
ans = 0
while i < len(s1):
	ans += winner(s1[i:i + 2], s2[i:i + 2])
	i += 2
if ans == 0:
	print('TIE')
elif ans < 0:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


s1 = input()
s2 = input()
sum1 = 0
sum2 = 0
for i in range(len(s1) // 2):
	if s1[2 * i] == '8':
		if s2[2 * i] == '[':
			sum1 += 1
		elif s2[2 * i] == '(':
			sum2 += 1
	elif s1[2 * i] == '(':
		if s2[2 * i] == '[':
			sum2 += 1
		elif s2[2 * i] == '8':
			sum1 += 1
	elif s2[2 * i] == '(':
		sum1 += 1
	elif s2[2 * i] == '8':
		sum2 += 1
if sum1 > sum2:
	print('TEAM 1 WINS')
elif sum2 > sum1:
	print('TEAM 2 WINS')
else:
	print('TIE')


s = input()
t = input()
a = 0
b = 0
for i in range(0, len(s), 2):
	if s[i:i + 2] == '[]' and t[i:i + 2] == '()':
		a += 1
	if s[i:i + 2] == '()' and t[i:i + 2] == '8<':
		a += 1
	if s[i:i + 2] == '8<' and t[i:i + 2] == '[]':
		a += 1
	if t[i:i + 2] == '[]' and s[i:i + 2] == '()':
		b += 1
	if t[i:i + 2] == '()' and s[i:i + 2] == '8<':
		b += 1
	if t[i:i + 2] == '8<' and s[i:i + 2] == '[]':
		b += 1
if a > b:
	print('TEAM 1 WINS')
elif a < b:
	print('TEAM 2 WINS')
else:
	print('TIE')


items = ['()', '[]', '8<']

def translate(s):
	n = len(s)
	ans = []
	for i in range(0, n, 2):
		ans.append(items.index(s[i:i + 2]))
	return ans

def cmp(x, y):
	if x == y:
		return 0
	if (x + 1) % 3 == y:
		return -1
	return 1
a = translate(input())
b = translate(input())
c = sum((cmp(x, y) for (x, y) in zip(a, b)))
if c == 0:
	print('TIE')
elif c < 0:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


s1 = input().rstrip()
s2 = input().rstrip()
cnt1 = 0
cnt2 = 0
for i in range(len(s1) // 2):
	c1 = s1[i * 2:i * 2 + 2]
	c2 = s2[i * 2:i * 2 + 2]
	if c1 == c2:
		pass
	elif c1 == '()' and c2 == '8<' or (c1 == '8<' and c2 == '[]') or (c1 == '[]' and c2 == '()'):
		cnt1 += 1
	else:
		cnt2 += 1
if cnt1 > cnt2:
	print('TEAM 1 WINS')
elif cnt2 > cnt1:
	print('TEAM 2 WINS')
else:
	print('TIE')


x = input()
y = input()
(t1, t2) = (0, 0)
i = 0
while i < len(x):
	a = x[i:i + 2]
	b = y[i:i + 2]
	if a == '[]':
		if b == '8<':
			t2 += 1
		if b == '()':
			t1 += 1
	elif a == '()':
		if b == '[]':
			t2 += 1
		if b == '8<':
			t1 += 1
	elif a == '8<':
		if b == '()':
			t2 += 1
		if b == '[]':
			t1 += 1
	i = i + 2
if t1 > t2:
	print('TEAM 1 WINS')
elif t1 < t2:
	print('TEAM 2 WINS')
else:
	print('TIE')


def f(s, t):
	if s == t:
		return 0
	if s == '()' and t == '8<' or (s == '8<' and t == '[]') or (s == '[]' and t == '()'):
		return 1
	return -1
s = input()
t = input()
x = 0
for i in range(0, len(s), 2):
	x += f(s[i:i + 2], t[i:i + 2])
if x == 0:
	print('TIE')
	exit()
if x > 0:
	team = 1
else:
	team = 2
print('TEAM {} WINS'.format(team))


import sys
A = sys.stdin.readline().rstrip()
B = sys.stdin.readline().rstrip()
cnt = 0
for i in range(0, len(A), 2):
	if A[i] == '[' and B[i] == '(' or (A[i] == '8' and B[i] == '[') or (A[i] == '(' and B[i] == '8'):
		cnt += 1
	if B[i] == '[' and A[i] == '(' or (B[i] == '8' and A[i] == '[') or (B[i] == '(' and A[i] == '8'):
		cnt -= 1
if cnt == 0:
	print('TIE')
if cnt > 0:
	print('TEAM 1 WINS')
if cnt < 0:
	print('TEAM 2 WINS')


SCISSOR = '8<'
PAPER = '[]'
ROCK = '()'
teams = [input(), input()]
counts = [0, 0]
for i in range(0, len(teams[0]), 2):
	(act1, act2) = [t[i:i + 2] for t in teams]
	if act1 == act2:
		continue
	if act1 == SCISSOR and act2 == PAPER:
		counts[0] += 1
	elif act1 == PAPER and act2 == ROCK:
		counts[0] += 1
	elif act1 == ROCK and act2 == SCISSOR:
		counts[0] += 1
	else:
		counts[1] += 1
if counts[0] == counts[1]:
	print('TIE')
else:
	winner = max([1, 2], key=lambda x: counts[x - 1])
	print('TEAM %d WINS' % winner)


s1 = input()
s2 = input()
(score1, score2) = (0, 0)
for c in range(0, len(s1), 2):
	if s1[c] == '8':
		if s2[c] == '[':
			score1 += 1
		if s2[c] == '(':
			score2 += 1
	if s1[c] == '[':
		if s2[c] == '(':
			score1 += 1
		if s2[c] == '8':
			score2 += 1
	if s1[c] == '(':
		if s2[c] == '8':
			score1 += 1
		if s2[c] == '[':
			score2 += 1
if score1 == score2:
	print('TIE')
else:
	print('TEAM {} WINS'.format(2 - int(score1 > score2)))


st1 = input()
st2 = input()

def firstwin(x, y):
	if x == y:
		return 0
	if x == '[' and y == '(':
		return 1
	if x == '[' and y == '8':
		return -1
	if x == '(' and y == '[':
		return -1
	if x == '(' and y == '8':
		return 1
	if x == '8' and y == '(':
		return -1
	if x == '8' and y == '[':
		return 1
	return 0
win1 = 0
for i in range(0, len(st1), 2):
	win1 = win1 + firstwin(st1[i], st2[i])
if win1 > 0:
	print('TEAM 1 WINS')
if win1 == 0:
	print('TIE')
if win1 < 0:
	print('TEAM 2 WINS')


def get_arr(Len):
	buff = input().split()
	a = []
	for i in range(Len):
		a.append(int(buff[i]))
	return a
s = input()
t = input()
n = len(s)
i = 0
pt1 = 0
pt2 = 0
while i < n:
	if s[i] == '8' and t[i] == '[':
		pt1 += 1
	if s[i] == '[' and t[i] == '(':
		pt1 += 1
	if s[i] == '(' and t[i] == '8':
		pt1 += 1
	if t[i] == '8' and s[i] == '[':
		pt2 += 1
	if t[i] == '[' and s[i] == '(':
		pt2 += 1
	if t[i] == '(' and s[i] == '8':
		pt2 += 1
	i += 2
if pt1 == pt2:
	print('TIE')
if pt1 > pt2:
	print('TEAM 1 WINS')
if pt2 > pt1:
	print('TEAM 2 WINS')


def winner(a, b):
	if a == 1:
		return 0 if b == 1 else (lambda x: -1 if x == 2 else 1)(b)
	elif a == 2:
		return 1 if b == 1 else (lambda x: 0 if x == 2 else -1)(b)
	else:
		return -1 if b == 1 else (lambda x: 1 if x == 2 else 0)(b)
a = input()
b = input()
score = 0
for x in range(0, len(a), 2):
	if a[x] == '[':
		al = 1
	elif a[x] == '(':
		al = 2
	else:
		al = 3
	if b[x] == '[':
		bl = 1
	elif b[x] == '(':
		bl = 2
	else:
		bl = 3
	score += winner(al, bl)
print('TEAM 1 WINS') if score < 0 else (lambda x: print('TEAM 2 WINS') if x > 0 else print('TIE'))(score)


a = input()
b = input()
t1 = 0
t2 = 0
for i in range(int(len(a) / 2)):
	if a[i * 2] == '[':
		if b[i * 2] == '8':
			t2 = t2 + 1
		if b[i * 2] == '(':
			t1 = t1 + 1
	if a[i * 2] == '(':
		if b[i * 2] == '[':
			t2 = t2 + 1
		if b[i * 2] == '8':
			t1 = t1 + 1
	if a[i * 2] == '8':
		if b[i * 2] == '(':
			t2 = t2 + 1
		if b[i * 2] == '[':
			t1 = t1 + 1
if t1 > t2:
	print('TEAM 1 WINS')
elif t2 > t1:
	print('TEAM 2 WINS')
else:
	print('TIE')


a = input()
b = input()
score = 0
for i in range(0, len(a), 2):
	first = a[i:i + 2]
	second = b[i:i + 2]
	if first == second:
		continue
	elif first == '[]':
		if second == '8<':
			score = score - 1
		else:
			score = score + 1
	elif first == '()':
		if second == '[]':
			score = score - 1
		else:
			score = score + 1
	elif second == '()':
		score = score - 1
	else:
		score = score + 1
if score == 0:
	print('TIE')
elif score < 0:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


a = input()
a_actions = [a[i:i + 2] for i in range(0, len(a), 2)]
b = input()
b_actions = [b[i:i + 2] for i in range(0, len(b), 2)]
rock = '()'
paper = '[]'
scissors = '8<'
a_pts = 0
b_pts = 0
for i in range(len(a) // 2):
	if a_actions[i] == rock:
		if b_actions[i] == scissors:
			a_pts += 1
		elif b_actions[i] == paper:
			b_pts += 1
		else:
			a_pts += 1
			b_pts += 1
	elif a_actions[i] == paper:
		if b_actions[i] == rock:
			a_pts += 1
		elif b_actions[i] == scissors:
			b_pts += 1
		else:
			a_pts += 1
			b_pts += 1
	elif b_actions[i] == paper:
		a_pts += 1
	elif b_actions[i] == rock:
		b_pts += 1
	else:
		a_pts += 1
		b_pts += 1
if a_pts > b_pts:
	print('TEAM 1 WINS')
elif a_pts < b_pts:
	print('TEAM 2 WINS')
else:
	print('TIE')


def a(sMove1, sMove2):
	if sMove1 == '8<' and sMove2 == '[]' or (sMove1 == '[]' and sMove2 == '()') or (sMove1 == '()' and sMove2 == '8<'):
		return 1
	elif sMove2 == '8<' and sMove1 == '[]' or (sMove2 == '[]' and sMove1 == '()') or (sMove2 == '()' and sMove1 == '8<'):
		return 2
	else:
		return 0
t1 = input()
t2 = input()
s = [0, 0, 0]
for i in range(0, len(t1), 2):
	s[a(t1[i] + t1[i + 1], t2[i] + t2[i + 1])] += 1
if s[1] > s[2]:
	print('TEAM 1 WINS')
elif s[1] < s[2]:
	print('TEAM 2 WINS')
else:
	print('TIE')


a = input()
b = input()

def get(a, b):
	if a == '(':
		return 1
	if a == '[':
		return 2
	return 0
i = 0
res = 0
while i < len(a):
	t1 = get(a[i], a[i + 1])
	t2 = get(b[i], b[i + 1])
	i += 2
	if t1 == t2:
		continue
	if t1 == 0 and t2 == 2 or (t1 == 1 and t2 == 0) or (t1 == 2 and t2 == 1):
		res += 1
	else:
		res -= 1
if res > 0:
	print('TEAM 1 WINS')
if res < 0:
	print('TEAM 2 WINS')
if res == 0:
	print('TIE')


beats = [('[]', '()'), ('()', '8<'), ('8<', '[]')]
a = input()
b = input()
if len(a) % 2:
	raise 'Ho'
sc1 = 0
sc2 = 0
for i in range(0, len(a), 2):
	x = a[i:i + 2]
	y = b[i:i + 2]
	if (x, y) in beats:
		sc1 += 1
	elif x != y:
		sc2 += 1
if sc1 == sc2:
	print('TIE')
else:
	print('TEAM %d WINS' % (1 if sc1 > sc2 else 2))


s1 = input()
s2 = input()
s1 = s1.replace('[]', '1')
s1 = s1.replace('()', '2')
s1 = s1.replace('8<', '3')
s2 = s2.replace('[]', '1')
s2 = s2.replace('()', '2')
s2 = s2.replace('8<', '3')
cnt = 0
for (x, y) in zip(s1, s2):
	if x == y:
		continue
	if x == '1' and y == '2':
		cnt += 1
	elif x == '1' and y == '3':
		cnt -= 1
	elif x == '2' and y == '1':
		cnt -= 1
	elif x == '2' and y == '3':
		cnt += 1
	elif x == '3' and y == '1':
		cnt += 1
	else:
		cnt -= 1
if cnt > 0:
	print('TEAM 1 WINS')
elif cnt == 0:
	print('TIE')
else:
	print('TEAM 2 WINS')


def move(ch1):
	if ch1 == '8':
		return 3
	elif ch1 == '[':
		return 2
	return 1
s = input()
t = input()
cnt1 = 0
cnt2 = 0
for i in range(0, len(s), 2):
	x = move(s[i])
	y = move(t[i])
	if x == 1 and y == 2:
		cnt2 += 1
	if x == 1 and y == 3:
		cnt1 += 1
	if x == 2 and y == 1:
		cnt1 += 1
	if x == 2 and y == 3:
		cnt2 += 1
	if x == 3 and y == 2:
		cnt1 += 1
	if x == 3 and y == 1:
		cnt2 += 1
if cnt1 == cnt2:
	print('TIE')
elif cnt1 > cnt2:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


a = input()
b = input()
(x, y) = (0, 0)
for i in range(len(a)):
	if a[i] == '(' and b[i] == '8':
		x += 1
	if a[i] == '(' and b[i] == '[':
		y += 1
	if a[i] == '[' and b[i] == '8':
		y += 1
	if a[i] == '[' and b[i] == '(':
		x += 1
	if a[i] == '8' and b[i] == '(':
		y += 1
	if a[i] == '8' and b[i] == '[':
		x += 1
if x == y:
	print('TIE')
if x > y:
	print('TEAM 1 WINS')
if x < y:
	print('TEAM 2 WINS')


__author__ = 'Pavel Mavrin'
a = input().strip()
b = input().strip()
n = len(a) // 2
x = 0
figs = ['[]', '()', '8<']
for i in range(n):
	s1 = figs.index(a[i * 2:(i + 1) * 2])
	s2 = figs.index(b[i * 2:(i + 1) * 2])
	if s2 == (s1 + 1) % 3:
		x += 1
	if s1 == (s2 + 1) % 3:
		x -= 1
if x > 0:
	print('TEAM 1 WINS')
elif x < 0:
	print('TEAM 2 WINS')
else:
	print('TIE')


def split_by_n(seq, n):
	while seq:
		yield seq[:n]
		seq = seq[n:]

def is_first_win(first, second):
	if first == second:
		return 0
	if first == '8<':
		if second == '[]':
			return 1
		else:
			return -1
	if first == '[]':
		if second == '()':
			return 1
		else:
			return -1
	if second == '8<':
		return 1
	else:
		return -1
team1 = list(split_by_n(input(), 2))
team2 = list(split_by_n(input(), 2))
score = 0
for i in range(len(team1)):
	score += is_first_win(team1[i], team2[i])
if score > 0:
	print('TEAM 1 WINS')
elif score == 0:
	print('TIE')
else:
	print('TEAM 2 WINS')


s = input()
p = input()
n = len(s)
ans = 0
for i in range(0, n, 2):
	if s[i:i + 2] == '8<':
		if p[i:i + 2] == '[]':
			ans += 1
		elif p[i:i + 2] == '()':
			ans -= 1
	if s[i:i + 2] == '[]':
		if p[i:i + 2] == '()':
			ans += 1
		elif p[i:i + 2] == '8<':
			ans -= 1
	if s[i:i + 2] == '()':
		if p[i:i + 2] == '8<':
			ans += 1
		elif p[i:i + 2] == '[]':
			ans -= 1
if ans < 0:
	print('TEAM 2 WINS')
elif ans == 0:
	print('TIE')
else:
	print('TEAM 1 WINS')


a = input()
b = input()
d = [[0, 1, -1], [-1, 0, 1], [1, -1, 0]]
m = {'()': 0, '8<': 1, '[]': 2}
s = sum((d[m[a[i:i + 2]]][m[b[i:i + 2]]] for i in range(0, len(a), 2)))
print('TEAM 1 WINS' if s > 0 else 'TEAM 2 WINS' if s < 0 else 'TIE')


w = {'8<': '[]', '[]': '()', '()': '8<'}
(a, b) = (input(), input())
p = 0
for i in range(0, len(a), 2):
	(r, s) = (a[i:i + 2], b[i:i + 2])
	if w[r] == s:
		p += 1
	elif w[s] == r:
		p -= 1
if p == 0:
	print('TIE')
elif p < 0:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


(a, b) = (input()[::2], input()[::2])
(s, t) = (0, ['8[', '[(', '(8'])
for (i, j) in zip(a, b):
	if i == j:
		continue
	if i + j in t:
		s += 1
	else:
		s -= 1
if s:
	print('TEAM', 1 + (s < 0), 'WINS')
else:
	print('TIE')


rps = {'[]': 0, '8<': 1, '()': 2}
s = input()
t = input()
n = len(s) // 2
score = 0
for i in range(n):
	res = (rps[s[2 * i:2 * i + 2]] - rps[t[2 * i:2 * i + 2]] + 1) % 3 - 1
	score += res
if score > 0:
	print('TEAM 1 WINS')
elif score < 0:
	print('TEAM 2 WINS')
else:
	print('TIE')


s = input()
t = input()
n = len(s)
d = {'([': [0, 1], '((': [0, 0], '[[': [0, 0], '88': [0, 0], '(8': [1, 0], '8(': [0, 1], '[8': [0, 1], '8[': [1, 0], '[(': [1, 0]}
(p, q) = (0, 0)
for i in range(0, n, 2):
	p += d[s[i] + t[i]][0]
	q += d[s[i] + t[i]][1]
if p == q:
	print('TIE')
elif p > q:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


def get(c):
	return '8[('.index(c)

def win(d, e):
	return (get(d) + 1) % 3 == get(e)
a = input()
b = input()
x = 0
y = 0
for i in range(0, len(a), 2):
	x += win(a[i], b[i])
	y += win(b[i], a[i])
if x > y:
	print('TEAM 1 WINS')
elif x < y:
	print('TEAM 2 WINS')
else:
	print('TIE')


a = input().strip()
b = input().strip()
n = len(a) // 2
c1 = 0
c2 = 0
for i in range(n):
	s = i * 2
	a1 = a[s:s + 2]
	b1 = b[s:s + 2]
	if a1 == b1:
		continue
	if a1 == '[]':
		if b1 == '8<':
			c2 += 1
		elif b1 == '()':
			c1 += 1
	elif a1 == '()':
		if b1 == '[]':
			c2 += 1
		elif b1 == '8<':
			c1 += 1
	elif b1 == '[]':
		c1 += 1
	elif b1 == '()':
		c2 += 1
if c2 > c1:
	print('TEAM 2 WINS')
elif c2 == c1:
	print('TIE')
else:
	print('TEAM 1 WINS')


__author__ = 'Nova'

def parse_string(s):
	ret = []
	m = len(s) // 2
	for i in range(m):
		ss = ''.join(s[i * 2:i * 2 + 2])
		if ss == '8<':
			ret.append(0)
		elif ss == '[]':
			ret.append(1)
		elif ss == '()':
			ret.append(2)
	return ret
(s1, s2) = (input(), input())
(l1, l2) = (parse_string(s1), parse_string(s2))
res = 0
mapo = {(0, 1): 1, (1, 2): 1, (2, 0): 1, (1, 0): -1, (2, 1): -1, (0, 2): -1}
for i in range(len(l1)):
	if l1[i] != l2[i]:
		res += mapo[l1[i], l2[i]]
if res == 0:
	print('TIE')
elif res > 0:
	print('TEAM 1 WINS')
else:
	print('TEAM 2 WINS')


rock = '[]'
paper = '()'
scissor = '8<'
team1 = str(input())
team2 = str(input())
team11 = 0
team22 = 0
i = 0
while i < len(team1):
	if team1[i] + team1[i + 1] == team2[i] + team2[i + 1]:
		i += 2
		continue
	elif team1[i] + team1[i + 1] == '[]' and team2[i] + team2[i + 1] == '8<':
		team11 += 1
	elif team1[i] + team1[i + 1] == '()' and team2[i] + team2[i + 1] == '[]':
		team11 += 1
	elif team1[i] + team1[i + 1] == '8<' and team2[i] + team2[i + 1] == '()':
		team11 += 1
	else:
		team22 += 1
	i += 2
if team11 < team22:
	print('TEAM 1 WINS')
elif team22 < team11:
	print('TEAM 2 WINS')
else:
	print('TIE')


def chunks(l, n):
	for i in range(0, len(l), n):
		yield l[i:i + n]
stone = '[]'
scissors = '8<'
paper = '()'

def compare_r1_to_r2(r1, r2):
	if r1 == r2:
		return None
	elif r1 == stone and r2 == scissors or (r1 == paper and r2 == stone) or (r1 == scissors and r2 == paper):
		return True
	else:
		return False
FT = input()
ST = input()
FT = list(chunks(FT, 2))
ST = list(chunks(ST, 2))
(SFT, SST) = (0, 0)
for i in range(0, len(FT)):
	result = compare_r1_to_r2(FT[i], ST[i])
	if result:
		SST += 1
	elif result is not None:
		SFT += 1
if SFT > SST:
	print('TEAM 1 WINS')
elif SFT < SST:
	print('TEAM 2 WINS')
else:
	print('TIE')


def res(a, b):
	if a == '8<' and b == '[]':
		return 1
	elif a == '8<' and b == '()':
		return -1
	elif a == '8<' and b == '8<':
		return 0
	elif a == '[]' and b == '8<':
		return -1
	elif a == '[]' and b == '()':
		return 1
	elif a == '[]' and b == '[]':
		return 0
	elif a == '()' and b == '8<':
		return 1
	elif a == '()' and b == '[]':
		return -1
	elif a == '()' and b == '()':
		return 0
s1 = input()
s2 = input()
s1 = [s1[i:i + 2] for i in range(0, len(s1), 2)]
s2 = [s2[i:i + 2] for i in range(0, len(s2), 2)]
sum = 0
for i in zip(s1, s2):
	sum += res(*i)
if sum > 0:
	print('TEAM 1 WINS')
elif sum < 0:
	print('TEAM 2 WINS')
else:
	print('TIE')


s = input()
t = input()
t1 = 0
t2 = 0
for i in range(0, len(s), 2):
	(q1, q2) = (s[i] + s[i + 1], t[i] + t[i + 1])
	if q1 != q2:
		if q1 == '8<':
			if q2 == '()':
				t2 += 1
			else:
				t1 += 1
		elif q1 == '()':
			if q2 == '[]':
				t2 += 1
			else:
				t1 += 1
		elif q2 == '8<':
			t2 += 1
		else:
			t1 += 1
if t1 > t2:
	print('TEAM 1 WINS')
elif t1 == t2:
	print('TIE')
else:
	print('TEAM 2 WINS')


s1 = input()
s2 = input()

def identify(figure):
	if figure == '8<':
		return 'scissors'
	elif figure == '[]':
		return 'paper'
	else:
		return 'stone'
(first, second) = (0, 0)
i = 0
while i < len(s1) - 1:
	p1 = identify(s1[i:i + 2])
	p2 = identify(s2[i:i + 2])
	if p1 == 'scissors':
		if p2 == 'paper':
			first += 1
		elif p2 == 'stone':
			second += 1
	elif p1 == 'paper':
		if p2 == 'stone':
			first += 1
		elif p2 == 'scissors':
			second += 1
	elif p1 == 'stone':
		if p2 == 'scissors':
			first += 1
		elif p2 == 'paper':
			second += 1
	i += 2
if first == second:
	print('TIE')
elif first < second:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


a = input()
b = input()
d = 0
s = 0
for i in range(0, len(a), 2):
	if a[i] == '[':
		if b[i] == '(':
			s = s + 1
		elif b[i] == '8':
			d = d + 1
		else:
			pass
	elif a[i] == '(':
		if b[i] == '[':
			d = d + 1
		elif b[i] == '8':
			s = s + 1
		else:
			pass
	elif a[i] == '8':
		if b[i] == '(':
			d = d + 1
		elif b[i] == '[':
			s = s + 1
		else:
			pass
	else:
		pass
if s > d:
	print('TEAM 1 WINS')
elif s == d:
	print('TIE')
else:
	print('TEAM 2 WINS')


in1 = input()
in2 = input()

def beat(one, two):
	if one == '8<' and two == '[]':
		return True
	elif one == '[]' and two == '()':
		return True
	elif one == '()' and two == '8<':
		return True
	elif one != two:
		return False
p1 = 0
p2 = 0
length = len(in1)
for x in range(0, length, 2):
	if in1[x:x + 2] != in2[x:x + 2]:
		if beat(in1[x:x + 2], in2[x:x + 2]):
			p1 += 1
		else:
			p2 += 1
if p1 == p2:
	print('TIE')
elif p1 < p2:
	print('TEAM 2 WINS')
else:
	print('TEAM 1 WINS')


a = input()
b = input()
D = {('8<', '8<'): 0, ('[]', '[]'): 0, ('()', '()'): 0, ('8<', '[]'): -1, ('()', '[]'): 1, ('[]', '8<'): 1, ('[]', '()'): -1, ('8<', '()'): 1, ('()', '8<'): -1}
r = 0
for i in range(0, len(a), 2):
	x = a[i:i + 2]
	y = b[i:i + 2]
	r += D[x, y]
if r > 0:
	print('TEAM 2 WINS')
elif r < 0:
	print('TEAM 1 WINS')
else:
	print('TIE')