#include <iostream>
#include <string>
#include <map>

using namespace std;

int tt[3][3] = {
    {0, 1, 2},
    {2, 0, 1},
    {1, 2, 0}
};
map<char, int> ss = {
    {'(', 0},
    {'8', 1},
    {'[', 2}
};

int main(int argc, char *argv[])
{
    string a, b;
    cin >> a >> b;

    int result[3] = {0, 0, 0};
    for (size_t i = 0; i < a.size(); i += 2) {
        result[tt[ss[a[i]]][ss[b[i]]]]++;
    }

    if (result[1] == result[2]) {
        std::cout << "TIE" << std::endl;
    } else if (result[1] > result[2]) {
        std::cout << "TEAM 1 WINS" << std::endl;
    } else {
        std::cout << "TEAM 2 WINS" << std::endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
  string a, b;
  cin >> a >> b;
  assert(a.size()==b.size());
  int score=0;
  for(int i=0;i<a.size()/2;i++)
    {
      if(a[2*i]==b[2*i])continue;
      else if((a[2*i]=='8' && b[2*i]=='[')||
	      (a[2*i]=='[' && b[2*i]=='(')||
	      (a[2*i]=='(' && b[2*i]=='8'))
	score++;
      else score--;

    }
  if(score>0)printf("TEAM 1 WINS\n");
  else if(score == 0)printf("TIE\n");
  else printf("TEAM 2 WINS\n");
  return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
 #include<string>
 using namespace std;
  int main(){
      string a,b;
      int A,B; A=0,B=0;
      cin>>a>>b;
      for(int i=0;i<a.length();i+=2)
      {
           if(a[i]==b[i])
      { continue; }
      else{ if(a[i]=='8'&&b[i]=='[')
      { A++; }
      else if(a[i]=='['&&b[i]=='(')
              { A++; }
              else if(a[i]=='('&&b[i]=='8')
                      { A++; }
                      else if(a[i]==b[i])
                      { A++; B++; }
                      else{ B++; } } }
                       if(A==B){
                           cout<<"TIE"<<endl;}
 else if(A>B)
 {cout<<"TEAM 1 WINS"<<endl;}
  else cout<<"TEAM 2 WINS"<<endl;
   return 0; }

/*
To this question,i am speechless.
looking  other solutions,i don't known the sample test.
*/

#include <string.h>
#include <iostream>
using namespace std;
int main(){
    char str1[20],str2[20];
    while(cin>>str1>>str2)
    {
        int num1=0,num2=0;
        int l1 = strlen(str1);
        int l2 = strlen(str2);
        for(int i=0;i<l1;i+=2){
        if((str1[i]=='8' && str2[i]=='[')|| (str1[i]=='[' &&str2[i]=='(') || (str1[i]=='('&&str2[i]=='8'))
                     num1++;
        else if((str2[i]=='8' && str1[i]=='[')|| (str2[i]=='[' &&str1[i]=='(') || (str2[i]=='('&&str1[i]=='8'))
            num2++;
        }
        if(num1>num2)
            cout<<"TEAM 1 WINS"<<endl;
        else if(num2>num1)
            cout<<"TEAM 2 WINS"<<endl;
        else
            cout<<"TIE"<<endl;
    }
    return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define MP(i,j) make_pair(i,j)
#define X first
#define Y second
typedef long long int64;
typedef long double real;
template <class T>inline void updata(T&a,T b){if(a<b)a=b;}
template <class T>inline void downdata(T&a,T b){if(a>b)a=b;}
template <class T>inline T sqr(const T& x){return x*x;}
int s;
char st1[500000],st2[500000];
int main()
{
    gets(st1);
    gets(st2);
    for (int i=0;st1[i];i+=2)
    {
        int a,b;
        if (st1[i]=='8')a=0;
        else if (st1[i]=='(')a=2;
        else if (st1[i]=='[')a=1;
        if (st2[i]=='8')b=0;
        else if (st2[i]=='(')b=2;
        else if (st2[i]=='[')b=1;
        if ((a+1)%3==b)s++;
        else if ((b+1)%3==a)s--;
        //printf("%d\n",s);
    }
    if (s>0)puts("TEAM 1 WINS");
    else if (s<0)puts("TEAM 2 WINS");
    else puts("TIE");
    return 0;
}

/* -*- coding: utf-8 -*-
 *
 * 0409A.cc: A. The Great Game
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 32;

enum { G, C, P };
enum { W, L, D };

const int wls[3][3] = {
  /*        G, C, P */
  /* G */ { D, W, L },
  /* C */ { L, D, W },
  /* P */ { W, L, D },
};

/* typedef */

/* global variables */

int cmap[128];
char s[MAX_N], t[MAX_N];

/* subroutines */

/* main */

int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  cmap['('] = G, cmap['8'] = C, cmap['['] = P;

  scanf("%s%s", s, t);

  int sc = 0;
  for (int i = 0; s[i]; i += 2) {
    int f = wls[cmap[s[i]]][cmap[t[i]]];
    if (f == W) sc--;
    else if (f == L) sc++;
  }

  if (sc < 0) puts("TEAM 1 WINS");
  else if (sc > 0) puts("TEAM 2 WINS");
  else puts("TIE");
  return 0;
}

//
//  main.cpp
//  April Fools Day Contest 2014 A
//
//  Created by luras on 16/3/16.
//  Copyright (c) 2016年 luras. All rights reserved.
//

#define ms(x, y) memset(x, y, sizeof(x))
#define mc(x, y) memcpy(x, y, sizeof(x))
#define ls o << 1
#define rs o << 1 | 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<algorithm>
#pragma comment(linker,"/STACK:102400000,102400000")
template <class T> inline void gmax(T &a, T b){if(b > a) a = b;}
template <class T> inline void gmin(T &a, T b){if(b < a) a = b;}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
typedef long long LL;
void fre()
{
    freopen("/Users/luras/Desktop/in.txt", "r", stdin);
    freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;

int len, n, m;
char s1[N], s2[N];

map<char, int> mop;

// 8 [  (

int main()
{
    scanf("%s%s", s1, s2);
    for(int i = 0; i < strlen(s1); i += 2){
        if(s1[i] == '8'){
            if(s2[i] == '[') n ++;
            if(s2[i] == '(') n --;
        }
        else if(s1[i] == '['){
            if(s2[i] == '(') n ++;
            if(s2[i] == '8') n --;
        }
        else{
            if(s2[i] == '8') n ++;
            if(s2[i] == '[') n --;
        }
    }
    if(n == 0) puts("TIE");
    else if(n > 0) puts("TEAM 1 WINS");
    else puts("TEAM 2 WINS");
    return 0;
}

/*
 []()[]8<
 8<[]()8<

 题意:

 类型:

 分析:

 优化:

 trick:

 数据:

 Sample Input

 Sample Output

 */

#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class AK>void r(AK &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
string s,c;
int ans,sum;
int main(){
	cin>>s;
	cin>>c;
	for(int i=0;s[i];i+=2){
		if((s[i]=='8'&&c[i]=='[')||(s[i]=='('&&c[i]=='8')||(s[i]=='['&&c[i]=='('))ans++;
		else if(s[i]==c[i])ans++,sum++;
		else sum++;
	}
	if(ans==sum)puts("TIE");
	if(ans>sum)puts("TEAM 1 WINS");
	if(ans<sum)puts("TEAM 2 WINS");
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	int wina,winb;
	wina=winb=0;
	for(int i=0;i<a.length();i+=2)
	{
		if(a[i]=='8')
		{
			if(b[i]=='(')
			{
				winb++;
			}
			else if(b[i]=='[')
			{
				wina++;
			}
		}
		else if(a[i]=='(')
		{
			if(b[i]=='[')
			{
				winb++;
			}
			else if(b[i]=='8')
			{
				wina++;
			}
		}
		else if(a[i]=='[')
		{
			if(b[i]=='8')
			{
				winb++;
			}
			else if(b[i]=='(')
			{
				wina++;
			}
		}
	}
	if(wina>winb)
	{
		cout<<"TEAM 1 WINS";
	}
	else if(wina<winb)
	{
		cout<<"TEAM 2 WINS";
	}
	else cout<<"TIE";
}

#include<iostream>
#include<cassert>
using namespace std;

int point(char c) {
	if(c == '(') return 0;
	if(c == '[') return 1;
	if(c == '8') return 2;
	assert(false);
}

int main() {
	string a, b; cin >> a >> b;
	int n = a.size();
	assert(n % 2 == 0);
	int p = 0;
	for(int i = 0; i < n; i += 2) {
		if(a[i] == b[i]) continue;
		if(a[i] == '8' && b[i] == '[' || a[i] == '[' && b[i] == '(' || a[i] == '(' && b[i] == '8') ++p;
		else --p;
	}
	cout << (p > 0 ? "TEAM 1 WINS" : p == 0 ? "TIE" : "TEAM 2 WINS");
	return 0;
}

#include<bits/stdc++.h>

#define clear(a) memset(a,0,sizeof(a))
#define inf(a) memset(a,-1,sizeof(a))
#define sz s.size()
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pb() push_back()
#define p_b() pop_back()

using namespace std;
int team1, team2;
string s, ss;
const int INF = 10e9;
main()
    {
    ios_base::sync_with_stdio(false);
	cin >> s;
	cin >> ss;
	for(int i = 0; i < s.size(); i ++)
		{
		if(s[i] == '[')
			{
			if(ss[i] == '(')
				team1++;
			if(ss[i] == '8')
				team2++;
			}
		if(s[i] == '(')
			{
			if(ss[i] == '8')
				team1++;
			if(ss[i] == '[')
				team2 ++;
			}
		if(s[i] == '8')
			{
			if(ss[i] == '[')
				team1 ++;
			if(ss[i] == '(')
				team2 ++;
			}
		}
	if(team1 > team2)
		cout << "TEAM 1 WINS";
	else if(team2 > team1)
		cout << "TEAM 2 WINS";
	else
		cout << "TIE";
	}

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)

#define DEBUG(x) { cout << #x << " = "; cout << (x) << endl; }
#define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
#define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
using namespace std;

char a[111], b[111];

bool win(char a, char b) {
    if (a == '8' && b == '[') return true;
        else if (a == '[' && b == '(') return true;
            else if (a == '(' && b == '8') return true;
    return false;
}

int main() {
    ios :: sync_with_stdio(false);
    while (gets(a)) {
        gets(b);
        int sa = 0, sb = 0;
        for(int i = 0; i < strlen(a); i += 2)
            if (win(a[i], b[i])) ++sa;
            else if (win(b[i], a[i])) ++sb;

        if (sa == sb) puts("TIE");
        else if (sa > sb) puts("TEAM 1 WINS");
        else puts("TEAM 2 WINS");
    }
    return 0;
}

/*
Abolfazl Kazemi

BSc in Software Engineering: IAUN Iran
MSc student of Software Engineering: IUST
UVA, topcoder, codeforces, facebook account: AKJ88
*/

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <functional>
#include <string>
#include <sstream>

using namespace std;

#define     For(i,a,b)        for (i=a; i<b; i++)
#define     FoR(i,a,b)        for (i=a; i<=b; i++)
#define     Rep(i,a)          for (i=0; i<a; i++)
#define     FIT(it,v)         for (it=(v).begin(); it!=(v).end(); ++it)
#define     ALL(v)            (v).begin(),(v).end()
#define     Set(a,x)          memset((a),(x),sizeof(a))
#define     EXIST(a,b)        find(ALL(a),(b))!=(a).end()
#define     Sort(x)           sort(ALL(x))
#define     UNIQUE(v)         Sort(v); (v).resize(unique(ALL(v)) - (v).begin())
#define     SF                scanf
#define     PF                printf

#define     EPS         1e-8
#define     PI          acos(-1)
#define     MAXN        105
#define     MOD         1000000007
#define     INF         1000000000
#define     X           first
#define     Y           second

typedef pair<int, int> ii;
typedef pair<double, double> dd;
typedef long long ll;
typedef unsigned long long llu;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<dd> vdd;

int getAdder(char c1, char c2){
    if (c1 == c2)
        return 0;
    if ((c1 == '8' && c2 == '[') || (c1 == '[' && c2 == '(') || (c1=='(' && c2=='8'))
        return 1;
    return -1;
}

int main(){
    string s1, s2;
    int i, vals = 0;
#ifndef ONLINE_JUDGE
    freopen("C:\\acm_inp\\FA.in", "r", stdin);
    //freopen("C:\\acm_inp\\PSEUDO.OUT", "w", stdout);
#endif

    cin >> s1 >> s2;
    for (i = 0; i<s1.length(); i+=2)
        vals += getAdder(s1[i], s2[i]);
    if (!vals)
        cout << "TIE" << endl;
    else if(vals>0)
        cout << "TEAM 1 WINS" << endl;
    else
        cout << "TEAM 2 WINS" << endl;

    return 0;
}

#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <map>
#include <algorithm>
using namespace std;
int main()
{
string a,b;
    cin>>a>>b;
    int x=0,y=0;
    for(int i=0;i<a.length();i+=2)
    {
        if(a[i]==b[i])
        continue;
        if((a[i]=='['&&b[i]=='8')||(a[i]=='8'&&b[i]=='(')||(a[i]=='('&&b[i]=='['))
            y++;
        else
            x++;
    }
    if(x>y)
        cout<<"TEAM 1 WINS";
    else if(y>x)
        cout<<"TEAM 2 WINS";
    else
        cout<<"TIE";
    return 0;
}

#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;
int ans,ant,i,j,n;
string s,ss;
int main () {
cin>>s;
cin>>ss;
n=s.size();
for(i=0;i<n;i+=2){
    if(s[i]=='8'&&ss[i]=='[')
        ans++;
    if(s[i]=='['&&ss[i]=='(')
        ans++;
    if(s[i]=='('&&ss[i]=='8')
        ans++;
    if(s[i]=='['&&ss[i]=='8')
        ant++;
    if(s[i]=='('&&ss[i]=='[')
        ant++;
    if(s[i]=='8'&&ss[i]=='(')
        ant++;
        }
    if(ans>ant)
        cout<<"TEAM 1 WINS";
    else
    if(ans<ant)
        cout<<"TEAM 2 WINS";
        else
        cout<<"TIE";

return 0;
}

#include <iostream>
#include<string>
using namespace std;

int main(){
    string x,y;
    int team1=0;
    int team2=0;
    cin>>x;
    cin>>y;

for(int i=0;i<x.size();i+=2)
{
    if(x.at(i)==y.at(i));
    if(x.at(i)=='['&&y.at(i)=='8')team2++;
    if(x.at(i)=='('&&y.at(i)=='8')team1++;
    if(x.at(i)=='8'&&y.at(i)=='[')team1++;
    if(x.at(i)=='8'&&y.at(i)=='(')team2++;
    if(x.at(i)=='['&&y.at(i)=='(')team1++;
    if(x.at(i)=='('&&y.at(i)=='[')team2++;
}

if(team2>team1)cout<<"TEAM 2 WINS";
else if(team1>team2)cout<<"TEAM 1 WINS";
else cout<<"TIE";
    return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int x=0,y=0;
    for(int i=0;i<a.size();i+=2)
    {
        if(a[i]==b[i])
		    continue;
        if((a[i]=='['&&b[i]=='8')||(a[i]=='8'&&b[i]=='(')||(a[i]=='('&&b[i]=='['))
            y++;
        else
            x++;
    }
    if(x>y)
        cout<<"TEAM 1 WINS";
    else if(y>x)
        cout<<"TEAM 2 WINS";
    else
        cout<<"TIE";
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
int main()
{
int ans1=0,ans2=0;
char a[1001],b[1001];
gets(a);
gets(b);
int n=strlen(a);
for(int i=0;i<n;i+=2)
{
	if(a[i]=='['){
		if(b[i]=='8') ans2++;
		if(b[i]=='(') ans1++;
	}
	if(a[i]=='('){
		if(b[i]=='8') ans1++;
		if(b[i]=='[') ans2++;
	}
	if(a[i]=='8'){
		if(b[i]=='(') ans2++;
		if(b[i]=='[') ans1++;
	}
}
if(ans1>ans2) cout<<"TEAM 1 WINS";
else if(ans2>ans1) cout<<"TEAM 2 WINS";
else cout<<"TIE";
return 0;
}

#include <bits/stdc++.h>//万能库，好用
using namespace std;

char c,c1[100];//数组开大，以防万一#include <bits/stdc++.h>//万能库，好用
int n,poin1,poin2;//主程序外定义，听说可以不用清零

int main()
{
    c=getchar();//开始读入
    while(c!='\n')//一直读，直至换行
    {
        n++;//记录回合数
        c1[n]=getchar();//因为每个手势都只有两个字符，且都不相同，所以只需记录第二个即可
        c=getchar();//继续读入
    }
    for(int i=1;i<=n;i++)//有了回合数就不用while了
    {
        getchar();//忽略第一个字符
        c=getchar();//省去c2数组，减少空间
        if(c1[i]==']')//第一个人是布
        {
            if(c==')')poin1++;//第二个人是石头
            if(c=='<')poin2++;//第二个人是剪刀
        }
        if(c1[i]==')')//第一个人是石头
        {
            if(c=='<')poin1++;//第二个人是剪刀
            if(c==']')poin2++;//第二个人是布
        }
        if(c1[i]=='<')
        {
            if(c==']')poin1++;//第二个人是布
            if(c==')')poin2++;//第二个人是石头
        }
    }
    if(poin1==poin2)printf("TIE");//分数相同=>平局
    if(poin1>poin2)printf("TEAM 1 WINS");//谁分数多谁赢
    if(poin1<poin2)printf("TEAM 2 WINS");
}

//	In the name of God

/*

	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
	NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

	                                          R  A      A  R
	                                        R   A   AA   A   R
	                                       R   A    AA    A   R
	                                      R   AA    AA    AA   R
	                                       R   A    AA    A   R
	                                        R    A  AA  A    R
	                                          R    AAAA    R
	                                              A AA A

	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
	IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

*/

	#include <string>
	#include <iostream>
	#include <algorithm>

	using namespace std;

	int v1, v2;
	string str1, str2, s[3]={"()","[]","8<"}, ss1, ss2;

	int main()
	{
		ios::sync_with_stdio(0);
//		freopen("A.in", "r", stdin);
		cin>>str1>>str2;
		for(int i=0; i<str1.size(); i++)
		{
			ss1=str1.substr(i, 2);
			ss2=str2.substr(i, 2);
			if((ss1==s[1] && ss2==s[2]) || (ss1==s[0] && ss2==s[1]) || (ss1==s[2] && ss2==s[0]))
				v2++;
			else if((ss1==s[2] && ss2==s[1]) || (ss1==s[1] && ss2==s[0]) || (ss1==s[0] && ss2==s[2]))
				v1++;
			i++;
		}
		if(v1>v2)
			cout<<"TEAM 1 WINS"<<endl;
		else if(v2>v1)
			cout<<"TEAM 2 WINS"<<endl;
		else
			cout<<"TIE"<<endl;
		return 0;
	}

#include <bits/stdc++.h>
#define ll unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for(ll i=a;i<b;i+=2)
#define all(a) a.begin(),a.end()
#define sum(a) accumulate(all(a),0)
#define endl '\n'
#define hell 1000000007

using namespace std;
template <class X>
void input(vector<X>&a,int N){
    X temp;
    rep(i,0,N){
        cin>>temp;
        a.push_back(temp);
    }
}
void solve(){
    string s,t;
    cin>>s>>t;
    int a=0,b=0;
    rep(i,0,s.size()){
        if(s[i]==t[i]){
            continue;
        }
        else if(s[i]=='[' && t[i]=='8'){
            b++;
        }
        else if(s[i]=='['){
            a++;
        }
        else if(s[i]=='(' && t[i]=='['){
            b++;
        }
        else if(s[i]=='('){
            a++;
        }
        else if(s[i]=='8' && t[i]=='('){
            b++;
        }
        else if(s[i]=='8'){
            a++;
        }

    }
    if(a>b){
        cout<<"TEAM 1 WINS";
    }
    else if(a==b){
        cout<<"TIE";
    }
    else{
        cout<<"TEAM 2 WINS";
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}

#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	string str1, str2;
	while(cin >> str1 >> str2){
		int count1 = 0, count2 = 0;
		for (int i = 0; i < str1.size(); i += 2){
			if (str1[i] != str2[i])
				if(str1[i] == '(' && str2[i] == '[')
					++count2;
				else if(str1[i] == '(' && str2[i] == '8')
					++count1;
				else if(str1[i] == '[' && str2[i] == '(')
					++count1;
				else if(str1[i] == '[' && str2[i] == '8')
					++count2;
				else if(str1[i] == '8' && str2[i] == '(')
					++count2;
				else
					++count1;
		}
		if (count1 > count2)
			cout << "TEAM 1 WINS" << endl;
		else if (count1 < count2)
			cout << "TEAM 2 WINS" << endl;
		else
			cout << "TIE" << endl;
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

std::vector<int> parent;

int find(int x){
	if(parent[x] == x) return x;
	return find(parent[x]);
}
void union1(int a,int b){
	parent[find(b)] = find(a);
}

int32_t main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    //start from here
    string s1,s2;
    cin >> s1 >> s2;
    int i,one = 0,two = 0;
    for(i=0;i<s1.size();i+=2){
    	if(s1[i] == '('){
    		if(s2[i] == '[') two++;
    		else if(s2[i] == '8') one++;
    	}
    	else if(s1[i] == '['){
    		if(s2[i] == '(') one++;
    		else if(s2[i] == '8') two++;
    	}
    	else{
    		if(s2[i] == '(') two++;
    		else if(s2[i] == '[') one++;
    	}
    }
    if(one > two) cout << "TEAM 1 WINS";
    else if(two > one) cout << "TEAM 2 WINS";
    else cout << "TIE";
    return 0;
}

/* Nurgazy Zhandos */

#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <fstream>
#include <utility>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define F first
#define S second

#define pf push_front
#define pb push_back
#define mp make_pair
#define pp pop_back

#define all(a) a.begin(), a.end()
#define sz(a) a.size()
#define STOP return 0

using namespace std;

typedef pair <long long, long long> PLL;
typedef unsigned long long ULL;
typedef pair <int, int> PII;
typedef long double LD;
typedef long long LL;

const int inf = 1e9 + 123;
const LL INF = 1e18 + 123;
const double eps = 1e-9;
const int mod = 1e9 + 7;

void boost() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
}

int main () {
	//	freopen(".in", "r", stdin);
	//	freopen(".out", "w", stdout);

	int cnt = 0, cnb = 0;
	string s, c;
	cin >> s >> c;

	for(int i = 0; i < sz(s); i+=2) {
		if(s[i] == '[') {
			if(c[i] == '(') {
				cnt++;
			}
			else if(c[i] != s[i]) {
				cnb++;
			}
		}
		else if(s[i] == '(') {
			if(c[i] == '8') {
				cnt++;
			}
			else if(c[i] != s[i]) {
				cnb++;
			}
		}
		else if(s[i] == '8')  {
			if(c[i] == '[') {
				cnt++;
			}
			else if(c[i] != s[i]) {
				cnb++;
			}
		}
	}

	if(cnt > cnb) {
		cout << "TEAM 1 WINS";
	}
	else if(cnt < cnb) {
		cout << "TEAM 2 WINS";
	}
	else{
		cout << "TIE";
	}
}

#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
string a,b;

int main()
{
    cin>>a>>b;
    int x=0,y=0;
    for (int i=0;i<=a.size();i+=2)
    {
        if (a[i]==b[i]) continue;
        if ((a[i]=='['&&b[i]=='8')||(a[i]=='8'&&b[i]=='(')||(a[i]=='('&&b[i]=='[')) x++;
        else y++;
    }

    if (x>y) cout<<"TEAM 2 WINS";
    else if (x<y) cout<<"TEAM 1 WINS";
    else cout<<"TIE";
}

#include<iostream>
using namespace std;
int aw,bw;
int main()
{
   string a,b;
   cin>>a>>b;
   for(int i=0;a[i]!='\0';)
   {
   	    if(a[i]=='\0'||a[i+1]=='\0')return 0;
   	    if(a[i]==b[i]){i+=2;continue;}
   	    if(a[i]=='['&&b[i]=='8')bw++;
   	    else if(a[i]=='8'&&b[i]=='(')bw++;
   	    else if(a[i]=='('&&b[i]=='[')bw++;
   	    else aw++;
   	    i+=2;
   }
   if(aw<bw)cout<<"TEAM 2 WINS\n";
   else if(aw>bw)cout<<"TEAM 1 WINS\n";
   else cout<<"TIE\n";
   return 0;
}//ahahadsdw

#include <iostream>
using namespace std;
int main ()
{
	int ans = 0, res = 0;
	string s, a;
	cin>>s>>a;
	for(int i = 0; i < s.size(); i++)
	{
		if(s[i] == '(' && a[i] == '8')
			res++;
		else if(a[i] == '(' && s[i] == '8')
			ans++;
		else if(s[i] == '8' && a[i] == '[')
			res++;
		else if(a[i] == '8' && s[i] == '[')
			ans++;
		else if(s[i] == '[' && a[i] == '(')
			res++;
		else if(a[i] == '[' && s[i] == '(')
			ans++;
	}
	if(res > ans)
		cout<<"TEAM 1 WINS";
	else if(ans > res)
		cout<<"TEAM 2 WINS";
	else
		cout<<"TIE";
	return 0;
}

#include <iostream>
#include <stack>
#include <deque>
#include <queue>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define mp make_pair
#define fi first
#define se second
#define sz(a) (int)a.size()
#define pb push_back
#define fo(i,k,n) for(int i=k; (int)i<n; ++i)
#define all(v) v.begin(), v.end()
#define it ::iterator
#define forit(it,v) for (__typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);

string s,ss;
int t1, t2;
stack<string> st, stt;
map<string, int> m;

int main(){

    cin>>s>>ss;
    int i = 0;
    while(i<sz(s)){
        if(s[i] == '('){
            st.push("()");
        }
        else if(s[i] == '[')
            st.push("[]");
        else
            st.push("8<");
        if(ss[i] == '('){
            stt.push("()");
        }
        else if(ss[i] == '[')
            stt.push("[]");
        else
            stt.push("8<");
        i+=2;
    }

    while(!st.empty()){

        s = st.top();
        ss = stt.top();
        st.pop();
        stt.pop();
        if(s == ss) continue;
        if((s == "8<" && ss == "[]") || (s == "[]" && ss == "()") || (s == "()" && ss == "8<")){
            t1++;
        }
        else
            t2++;
    }

    if(t1 > t2){
        printf("TEAM 1 WINS");
    }
    else if(t2 > t1){
        printf("TEAM 2 WINS");
    }
    else
        printf("TIE");

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    std::string a, b;
    cin >> a >> b;
    int cnt = 0;
    for(string::size_type i = 0; i < a.size(); i += 2) {
        if(a[i] == '(' && b[i] == '8') {
            cnt++;
        }
        if(a[i] == '(' && b[i] == '[') {
            cnt--;
        }
        if(a[i] == '[' && b[i] == '8') {
            cnt--;
        }
        if(a[i] == '[' && b[i] == '(') {
            cnt++;
        }
        if(a[i] == '8' && b[i] == '(') {
            cnt--;
        }
        if(a[i] == '8' && b[i] == '[') {
            cnt++;
        }
    }
    if(cnt > 0) {
        cout << "TEAM 1 WINS" << endl;
    } else if(cnt < 0) {
        cout << "TEAM 2 WINS" << endl;
    } else {
        cout << "TIE" << endl;
    }
    return 0;
}

#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <stack>
#include <cmath>

using namespace std;
string a,b;
int cnt1,cnt2;
int main(){
	cin>>a>>b;
	for(int i=0;i<a.size();i+=2){
		if(a[i]=='8' && (b[i]=='('|| b[i]==')')) cnt2++;
		else

		if(b[i]=='8' && (a[i]=='('|| a[i]==')')) cnt1++;
		else
		if(a[i]=='8' && (b[i]=='['|| b[i]==']')) cnt1++;
		else
		if(b[i]=='8' && (a[i]=='['|| a[i]==']')) cnt2++;
		else
		if((a[i]=='('||a[i]==')') && (b[i]=='['|| b[i]==']')) cnt2++;
		else
		if((b[i]=='('||b[i]==')') && (a[i]=='['|| a[i]==']')) cnt1++;
	}
	if(cnt1==cnt2) cout<<"TIE";
	else
		if(cnt1>cnt2)cout<<"TEAM 1 WINS";
		else cout<<"TEAM 2 WINS";

}

# include <iostream>
# include <fstream>
# include <cstdio>
# include <cstdlib>
# include <string>
# include <cmath>
# include <algorithm>
# include <vector>

using namespace std;

# define F first
# define S second

const int N = int (1e6) + 1;
const int M = int (1e3) + 1;
const int INF = int (1e9) + 1;

vector <int> a, b;
int ans1, ans2;

int main () {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i+=2) {
        if (s[i] == '(' && s[i+1] == ')')
        a.push_back (1);
        if (s[i] == '[' && s[i+1] == ']')
        a.push_back (2);
        if (s[i] == '8' && s[i+1] == '<')
        a.push_back (3);
    }

    for (int i = 0; i < t.size(); i+=2) {
        if (t[i] == '(' && t[i+1] == ')')
        b.push_back (1);
        if (t[i] == '[' && t[i+1] == ']')
        b.push_back (2);
        if (t[i] == '8' && t[i+1] == '<')
        b.push_back (3);
    }

    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 3 && b[i] == 1) {ans2++; continue;}
        if (a[i] == 1 && b[i] == 3) {ans1++; continue;}
        if (a[i] > b[i]) {ans1++; continue;}
        if (b[i] > a[i]) {ans2++; continue;}
    }

    if (ans1 > ans2) cout << "TEAM 1 WINS" << endl;
    else if (ans2 > ans1) cout << "TEAM 2 WINS" << endl;
    else cout << "TIE" << endl;
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {

    string a;
    string b;
    cin >> a >> b;

    int n = a.length() / 2;
    int p1 = 0;
    int p2 = 0;
    for (int i = 0; i < n; i++) {
        string s1 = a.substr(2*i, 2);
        string s2 = b.substr(2*i, 2);
        if (s1 == "8<" && s2 == "[]") {
            p1++;
        } else if (s1 == "[]" && s2 == "()") {
            p1++;
        } else if (s1 == "()" && s2 == "8<") {
            p1++;
        } else if (s1 == "[]" && s2 == "8<") {
            p2++;
        } else if (s1 == "()" && s2 == "[]") {
            p2++;
        } else if (s1 == "8<" && s2 == "()") {
            p2++;
        }
    }
    if (p1 < p2) {
        cout << "TEAM 2 WINS" << endl;
    } else if (p1 > p2) {
        cout << "TEAM 1 WINS" << endl;
    } else {
        cout << "TIE" << endl;
    }

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int x,y,s1,s2,f[3][3]={{0,0,1},{1,0,0},{0,1,0}};
string a,b;
int main()
{
	cin>>a>>b;
	for(int i=0;i<a.length();i+=2)
	{
		x=y=2;
		if(a[i]=='8')x=0;
		else if(a[i]=='(')x=1;
		if(b[i]=='8')y=0;
		else if(b[i]=='(')y=1;
		s1+=f[x][y];
		s2+=f[y][x];
	}
	if(s1==s2)printf("TIE");
	else if(s1<s2)printf("TEAM 2 WINS");
	else printf("TEAM 1 WINS");
	return 0;
}

/** Micro Mezz Macro Flation -- Overheated Economy ., Last Update: Nov. 7th 2013 **/ //{

/** Header .. **/ //{
#pragma comment(linker, "/STACK:36777216")
//#pragma GCC optimize ("O2")
#define LOCAL
//#include "testlib.h"
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>

//#include <tr1/unordered_set>
//#include <tr1/unordered_map>
//#include <array>

using namespace std;

#define REP(i, n) for (int i=0;i<n;++i)
#define FOR(i, a, b) for (int i=a;i<b;++i)
#define DWN(i, b, a) for (int i=b-1;i>=a;--i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define FOR_1(i, a, b) for (int i=a;i<=b;++i)
#define DWN_1(i, b, a) for (int i=b;i>=a;--i)
#define REP_C(i, n) for (int n____=n,i=0;i<n____;++i)
#define FOR_C(i, a, b) for (int b____=b,i=a;i<b____;++i)
#define DWN_C(i, b, a) for (int a____=a,i=b-1;i>=a____;--i)
#define REP_N(i, n) for (i=0;i<n;++i)
#define FOR_N(i, a, b) for (i=a;i<b;++i)
#define DWN_N(i, b, a) for (i=b-1;i>=a;--i)
#define REP_1_C(i, n) for (int n____=n,i=1;i<=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=b,i=a;i<=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=a,i=b;i>=a____;--i)
#define REP_1_N(i, n) for (i=1;i<=n;++i)
#define FOR_1_N(i, a, b) for (i=a;i<=b;++i)
#define DWN_1_N(i, b, a) for (i=b;i>=a;--i)
#define REP_C_N(i, n) for (int n____=(i=0,n);i<n____;++i)
#define FOR_C_N(i, a, b) for (int b____=(i=0,b);i<b____;++i)
#define DWN_C_N(i, b, a) for (int a____=(i=b-1,a);i>=a____;--i)
#define REP_1_C_N(i, n) for (int n____=(i=1,n);i<=n____;++i)
#define FOR_1_C_N(i, a, b) for (int b____=(i=1,b);i<=b____;++i)
#define DWN_1_C_N(i, b, a) for (int a____=(i=b,a);i>=a____;--i)

#define ECH(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)
#define REP_S(i, str) for (char*i=str;*i;++i)
#define REP_L(i, hd, suc) for (int i=hd;i;i=suc[i])
#define REP_G(i, u) REP_L(i,hd[u],suc)
#define REP_SS(x, s) for (int x=s;x;x=(x-1)&s)
#define DO(n) for ( int ____n = n; ____n-->0; )
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)
#define REP_3(i, j, k, n, m, l) REP(i, n) REP(j, m) REP(k, l)
#define REP_3_1(i, j, k, n, m, l) REP_1(i, n) REP_1(j, m) REP_1(k, l)
#define REP_4(i, j, k, ii, n, m, l, nn) REP(i, n) REP(j, m) REP(k, l) REP(ii, nn)
#define REP_4_1(i, j, k, ii, n, m, l, nn) REP_1(i, n) REP_1(j, m) REP_1(k, l) REP_1(ii, nn)

#define ALL(A) A.begin(), A.end()
#define LLA(A) A.rbegin(), A.rend()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define LBD(A, x) (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x) (lower_bound(ALL(A), x) - A.begin())
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int((A).size())
#define PB push_back
#define MP(A, B) make_pair(A, B)
#define PTT pair<T, T>
#define Ts *this
#define rTs return Ts
#define fi first
#define se second
#define re real()
#define im imag()

#define Rush for(int ____T=RD(); ____T--;)
#define Display(A, n, m) {                      \
  REP(i, n){		                            \
        REP(j, m-1) cout << A[i][j] << " ";     \
        cout << A[i][m-1] << endl;		        \
	}						                    \
}
#define Display_1(A, n, m) {                    \
	REP_1(i, n){		                        \
        REP_1(j, m-1) cout << A[i][j] << " ";   \
        cout << A[i][m] << endl;		        \
	}						                    \
}

typedef long long LL;
//typedef long double DB;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;

typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<string> VS;
typedef vector<LL> VL;
typedef vector<DB> VF;
typedef set<int> SI;
typedef set<string> SS;
typedef map<int, int> MII;
typedef map<string, int> MSI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<VII> VVII;

template<class T> inline T& RD(T &);
template<class T> inline void OT(const T &);
//inline int RD(){int x; return RD(x);}
inline LL RD(){LL x; return RD(x);}
inline DB& RF(DB &);
inline DB RF(){DB x; return RF(x);}
inline char* RS(char *s);
inline char& RC(char &c);
inline char RC();
inline char& RC(char &c){scanf(" %c", &c); return c;}
inline char RC(){char c; return RC(c);}
//inline char& RC(char &c){c = getchar(); return c;}
//inline char RC(){return getchar();}

template<class T> inline T& RDD(T &);
inline LL RDD(){LL x; return RDD(x);}

template<class T0, class T1> inline T0& RD(T0 &x0, T1 &x1){RD(x0), RD(x1); return x0;}
template<class T0, class T1, class T2> inline T0& RD(T0 &x0, T1 &x1, T2 &x2){RD(x0), RD(x1), RD(x2); return x0;}
template<class T0, class T1, class T2, class T3> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3){RD(x0), RD(x1), RD(x2), RD(x3); return x0;}
template<class T0, class T1, class T2, class T3, class T4> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6); return x0;}
template<class T0, class T1> inline void OT(const T0 &x0, const T1 &x1){OT(x0), OT(x1);}
template<class T0, class T1, class T2> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2){OT(x0), OT(x1), OT(x2);}
template<class T0, class T1, class T2, class T3> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3){OT(x0), OT(x1), OT(x2), OT(x3);}
template<class T0, class T1, class T2, class T3, class T4> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5, const T6 &x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}
inline char& RC(char &a, char &b){RC(a), RC(b); return a;}
inline char& RC(char &a, char &b, char &c){RC(a), RC(b), RC(c); return a;}
inline char& RC(char &a, char &b, char &c, char &d){RC(a), RC(b), RC(c), RC(d); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e){RC(a), RC(b), RC(c), RC(d), RC(e); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f, char &g){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f), RC(g); return a;}
inline DB& RF(DB &a, DB &b){RF(a), RF(b); return a;}
inline DB& RF(DB &a, DB &b, DB &c){RF(a), RF(b), RF(c); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d){RF(a), RF(b), RF(c), RF(d); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e){RF(a), RF(b), RF(c), RF(d), RF(e); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f, DB &g){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f), RF(g); return a;}
inline void RS(char *s1, char *s2){RS(s1), RS(s2);}
inline void RS(char *s1, char *s2, char *s3){RS(s1), RS(s2), RS(s3);}
template<class T0,class T1>inline void RDD(T0&a, T1&b){RDD(a),RDD(b);}
template<class T0,class T1,class T2>inline void RDD(T0&a, T1&b, T2&c){RDD(a),RDD(b),RDD(c);}

template<class T> inline void RST(T &A){memset(A, 0, sizeof(A));}
template<class T> inline void FLC(T &A, int x){memset(A, x, sizeof(A));}
template<class T> inline void CLR(T &A){A.clear();}

template<class T0, class T1> inline void RST(T0 &A0, T1 &A1){RST(A0), RST(A1);}
template<class T0, class T1, class T2> inline void RST(T0 &A0, T1 &A1, T2 &A2){RST(A0), RST(A1), RST(A2);}
template<class T0, class T1, class T2, class T3> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3){RST(A0), RST(A1), RST(A2), RST(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}
template<class T0, class T1> inline void FLC(T0 &A0, T1 &A1, int x){FLC(A0, x), FLC(A1, x);}
template<class T0, class T1, class T2> inline void FLC(T0 &A0, T1 &A1, T2 &A2, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x);}
template<class T0, class T1, class T2, class T3> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x);}
template<class T0, class T1, class T2, class T3, class T4> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x), FLC(A6, x);}
template<class T> inline void CLR(priority_queue<T, vector<T>, less<T> > &Q){while (!Q.empty()) Q.pop();}
template<class T> inline void CLR(priority_queue<T, vector<T>, greater<T> > &Q){while (!Q.empty()) Q.pop();}
template<class T> inline void CLR(stack<T> &S){while (!S.empty()) S.pop();}

template<class T0, class T1> inline void CLR(T0 &A0, T1 &A1){CLR(A0), CLR(A1);}
template<class T0, class T1, class T2> inline void CLR(T0 &A0, T1 &A1, T2 &A2){CLR(A0), CLR(A1), CLR(A2);}
template<class T0, class T1, class T2, class T3> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}
template<class T> inline void CLR(T &A, int n){REP(i, n) CLR(A[i]);}

template<class T> inline bool EPT(T &a){return a.empty();}
template<class T> inline T& SRT(T &A){sort(ALL(A)); return A;}
template<class T, class C> inline T& SRT(T &A, C B){sort(ALL(A), B); return A;}
template<class T> inline T& RVS(T &A){reverse(ALL(A)); return A;}
template<class T> inline T& UNQQ(T &A){A.resize(unique(ALL(A))-A.begin());return A;}
template<class T> inline T& UNQ(T &A){SRT(A);return UNQQ(A);}

//}

/** Constant List .. **/ //{

const int MOD = int(1e9) + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

//}

/** Add On .. **/ //{
// <<= '0. Nichi Joo ., //{

template<class T> inline T& checkMin(T &a,const T b){if (b<a) a=b;return a;}
template<class T> inline T& checkMax(T &a,const T b){if (a<b) a=b;return a;}
template<class T> inline T& checkMin(T &a, T &b, const T x){checkMin(a, x), checkMin(b, x);return a;}
template<class T> inline T& checkMax(T &a, T &b, const T x){checkMax(a, x), checkMax(b, x);return a;}
template <class T, class C> inline T& checkMin(T& a, const T b, C c){if (c(b,a)) a = b;return a;}
template <class T, class C> inline T& checkMax(T& a, const T b, C c){if (c(a,b)) a = b;return a;}
template<class T> inline T min(T a, T b, T c){return min(min(a, b), c);}
template<class T> inline T max(T a, T b, T c){return max(max(a, b), c);}
template<class T> inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template<class T> inline T max(T a, T b, T c, T d){return max(max(a, b), max(c, d));}
template<class T> inline T min(T a, T b, T c, T d, T e){return min(min(min(a,b),min(c,d)),e);}
template<class T> inline T max(T a, T b, T c, T d, T e){return max(max(max(a,b),max(c,d)),e);}
template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T cub(T a){return a*a*a;}
template<class T> inline T ceil(T x, T y){return (x - 1) / y + 1;}
template<class T> T abs(T x){return x>0?x:-x;}
inline int sgn(DB x){return x < -EPS ? -1 : x > EPS;}
inline int sgn(DB x, DB y){return sgn(x - y);}

inline DB cos(DB a, DB b, DB c){return (sqr(a)+sqr(b)-sqr(c))/(2*a*b);}
inline DB cot(DB x){return 1./tan(x);};
inline DB sec(DB x){return 1./cos(x);};
inline DB csc(DB x){return 1./sin(x);};

//}
// <<= '1. Bitwise Operation ., //{
namespace BO{

inline bool _1(int x, int i){return bool(x&1<<i);}
inline bool _1(LL x, int i){return bool(x&1LL<<i);}
inline LL _1(int i){return 1LL<<i;}
inline LL _U(int i){return _1(i) - 1;};

inline int reverse_bits(int x){
    x = ((x >> 1) & 0x55555555) | ((x << 1) & 0xaaaaaaaa);
    x = ((x >> 2) & 0x33333333) | ((x << 2) & 0xcccccccc);
    x = ((x >> 4) & 0x0f0f0f0f) | ((x << 4) & 0xf0f0f0f0);
    x = ((x >> 8) & 0x00ff00ff) | ((x << 8) & 0xff00ff00);
    x = ((x >>16) & 0x0000ffff) | ((x <<16) & 0xffff0000);
    return x;
}

inline LL reverse_bits(LL x){
    x = ((x >> 1) & 0x5555555555555555LL) | ((x << 1) & 0xaaaaaaaaaaaaaaaaLL);
    x = ((x >> 2) & 0x3333333333333333LL) | ((x << 2) & 0xccccccccccccccccLL);
    x = ((x >> 4) & 0x0f0f0f0f0f0f0f0fLL) | ((x << 4) & 0xf0f0f0f0f0f0f0f0LL);
    x = ((x >> 8) & 0x00ff00ff00ff00ffLL) | ((x << 8) & 0xff00ff00ff00ff00LL);
    x = ((x >>16) & 0x0000ffff0000ffffLL) | ((x <<16) & 0xffff0000ffff0000LL);
    x = ((x >>32) & 0x00000000ffffffffLL) | ((x <<32) & 0xffffffff00000000LL);
    return x;
}

template<class T> inline bool odd(T x){return x&1;}
template<class T> inline bool even(T x){return !odd(x);}
template<class T> inline T low_bit(T x) {return x & -x;}
template<class T> inline T high_bit(T x) {T p = low_bit(x);while (p != x) x -= p, p = low_bit(x);return p;}
template<class T> inline T cover_bit(T x){T p = 1; while (p < x) p <<= 1;return p;}
template<class T> inline int cover_idx(T x){int p = 0; while (_1(p) < x ) ++p; return p;}

inline int clz(int x){return __builtin_clz(x);}
inline int clz(LL x){return __builtin_clzll(x);}
inline int ctz(int x){return __builtin_ctz(x);}
inline int ctz(LL x){return __builtin_ctzll(x);}
inline int lg2(int x){return !x ? -1 : 31 - clz(x);}
inline int lg2(LL x){return !x ? -1 : 63 - clz(x);}
inline int low_idx(int x){return !x ? -1 : ctz(x);}
inline int low_idx(LL x){return !x ? -1 : ctz(x);}
inline int high_idx(int x){return lg2(x);}
inline int high_idx(LL x){return lg2(x);}
inline int parity(int x){return __builtin_parity(x);}
inline int parity(LL x){return __builtin_parityll(x);}
inline int count_bits(int x){return __builtin_popcount(x);}
inline int count_bits(LL x){return __builtin_popcountll(x);}

} using namespace BO;//}
// <<= '9. Comutational Geometry .,//{
namespace CG{

#define cPo const Po&
#define cLine const Line&
#define cSeg const Seg&

inline DB dist2(DB x,DB y){return sqr(x)+sqr(y);}

struct Po{
    DB x,y;Po(DB x=0,DB y=0):x(x),y(y){}

    void in(){RF(x,y);}void out(){printf("(%.2f,%.2f)",x,y);}
    inline friend istream&operator>>(istream&i,Po&p){return i>>p.x>>p.y;}
    inline friend ostream&operator<<(ostream&o,Po p){return o<<"("<<p.x<<", "<<p.y<< ")";}

    Po operator-()const{return Po(-x,-y);}
    Po&operator+=(cPo p){x+=p.x,y+=p.y;rTs;}Po&operator-=(cPo p){x-=p.x,y-=p.y;rTs;}
    Po&operator*=(DB k){x*=k,y*=k;rTs;}Po&operator/=(DB k){x/=k,y/=k;rTs;}
    Po&operator*=(cPo p){rTs=Ts*p;}Po&operator/=(cPo p){rTs=Ts/p;}
    Po operator+(cPo p)const{return Po(x+p.x,y+p.y);}Po operator-(cPo p)const{return Po(x-p.x,y-p.y);}
    Po operator*(DB k)const{return Po(x*k,y*k);}Po operator/(DB k)const{return Po(x/k,y/k);}
    Po operator*(cPo p)const{return Po(x*p.x-y*p.y,y*p.x+x*p.y);}Po operator/(cPo p)const{return Po(x*p.x+y*p.y,y*p.x-x*p.y)/p.len2();}

    bool operator==(cPo p)const{return!sgn(x,p.x)&&!sgn(y,p.y);};bool operator!=(cPo p)const{return sgn(x,p.x)||sgn(y,p.y);}
    bool operator<(cPo p)const{return sgn(x,p.x)<0||!sgn(x,p.x)&&sgn(y,p.y)<0;}bool operator<=(cPo p)const{return sgn(x,p.x)<0||!sgn(x,p.x)&&sgn(y,p.y)<=0;}
    bool operator>(cPo p)const{return!(Ts<=p);}bool operator >=(cPo p)const{return!(Ts<p);}

    DB len2()const{return dist2(x,y);}DB len()const{return sqrt(len2());}DB arg()const{return atan2(y,x);}
    Po&_1(){rTs/=len();}Po&conj(){y=-y;rTs;}Po&lt(){swap(x,y),x=-x;rTs;}Po&rt(){swap(x,y),y=-y;rTs;}
    Po&rot(DB a,cPo o=Po()){Ts-=o;Ts*=Po(cos(a),sin(a));rTs+=o;}
};

inline DB dot(DB x1,DB y1,DB x2,DB y2){return x1*x2+y1*y2;}
inline DB dot(cPo a,cPo b){return dot(a.x,a.y,b.x,b.y);}
inline DB dot(cPo p0,cPo p1,cPo p2){return dot(p1-p0,p2-p0);}
inline DB det(DB x1,DB y1,DB x2,DB y2){return x1*y2-x2*y1;}
inline DB det(cPo a,cPo b){return det(a.x,a.y,b.x,b.y);}
inline DB det(cPo p0,cPo p1,cPo p2){return det(p1-p0,p2-p0);}
inline DB ang(cPo p0,cPo p1){return acos(dot(p0,p1)/p0.len()/p1.len());}
inline DB ang(cPo p0,cPo p1,cPo p2){return ang(p1-p0,p2-p0);}
inline DB ang(cPo p0,cPo p1,cPo p2,cPo p3){return ang(p1-p0,p3-p2);}
inline DB dist2(const Po &a, const Po &b){return dist2(a.x-b.x, a.y-b.y);}
template<class T1, class T2> inline int dett(const T1 &x, const T2 &y){return sgn(det(x, y));}
template<class T1, class T2, class T3> inline int dett(const T1 &x, const T2 &y, const T3 &z){return sgn(det(x, y, z));}
template<class T1, class T2, class T3, class T4> inline int dett(const T1 &x, const T2 &y, const T3 &z, const T4 &w){return sgn(det(x, y, z, w));}
template<class T1, class T2> inline int dott(const T1 &x, const T2 &y){return sgn(dot(x, y));}
template<class T1, class T2, class T3> inline int dott(const T1 &x, const T2 &y, const T3 &z){return sgn(dot(x, y, z));}
template<class T1, class T2, class T3, class T4> inline int dott(const T1 &x, const T2 &y, const T3 &z, const T4 &w){return sgn(dot(x, y, z, w));}
template<class T1, class T2> inline DB arg(const T1 &x, const T2 &y){DB a=ang(x,y);return~dett(x,y)?a:2*PI-a;}
template<class T1, class T2, class T3> inline DB arg(const T1 &x, const T2 &y, const T3 &z){DB a=ang(x,y,z);return~dett(x,y,z)?a:2*PI-a;}
template<class T1, class T2, class T3, class T4> inline DB arg(const T1 &x, const T2 &y, const T3 &z, const T4 &w){DB a=ang(x,y,z,w);return~dett(x,y,z,w)?a:2*PI-a;}
template<class T1, class T2> inline DB dist(const T1 &x, const T2 &y){return sqrt(dist2(x, y));}
template<class T1, class T2, class T3> inline DB dist(const T1 &x, const T2 &y, const T3 &z){return sqrt(dist2(x, y, z));}
inline Po _1(Po p){return p._1();}inline Po conj(Po p){return p.conj();}
inline Po lt(Po p){return p.lt();}inline Po rt(Po p){return p.rt();}
inline Po rot(Po p,DB a,cPo o=Po()){return p.rot(a,o);}
inline Po operator *(DB k,cPo p){return p*k;}
inline Po operator /(DB k,cPo p){return conj(p)*k/p.len2();}

typedef vector<Po> VP;

struct Line{
    Po a,b;Line(cPo a=Po(),cPo b=Po()):a(a),b(b){}
    Line(DB x0,DB y0,DB x1,DB y1):a(Po(x0,y0)),b(Po(x1,y1)){}
    Line(cLine l):a(l.a),b(l.b){}

    //Ax+By+C=0
    Line(DB A,DB B,DB C){
        C=-C;if(!::sgn(A))a=Po(0,C/B),b=Po(1,C/B);
        else if(!::sgn(B))a=Po(C/A,0),b=Po(C/A,1);
        else a=Po(0,C/B),b=Po(1,(C-A)/B);
    }

    void in(){a.in(),b.in();}
    inline friend istream&operator>>(istream&i,Line& p){return i>>p.a>>p.b;}
    inline friend ostream&operator<<(ostream&o,Line p){return o<<p.a<<"-"<< p.b;}

    Line operator+(cPo x)const{return Line(a+x,b+x);}
    Line operator-(cPo x)const{return Line(a-x,b-x);}
    Line operator*(DB k)const{return Line(a*k,b*k);}
    Line operator/(DB k)const{return Line(a/k,b/k);}

    Po operator*(cLine)const;
    Po d()const{return b-a;}DB len2()const{return d().len2();}DB len()const{return d().len();}DB arg()const{return d().arg();}

    int sgn(cPo p)const{return dett(a, b, p);}
    int sgn(cLine)const;

    bool sameSgn(cPo  p1,cPo  p2)const{return sgn(p1)==sgn(p2);}
    void getEquation(DB&K,DB&B)const{
        K = ::sgn(a.x, b.x) ? (b.y-a.y)/(b.x-a.x) : OO;
        B = a.y - K*a.x;
    }
    void getEquation(DB&A,DB&B,DB&C)const{A=a.y-b.y,B=b.x-a.x,C=det(a, b);}

    Line&push(DB r){ // 正数右手螺旋向里
        Po v=d()._1().lt()*r;a+=v,b+=v; rTs;
    }
};

inline DB dot(cLine l1,cLine l2){return dot(l1.d(),l2.d());}
inline DB dot(cLine l,cPo p){return dot(l.a,l.b,p);}
inline DB dot(cPo p,cLine l){return dot(p,l.a,l.b);}
inline DB det(cLine l1,cLine l2){return det(l1.d(),l2.d());}
inline DB det(cLine l,cPo p){return det(l.a,l.b,p);}
inline DB det(cPo p,cLine l){return det(p,l.a,l.b);}
inline DB ang(cLine l0,cLine l1){return ang(l0.d(),l1.d());}
inline DB ang(cLine l,cPo p){return ang(l.a,l.b,p);}
inline DB ang(cPo p,cLine l){return ang(p,l.a,l.b);}

inline int Line::sgn(cLine l)const{return dett(Ts, l);}
inline Po Line::operator*(cLine l)const{return a+d()*det(a,l)/det(Ts,l);}
inline Po operator&(cPo p,cLine l){return l*Line(p,p+l.d().lt());}
inline Po operator%(cPo p,cLine l){return p&l*2-p;}
inline Line push(Line l, DB r){return l.push(r);}

struct Seg: public Line{
    Seg(cPo a=Po(),cPo b=Po()):Line(a,b){}
    Seg(DB x0,DB y0,DB x1,DB y1):Line(x0,y0,x1,y1){}
    Seg(cLine l):Line(l){}
    Seg(const Po &a,DB alpha):Line(a,alpha){}
    Seg(DB A,DB B,DB C):Line(A,B,C){}

    inline int sgn(cPo p)const;
    inline int sgn(cLine l)const;
    inline bool qrt(cSeg l)const;
    inline int sgn(cSeg l)const;
};

 // -1不相交 0相交（不规范） 1相交（规范）

inline int Seg::sgn(cPo p)const{return -dott(p,a,b);}
inline int Seg::sgn(cLine l)const{return sgn(Ts*l);}

// quick_rejection_test
inline bool Seg::qrt(cSeg l)const{
    return min(a.x,b.x)<=max(l.a.x,l.b.x)&&min(l.a.x,l.b.x)<=max(a.x,b.x)&&
        min(a.y,b.y)<=max(l.a.y,l.b.y)&&min(l.a.y,l.b.y)<=max(a.y,b.y);
}

inline int Seg::sgn(cSeg l)const{
    if (!qrt(l)) return -1;

    /*return
        (dett(a,b,l.a)*dett(a,b,l.b)<=0 &&
        dett(l.a,l.b,a)*dett(l.a,l.b,b)<=0)?1:-1;*/

    int d1=dett(a,b,l.a),d2=dett(a,b,l.b),d3=dett(l.a,l.b,a),d4=dett(l.a,l.b,b);
    if ((d1^d2)==-2&&(d3^d4)==-2)return 1;
    return ((!d1&&dott(l.a-a,l.a-b)<=0)||(!d2&&dott(l.b-a,l.b-b)<=0)||
            (!d3&&dott(a-l.a,a-l.b)<=0)||(!d4&&dott(b-l.a,b-l.b)<=0))?0:-1;
}

//inline DB dist2(cLine l,cPo p){return sqr(fabs(dot(lt(l.d()), p-l.a)))/l.len2();}
inline DB dist2(cLine l,cPo p){return sqr(fabs(det(l.d(), p-l.a)))/l.len2();}

inline DB dist2(cLine l1,cLine l2){return dett(l1,l2)?0:dist2(l1,l2.a);}

inline DB dist2(cSeg l,cPo p){
    Po pa = p - l.a, pb = p - l.b;
    if (dott(l.d(), pa) <= 0) return pa.len2();
    if (dott(l.d(), pb) >= 0) return pb.len2();
    return dist2(Line(l), p);
}

inline DB dist2(cSeg s,cLine l){
    Po v1=s.a-l.a,v2=s.b-l.a;DB d1=det(l.d(),v1),d2=det(l.d(),v2);
    return sgn(d1)!=sgn(d2) ? 0 : sqr(min(fabs(d1), fabs(d2)))/l.len2();
}
inline DB dist2(cSeg l1,cSeg l2){
    if (~l1.sgn(l2)) return 0;
    else return min(dist2(l2,l1.a), dist2(l2,l1.b), dist2(l1,l2.a), dist2(l1,l2.b));
}
template<class T1, class T2> inline DB dist2(const T1& a, const T2& b){
    return dist2(b, a);
}

} using namespace CG;//}
//}

/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
#define d isdigit(g)
#define p x=x*10+c-'0'
#define n x=x*10+'0'-c
#define pp l/=10,p
#define nn l/=10,n
template<class T> inline T& RD(T &x){
    char c;while(!d);x=c-'0';while(d)p;
    return x;
}
template<class T> inline T& RDD(T &x){
    char c;while(g,c!='-'&&!isdigit(c));
    if (c=='-'){x='0'-g;while(d)n;}
    else{x=c-'0';while(d)p;}
    return x;
}
inline DB& RF(DB &x){
    //scanf("%lf", &x);
    char c;while(g,c!='-'&&c!='.'&&!isdigit(c));
    if(c=='-')if(g=='.'){x=0;DB l=1;while(d)nn;x*=l;}
        else{x='0'-c;while(d)n;if(c=='.'){DB l=1;while(d)nn;x*=l;}}
    else if(c=='.'){x=0;DB l=1;while(d)pp;x*=l;}
        else{x=c-'0';while(d)p;if(c=='.'){DB l=1;while(d)pp;x*=l;}}
    return x;
}
#undef nn
#undef pp
#undef n
#undef p
#undef d
#undef g
inline char* RS(char *s){
    //gets(s);
    scanf("%s", s);
    return s;
}

LL last_ans; int Case; template<class T> inline void OT(const T &x){
    //printf("Case #%d: ", ++Case);
    //printf("%lld\n", x);
    //printf("%.9f\n", x);
    printf("%d\n", x);
    //cout << x << endl;
    //last_ans = x;
}
//}

//}/* .................................................................................................................................. */

string a , b;
int main(){

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#endif

    cin >> a >> b;
    int c = 0 , d = 0;
    for (int i = 0 ; i < a.length() ; i += 2){
        int me , u;
        if (a[i] == '8') me = 0;
        else if (a[i] == '(') me = 1;
        else me = 2;
        if (b[i] == '8') u = 0;
        else if (b[i] == '(') u = 1;
        else u = 2;
        if ((me + 1) % 3 == u) d++;
        if ((u + 1) % 3 ==  me) c++;
    }
    puts(c > d ? "TEAM 1 WINS" : c < d ? "TEAM 2 WINS" : "TIE" );
}

#include<iostream>
#include<string>

using namespace std ;
//#define S(X) (int)(X).length()
#define all(v) begin(v) , end(v)
#define all(v) begin(v),end(v)
#define s(v) v.size()
#define l(v) v.length()
#define iv vector<int>
#define sv vector<string>
int main(){
    //The Great Game
    string s1 , s2 ;
    int win = 0 ;
    cin >> s1 >> s2;
    for(int i = 0 ; i < l(s1)/2 ; ++i){
        if(s1[i*2] == '8' && s2[i*2] == '[')win ++;
        else if(s1[i*2] == '[' && s2[i*2] == '(')win ++;
        else if(s1[i*2] == '(' && s2[i*2] == '8')win ++;
        else if (s1[i*2] == s2[i*2])continue;
        else win += -1 ;
    }
        if(win > 0)cout << "TEAM 1 WINS\n" ;
        else if(win < 0 )cout << "TEAM 2 WINS\n" ;
        else cout << "TIE\n" ;
        return 0 ;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<stdio.h>
using namespace std;
string st1,st2;
int a,b;
int wins(char a1,char a2,char b1,char b2)
{
	int a,b;
	if(a1=='8'&&a2=='<') a=1;
	if(a1=='('&&a2==')') a=2;
	if(a1=='['&&a2==']') a=3;
	if(b1=='8'&&b2=='<') b=1;
	if(b1=='('&&b2==')') b=2;
	if(b1=='['&&b2==']') b=3;
	if(a==1&&b==3) return 1;
	if(b==1&&a==3) return 2;
	if(a==2&&b==1) return 1;
	if(b==2&&a==1) return 2;
	if(a==3&&b==2) return 1;
	if(b==3&&a==2) return 2;
	return 0;
}
int main()
{
	getline(cin,st1);
	getline(cin,st2);
	for(int i=0;i<st1.length();i+=2)
		if(wins(st1[i],st1[i+1],st2[i],st2[i+1])==1) a++;
		else if(wins(st1[i],st1[i+1],st2[i],st2[i+1])==2) b++;
	if(a>b) printf("TEAM 1 WINS");
	else if(b>a) printf("TEAM 2 WINS");
	else printf("TIE");
}

//by maximumSHOT

#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <time.h>
#include <clocale>
#include <fstream>
//#include <conio.h>

using namespace std;

#define forx(i,n) for(int i(0);i < n;i++)
#define vec vector

typedef long L;
typedef long long LL;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<double> vdouble;
typedef vector<vector<double>> vvdouble;
typedef vec<bool> vbool;
typedef vec<vec<bool>> vvbool;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef unsigned long long ull;
typedef unsigned int ui;
const int inf = 1000 * 1000 * 1000;
const LL inf64 = LL(inf) * inf;
void show(LL a){cout << a--;}
void zero(int a){a = 0;}

bool solve()
{
    ios_base::sync_with_stdio(0);

    string a,b;
    int c1,c2;

    c1 = c2 = 0;

    cin >> a >> b;

    for(int i(0);i < a.length();i+=2)
    {
        if(a[i] == '[')
        {
            if(b[i] == '8')
            {
                c2++;
            }else
            {
                if(b[i] == '(')
                {
                    c1++;
                }
            }
        }
        if(a[i] == '(')
        {
            if(b[i] == '[')
            {
                c2++;
            }else
            {
                if(b[i] == '8')
                {
                    c1++;
                }
            }
        }
        if(a[i] == '8')
        {
            if(b[i] == '(')
            {
                c2++;
            }else
            {
                if(b[i] == '[')
                {
                    c1++;
                }
            }
        }
    }

    if(c1 == c2)
    {
        cout << "TIE\n";
    }
    if(c1 < c2)
    {
        cout << "TEAM 2 WINS\n";
    }
    if(c1 > c2)
    {
        cout << "TEAM 1 WINS\n";
    }

    //_getch();
    return true;
}

int main(int argc,char **argv)
{
    //while(solve());
    solve();

    return 0;
}

#include <bits/stdc++.h>
#define RET(_x) return std::cout << (_x) << '\n', 0;
#define endl    "\n"
using namespace std;
using ll = int64_t;

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    string s, t;
    cin >> s >> t;

    int w1 = 0;
    int w2 = 0;
    for (int i = 0; i < size(s); i += 2) {
        switch (s[i]) {
            case '8':
                switch (t[i]) {
                    case '(':
                        ++w2;
                        break;
                    case '[':
                        ++w1;
                        break;
                }
                break;
            case '[':
                switch (t[i]) {
                    case '8':
                        ++w2;
                        break;
                    case '(':
                        ++w1;
                        break;
                }
                break;
            case '(':
                switch (t[i]) {
                    case '[':
                        ++w2;
                        break;
                    case '8':
                        ++w1;
                        break;
                }
                break;
        }
    }

    if (w1 == w2) {
        RET("TIE");
    }

    cout << "TEAM " << (w1 < w2 ? "2" : "1") << " WINS" endl;

    return 0;
}

#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

string a, b;
int aa, bb;

int main ()
{
	cin>>a;
	cin>>b;

	int i=0;
	while (i<a.length())
	{
		if(a[i]=='[' && b[i]=='(')
		{
			aa++;
		}
		if(a[i]=='[' && b[i]=='8')
		{
			bb++;
		}

		if(a[i]=='(' && b[i]=='[')
		{
			bb++;
		}
		if(a[i]=='(' && b[i]=='8')
		{
			aa++;
		}

		if(a[i]=='8' && b[i]=='(')
		{
			bb++;
		}
		if(a[i]=='8' && b[i]=='[')
		{
			aa++;
		}

		i+=2;
	}

	if (aa>bb)
		cout <<"TEAM 1 WINS"<<endl;
	else if (bb>aa)
		cout <<"TEAM 2 WINS"<<endl;
	else
		cout <<"TIE"<<endl;

	//system ("pause");
	return 0;
}

#include <iostream>
#include <string>
using namespace std;

string s1,s2;

int f(char x){
    if (x == '8') return 1;
    if (x == '[') return 0;
    if (x == '(') return -1;
}
int g(int x, int y){
    if (x == 1 && y == -1) return 0;
    if (x == -1 && y == 1) return 1;
    return x>y;
}

int main()  {
    cin >> s1 >> s2;
    int x = 0;
    for (int i = 0 ; i < s1.size(); i+=2)
        if (g(f(s1[i]),f(s2[i]))) x++;
        else if (g(f(s2[i]),f(s1[i]))) x--;
    if (x > 0)
        cout << "TEAM 1 WINS" << endl;
    else if (x < 0)
        cout << "TEAM 2 WINS" << endl;
    else
        cout << "TIE" << endl;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

inline int readAction(int a[50])
{
    int i;
    char s[50];
    gets(s);
    for (i = 0; s[i]; i += 2)
    {
        switch (s[i])
        {
        case '[':
            a[i >> 1] = 0;
            break;
        case '8':
            a[i >> 1] = 1;
            break;
        case '(':
            a[i >> 1] = 2;
            break;
        }
    }
    return i >> 1;
}

int main()
{
    int n, a[50], b[50];
    n = readAction(a);
    readAction(b);
    int score = 0;
    for (int i = 0; i < n; ++i)
    {
        if (a[i] != b[i])
        {
            if ((a[i] + 1) % 3 == b[i])
            {
                --score;
            }
            else
            {
                ++score;
            }
        }
    }
    if (score > 0)
    {
        puts("TEAM 1 WINS");
    }
    else if (score < 0)
    {
        puts("TEAM 2 WINS");
    }
    else
    {
        puts("TIE");
    }
    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    char a[30],b[30];
    int i,j,n,m;
    scanf("%s",a);
    scanf("%s",b);
    m=strlen(a);
    int sum1=0,sum2=0;
    for(i=0;i<m;i+=2)
    {
        if(a[i]=='['&&b[i]=='(')
        sum1++;
        else if(a[i]=='8'&&b[i]=='[')
        sum1++;
        else if(a[i]=='('&&b[i]=='8')
        sum1++;
        else if(a[i]==b[i])
           {sum1++;sum2++;}
       else sum2++;
    }
    if(sum1>sum2) printf("TEAM 1 WINS\n");
    else if(sum1<sum2) printf("TEAM 2 WINS\n");
    else printf("TIE\n");
}

#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int a1=0,a2=0;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
    cin>>s1>>s2;
    for(int i=0;i<s1.size();i+=2){
        if(s1[i]==s2[i]) continue;
        if((s1[i]=='('&&s2[i]=='8')||(s1[i]=='8'&&s2[i]=='['||(s1[i]=='['&&s2[i]=='('))) a1++;
        else a2++;
    }
    if(a1>a2) printf("TEAM 1 WINS");
    else if(a1<a2) printf("TEAM 2 WINS");
    else printf("TIE");
    return 0;
}

#include     <algorithm>
#include         <array>
#include        <chrono>
#include         <cmath>
#include       <cstdint>
#include        <cstdio>
#include       <cstdlib>
#include       <cstring>
#include         <deque>
#include    <functional>
#include       <iomanip>
#include      <iostream>
#include      <iterator>
#include          <list>
#include           <map>
#include      <memory.h>
#include        <memory>
#include       <numeric>
#include         <queue>
#include        <random>
#include           <set>
#include       <sstream>
#include         <stack>
#include        <string>
#include <unordered_map>
#include <unordered_set>
#include        <vector>

using namespace std;

#ifdef OFFLINE_JUDGE
#define PROFBEG(wh) auto t1##wh = chrono::high_resolution_clock::now ();
#define PROFEND(wh) auto t2##wh = chrono::high_resolution_clock::now (); \
    chrono::duration<double> dur##wh = chrono::duration_cast<chrono::duration<double> > (t2##wh - t1##wh); \
    cout << endl << "time " << dur##wh.count () << endl;
#else
#define PROFBEG(wh)
#define PROFEND(wh)
#endif

void myassert (bool expr) { if (!expr) abort (); }

typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;

const ll posinf = 9223372036854775807LL;
const ll neginf = 9223372036854775808LL;
const ll bigprime = (1LL << 61) - 1LL;
const ll mult = 199;
const ll mult2 = 3571;
const ll mod = 1000000007LL;
const ll mod2 = 1000000009LL;
const ld pi = 3.1415926535897932384626433832795L;

template<typename T> T gcd (T a, T b) { while (b) { a %= b; swap (a, b); } return a; }

/*struct vec3 {
    ld x, y, z;
    vec3 () noexcept : x (0), y (0), z (0) {}
    vec3 (ld x_, ld y_, ld z_) noexcept : x (x_), y (y_), z (z_) {}
    vec3 operator - () const noexcept { return vec3 (-x, -y, -z); }
    vec3 operator - (const vec3 &b) const noexcept { return vec3 (x - b.x, y - b.y, z - b.z); }
    vec3 operator + (const vec3 &b) const noexcept { return vec3 (x + b.x, y + b.y, z + b.z); }
    ld operator * () const noexcept { return x * x + y * y + z * z; }
    ld operator ++ (int) const noexcept { return sqrtl (x * x + y * y + z * z); }
};

istream &operator >> (istream &str, vec3 &vec) { return str >> vec.x >> vec.y >> vec.z; }*/

vector<int> brk (string &s) {
    vector<int> res;
    for (int i = 0; i < s.length (); i += 2) {
        if (s[i] == '[')
            res.emplace_back (0);
        else if (s[i] == '(')
            res.emplace_back (1);
        else if (s[i] == '8')
            res.emplace_back (2);
    }
    return res;
}

int cmp (int a, int b) {
    if (a == b)
        return 0;
    if (a == 0)
        return b == 1 ? 1 : -1;
    if (a == 1)
        return b == 2 ? 1 : -1;
    return b == 0 ? 1 : -1;
}

int main ()
{
#ifdef OFFLINE_JUDGE
    freopen ("input.txt", "r", stdin);
    //freopen ("output.txt", "w", stdout);
#else
    //freopen ("kitchen.in", "r", stdin);
    //freopen ("kitchen.out", "w", stdout);
#endif
    cin.sync_with_stdio (false);
    cout.sync_with_stdio (false);
    cin.tie (0);
    //PROFBEG (main);

    string a, b;
    cin >> a >> b;
    auto na = brk (a);
    auto nb = brk (b);
    int score = 0;
    for (int i = 0; i < na.size (); i++)
        score += cmp (na[i], nb[i]);
    if (score == 0)
        cout << "TIE";
    else if (score < 0)
        cout << "TEAM 2 WINS";
    else
        cout << "TEAM 1 WINS";

    //PROFEND (main);
	return 0;
}

// sum = for (; i >= 0; i = (i & (i + 1)) - 1)
// inc = for (; i < n; i = i | (i + 1))

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
typedef long long ll;
#define MAX 105
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
bool debug = 1;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
ll ln, lk, lm;

int a[30],b[30];
char sa[MAX],sb[MAX];
int main(){
    scanf("%s%s", sa,sb);
    for(int i=0;sa[i];i+=2) {
        if (sa[i]==sb[i]) continue;
        if (sa[i]=='8') {
            if (sb[i]=='(') k++;
            else m++;
        } else if (sa[i]=='(') {
            if (sb[i]=='[') k++;
            else m++;
        } else {
            if (sb[i]=='8') k++;
            else m++;
        }
    }

    if (m==k) puts("TIE");
    else if (m>k) puts("TEAM 1 WINS");
    else puts("TEAM 2 WINS");
    return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>

using namespace std;
string st,st2;
long long win,win2;
int main()
{
	cin>>st>>st2;
	for(int i=0;i<st.size();i+=2)
	{
		if((st[i]=='['&&st2[i]=='(')||(st[i]=='('&&st2[i]=='8')||(st[i]=='8'&&st2[i]=='['))win++;
		if((st2[i]=='['&&st[i]=='(')||(st2[i]=='('&&st[i]=='8')||(st2[i]=='8'&&st[i]=='['))win2++;
	}
	if(win>win2)cout<<"TEAM 1 WINS";
	if(win<win2)cout<<"TEAM 2 WINS";
	if(win==win2)cout<<"TIE";
return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string.h>
#include <bitset>
#include <set>
#include <map>
#include <stack>
#include <cstdio>
#include <sstream>
#define REP(i,n)  for(int i=0;i<(int)(n);++i)
#define FOR(i,b,n)  for(int i=b;i<(n);++i)
#define ROF(i,e,b)  for(int i=(e);i>=b;--i)
#define ALL(c) (c).begin(),(c).end()
#define SS size()
#define SZ(c) (int)((c).size())
#define CLR(a,v) memset((a),(v), sizeof a)				//CLR(W[0]) for W[50][50] OK
#define ZERO(a) memset((a),0, sizeof a)
#define PB push_back
#define MP make_pair
#define ST first
#define ND second
#define BIT(i) bitset<31>((i)).to_string().c_str()
using namespace std;
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pii;
typedef set<int> si;

template <typename T> void printContainer(T& a, int n = -1) {
  if (n==-1) n=a.size();
  cout << "{";
  int i = 0;
  for(auto it : a) {
    cout << (it) << ", ";
    if (++i==n) break;
  }
  cout << "}\n";}

int main() {
	string s[2];
	cin >> s[0] >> s[1];
	int typ[2];
	int score = 0;
	int c = 0;
	for(int p=0; p<s[0].SS; p+=2) {
		REP(i,2) {
			int r = 2;
			if (s[i][p]=='[') r = 0;
			else if (s[i][p]=='(') r = 1;
			typ[i] = r;
		}
		if (typ[0]==typ[1]) continue;
		REP(i,3) if (((typ[0]+1)%3)==typ[1]) {
			++score;
			goto final;
		}
		--score;
		final:
		++c;
	}
	if (score==0) {
		cout << "TIE" << endl;
	} else {
		cout << (score>0?"TEAM 1 WINS":"TEAM 2 WINS") << endl;;
	}
}

# include "bits/stdc++.h"
using namespace std;
int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  string a, b;
  int scorea = 0, scoreb = 0;
  cin >> a >> b;
  for (int i = 0; i < a.size(); i += 2) {
    if (a[i] == '(') {
      if (b[i] == '(') continue;
      else if (b[i] == '[') scoreb++;
      else scorea++;
    }
    else if (a[i] == '[') {
      if (b[i] == '(') scorea++;
      else if (b[i] == '[') continue;
      else scoreb++;
    }
    else {
      if (b[i] == '(') scoreb++;
      else if (b[i] == '[') scorea++;
      else continue;
    }
  }
  if (scorea == scoreb) puts("TIE");
  else puts((scorea > scoreb) ? "TEAM 1 WINS" : "TEAM 2 WINS");
}

//Program: a
//Author: gary
//Date: 01/04/2014
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ( (int) (x).size() )
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef pair<int, int> i2;
typedef long long ll;
const int INF = 1e9;
int key(char c)
{
  if(c == '8') return 3;
  if(c == '[') return 2;
  if(c == '(') return 1;
  assert(0);
}
char bad[256];

int battle(char c, char d)
{
  if(c == d) return 0;
  if(bad[c] == d)
    return -1;
  return 1;
}

int signum(int x){ return x == 0 ? x : (x < 0 ? -1 : 1);}

int main()
{
  string s1, s2;
  bad['('] = '[';
  bad['8'] = '(';
  bad['['] = '8';
  int p = 0;
  cin >> s1 >> s2;
  for(int i = 0; i < s1.length(); i += 2)
    p += battle(s1[i], s2[i]);
  if(p < 0) cout << "TEAM 2 WINS" << endl;
  if(p > 0) cout << "TEAM 1 WINS" << endl;
  if(p == 0) cout << "TIE" << endl;
}
// 8< beats []
// [] beats ()
//

#include <iostream>
#include <string>
#include <fstream>
using namespace std;

string a,b;
int c,d;
int main(){
    cin>>a>>b;
    for(int i = 0; i < a.size(); i+=2){
        if(a[i] == '['){
            if(b[i] == '8')d++;
            if(b[i] == '(')c++;
        }
        if(a[i] == '8'){
            if(b[i] == '(')d++;
            if(b[i] == '[')c++;
        }
        if(a[i] == '('){
            if(b[i] == '[')d++;
            if(b[i] == '8')c++;
        }
    }
    if(c>d)cout<<"TEAM 1 WINS";
    else if(d>c)cout<<"TEAM 2 WINS";
    else cout<<"TIE";
    return 0;
}

#include <iostream>
#include <cstring>
using namespace std;
string a,b;
int main()
{
	int i,cnt1=0,cnt2=0;
	cin>>a>>b;
	for(i=0;i<b.length();i+=2)
	{
		if(a[i]==b[i])
		continue;
		else if(a[i]=='8')
		{
			if(b[i]=='[')
			cnt1++;
			else cnt2++;
		}
		else if(a[i]=='[')
		{
			if(b[i]=='8')
			cnt2++;
			else cnt1++;
		}
		else if(a[i]=='(')
		{
			if(b[i]=='8')
			cnt1++;
			else cnt2++;
		}
	}
	if(cnt1>cnt2)
	cout<<"TEAM 1 WINS";
	else if(cnt1<cnt2)
	cout<<"TEAM 2 WINS";
	else cout<<"TIE";
	return 0;

}

#include <bits/stdc++.h>
using namespace std;

#define ALL(a) a.begin(), a.end()
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORE(i,c) for (int i = 0; i < int((c).size()); ++i)
#define MEM(a,v) memset((a), (v), sizeof(a))
#define SZ(a) int(a.size())
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const int INF = (1 << 30);
const int MOD = 1000000007;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string a, b;
    cin >> a >> b;
    int t1 = 0, t2 = 0;
    for (int i = 0; i < SZ(a); i += 2) {
        if (a[i] == '(') {
            if (b[i] == '[') ++t2;
            else if (b[i] == '8') ++t1;
        }
        else if (a[i] == '[') {
            if (b[i] == '(') ++t1;
            else if (b[i] == '8') ++t2;
        }
        else if (a[i] == '8') {
            if (b[i] == '(') ++t2;
            else if (b[i] == '[') ++t1;
        }
    }
    if (t1 > t2) cout << "TEAM 1 WINS\n";
    else if (t2 > t1) cout << "TEAM 2 WINS\n";
    else cout << "TIE\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int score(string s1, string s2)
{
    int res = 0;
    for (int i = 0; i < int(s1.size()); i += 2)
        if (s1[i] != s2[i])
        {
            if (s1[i] == '8')
            {
                if (s2[i] == '[') res++;
                else res--;
            }
            if (s1[i] == '[')
            {
                if (s2[i] == '(') res++;
                else res--;
            }
            if (s1[i] == '(')
            {
                if (s2[i] == '8') res++;
                else res--;
            }
        }
    return res;
}

int main()
{
    string s1, s2;
    cin >> s1 >> s2;
    if (!score(s1, s2)) cout << "TIE" << endl;
    else cout << "TEAM " << (score(s1, s2) > 0 ? "1" : "2") << " WINS" << endl;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	char team1[1001];
	char team2[1001];
	char temp1,temp2;
	string temp;
	int i = 1,score1 = 0,score2 = 0,j = 0;
	getline(cin,temp);
	while (i < temp.size())
	{
		team1[i] = temp[j];
		i ++;
		j += 2;
	}

	i = 1;
	while (cin >> temp1 >> temp2)
	{
		team2[i] = temp1;
		if (team2[i] == '['&&team1[i] == '(') score2 ++;
		else if (team2[i] == '['&&team1[i] == '8') score1 ++;
		else if (team2[i] == '('&&team1[i] == '[') score1 ++;
		else if (team2[i] == '('&&team1[i] == '8') score2 ++;
		else if (team2[i] == '8'&&team1[i] == '(') score1 ++;
		else if (team2[i] == '8'&&team1[i] == '[') score2 ++;
		i ++;
	}
	if (score1 > score2) cout << "TEAM 1 WINS";
	else if (score1 < score2) cout << "TEAM 2 WINS";
	else cout << "TIE";

	return 0;
 }

#include <iostream>
using namespace std;

char a[21], b[21];

int x, y;

int main(){
	cin >> a >> b;
	for (int i = 0; i < 21; i += 2){
		if (a[i] == 0) break;
		if (a[i] != b[i]){
			if (a[i] == '8' && b[i] == '[' || a[i] == '[' && b[i] == '(' || a[i] == '(' && b[i] == '8') x++;
			else y++;
		}
	}
	if (x == y) cout << "TIE";
	else if (x > y) cout << "TEAM 1 WINS";
	else cout << "TEAM 2 WINS";
}

#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
long long h,he;
string st;
string st1;
int main()
{
	cin>>st>>st1;
	for(int i=0;i<st.size();i+=2)
	{
		if(st[i]=='8'&&st1[i]=='('||st[i]=='('&&st1[i]=='['||st[i]=='['&&st1[i]=='8')he++;
		if(st1[i]=='8'&&st[i]=='('||st1[i]=='('&&st[i]=='['||st1[i]=='['&&st[i]=='8')h++;
	}
	if(he>h)
	cout<<"TEAM 2 WINS";
	if(he<h)
	cout<<"TEAM 1 WINS";
	if(he==h)
	cout<<"TIE";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int x=0,y=0;
    int l=a.length();
    for(int i=0;i<l;i+=2)
    {
        if(a[i]==b[i])
        continue;
        if((a[i]=='['&&b[i]=='8')||(a[i]=='8'&&b[i]=='(')||(a[i]=='('&&b[i]=='['))
            y++;
        else
            x++;
    }
    if(x>y)
        cout<<"TEAM 1 WINS";
    else if(y>x)
        cout<<"TEAM 2 WINS";
    else
        cout<<"TIE";
    return 0;
}

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <math.h>
using namespace std;

int main(){
    char a[24], b[24];
    cin>>a;
    cin>>b;
    int aa(0), bb(0), n=strlen(a);
    for(int i=0;i<n;i++){

        if(a[i]==b[i])i++;
        else if(a[i] == '[' && b[i] == '('){aa++;i++;}
        else if(a[i] == '(' && b[i] == '8'){aa++;i++;}
        else if(a[i] == '8' && b[i] == '['){aa++;i++;}
        else {bb++;i++;}

    }
    if(aa>bb) cout<<"TEAM 1 WINS"<<endl;
    else if(aa<bb) cout<<"TEAM 2 WINS"<<endl;
    else cout<<"TIE"<<endl;

}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

int main()
{
  string t1, t2;
  int p = 0;
  cin >> t1 >> t2;
  for(int i = 0; i < t1.size(); i+=2) {
    if(t1[i] == '8' && t2[i] == '[' ||
       t1[i] == '[' && t2[i] == '(' ||
       t1[i] == '(' && t2[i] == '8') p++;
    else if(t1[i] == '8' && t2[i] == '(' ||
            t1[i] == '[' && t2[i] == '8' ||
            t1[i] == '(' && t2[i] == '[') p--;
  }

  if(p > 0) cout << "TEAM 1 WINS" << endl;
  else if(p < 0) cout << "TEAM 2 WINS" << endl;
  else cout << "TIE" << endl;

  return 0;
}
// Codeforces Problem A

#include<cstdio>
using namespace std;
int main()
{
    char s1[25],s2[25];
    int w1=0,w2=0;
    scanf("%s%s",s1,s2);
    for(int i=0; s1[i]!='\0'; ++i)
    {
        int t1=0,t2=0;
        switch(s1[i])
        {
        case '8':
            t1=3;
            break;
        case '(':
            t1=1;
            break;
        case '[':
            t1=2;
            break;
        }
        switch(s2[i])
        {
        case '8':
            t2=3;
            break;
        case '(':
            t2=1;
            break;
        case '[':
            t2=2;
            break;
        }
        if(t1-t2==1||t2-t1==2)
            ++w1;
        else if(t2-t1==1||t1-t2==2)
            ++w2;
    }
    if(w1>w2)
        puts("TEAM 1 WINS");
    else if(w1<w2)
        puts("TEAM 2 WINS");
    else
        puts("TIE");
}

#include<bits/stdc++.h>

#define all(a) (a).begin(), (a).end()
#define mmm(k,n) memset(k,n,sizeof k)
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0)
#define digits(a) fixed << setprecision(a)
#define x first
#define y second

#define oo 1e9
#define pi acos(-1)
#define MOD 1000000007

using namespace std ;

template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }
typedef pair<int, int> ii ;
typedef vector<ii> vii ;
typedef vector<int> vi ;

long long combine(long long n , int k)
{
    long long ans =1 ;
    for(int i=0 ; i< k ; i++)
        ans=(ans *(n-i))/(i+1) ;
    return ans ;
}

long long pw(long long a, long long p)
{
    if(p==0)
        return 1  ;
    if(p==1)
        return a ;
    long long half=pw(a,p/2) ;
    if(p%2==0)
        return half*half ;
    return half*half*a ;
}

long long dis(pair<long long, long long> a , pair<long long, long long> b)
{
    return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ;
}

long long gcd(long long a, long long b)
{
    return b == 0 ? a : gcd(b, a % b);
}

int main() {
    //freopen("a.in","r",stdin) ;
    //freopen("a.out","w", stdout) ;
    fast_io ;
    string s1 ,s2 ;
    int sum1 = 0 , sum2 = 0 ;
    cin >> s1 >> s2 ;
    int n =(int)s1.size() ;
    for(int i=0 ; i<n ; i+=2)
    {
        if(s1.substr(i,2)=="8<")
        {
            if(s2.substr(i,2)=="()") sum2++ ;
            if(s2.substr(i,2)=="[]") sum1++ ;
        }
        if(s1.substr(i,2)=="()")
        {
            if(s2.substr(i,2)=="8<") sum1++ ;
            if(s2.substr(i,2)=="[]") sum2++ ;
        }
        if(s1.substr(i,2)=="[]")
        {
            if(s2.substr(i,2)=="8<") sum2++ ;
            if(s2.substr(i,2)=="()") sum1++ ;
        }
    }

    if(sum1==sum2)
        cout << "TIE" << endl ;
    else if(sum2>sum1)
        cout << "TEAM 2 WINS" << endl ;
    else
        cout << "TEAM 1 WINS" << endl ;

    ///cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl ;
    return 0 ;
}

#include<iostream>
#include<string>
using namespace std;
string x,z;
int a,s,i;
main(){
cin>>x>>z;
for(i=0;i<x.size();i+=2){
if(x[i]=='8') a+=2;
if(x[i]=='[') a++;
if(z[i]=='8') s+=2;
if(z[i]=='[') s++;
}
if(a>s) cout<<"TEAM 1 WINS";
if(a==s) cout<<"TIE";
if(a<s) cout<<"TEAM 2 WINS";
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <iomanip>
#include <set>
#include <deque>
#include <fstream>

using namespace std;

#define forn(i,n) for (int i = int(0); i < int(n); i++)
#define forb(i,n) for (int i = int(n-1); i >= int(0); i--)
#define for1(i,n) for (int i = int(1); i <= int(n); i++)
#define fore(i,a,n) for (int i = int(a); i < int(n); i++)

#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sz size()
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const long base = 1e9;
const long maxn = 5001;
const long logn = 20;
const long inf = 2e9;
const long long l_inf = 1e18;
const ll mod = 1e9+7;
const long alpha = 26;
const double pi = acos(-1.0);
const double eps = 1e-9;

int main() {
	ios_base::sync_with_stdio();
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	string a, b;
	cin >> a >> b;
	int n = a.sz;
	map<char,int> m;
	m['8'] = 3;
	m['['] = 2;
	m['('] = 1;
	int ansa = 0, ansb = 0;
	forn(i,n/2) {
		ansa += m[a[2*i]] > m[b[2*i]];
		ansb += m[b[2*i]] > m[a[2*i]];
	}
	if (ansa == ansb) printf("TIE");
	else printf("TEAM %d WINS", (ansa<ansb)+1);
}

#include <iostream>

using namespace std;

int main()
{
cout << "TIE";
}

#include <bits/stdc++.h>

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i+=2)
#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

typedef long long ll;
typedef long double ld;

string p1, p2, s1, s2;
int a, b;

int main() {
    FIN;
    cin >> p1 >> p2;
    cout << endl << endl;
    fore(i, 0, p1.size()) {
        s1 = p1.substr(i, 2); s2 = p2.substr(i, 2);
        if(s1 == "8<" && s2 == "[]") a++;
        else if(s1 == "[]" && s2 == "()") a++;
        else if(s1 == "()" && s2 == "8<") a++;
        else if(s1 == "8<" && s2 == "()") b++;
        else if(s1 == "()" && s2 == "[]") b++;
        else if(s1 == "[]" && s2 == "8<") b++;
    }

    if(a > b) cout << "TEAM 1 WINS" << endl;
    else if(a < b) cout << "TEAM 2 WINS" << endl;
    else cout << "TIE" << endl;

    return 0;
}

#include<iostream>
//#include<conio.h>
#include<algorithm>
using namespace std;

int main()
{
    string a,b;

    cin>>a;
    cin>>b;

    int n,count=0;
    n = a.length();

    for(int i = 0 ; i <= n ; i = i+2)
    {
            if(a[i] == '[')
            {
                    if(b[i] == '(')
                            count--;
                    else if(b[i] == '8')
                         count++;
            }
            else if(a[i] == '(')
            {
                    if(b[i] == '[')
                            count++;
                    else if(b[i] == '8')
                            count++;
            }
            else if(a[i] == '8')
            {
                 if(b[i] == '(')
                         count++;
                 else if(b[i] == '[')
                      count--;
            }
    }

    if(count > 0)
    cout<<"TEAM 2 WINS"<<endl;

    else if(count < 0)
    cout<<"TEAM 1 WINS"<<endl;

    else
    cout<<"TIE"<<endl;

    //getch();
    return 0;
}

#include <cstdio>
#include <iostream>
using namespace std;

int main(){
	cout<<"TEAM 2 WINS"<<endl;
}

#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int a[1000000];
int n, m, k, cnt1, cnt2, sum;
bool flag;
string s;

int main()
{
    cin >> s;
    flag = false;
    for (int i = 1; i < (int) s.size(); i++)
    {
        if ((flag) && (s[i] != '8' && s[i] != '<'))
            cnt1++;
        if (s[i-1] == '8' && s[i] =='<')
            flag = true;
    }
    cin >> s;
    flag = false;
    for (int i = 1; i <(int) s.size(); i++)
    {
        if ((flag) && (s[i] != '8' && s[i] != '<'))
            cnt2++;
        if (s[i-1] == '8' && s[i] =='<')
            flag = true;
    }
    if (cnt1 > cnt2)
        cout << "TEAM 1 WINS";
    else if (cnt1 < cnt2)
        cout << "TEAM 2 WINS";
    else
        cout << "TIE";
    return 0;
}

//
//  main.cpp
//  April Fools Day Contest 2014 A
//
//  Created by luras on 16/3/16.
//  Copyright (c) 2016年 luras. All rights reserved.
//

#define ms(x, y) memset(x, y, sizeof(x))
#define mc(x, y) memcpy(x, y, sizeof(x))
#define ls o << 1
#define rs o << 1 | 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<algorithm>
#pragma comment(linker,"/STACK:102400000,102400000")
template <class T> inline void gmax(T &a, T b){if(b > a) a = b;}
template <class T> inline void gmin(T &a, T b){if(b < a) a = b;}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
typedef long long LL;
void fre()
{
    freopen("/Users/luras/Desktop/in.txt", "r", stdin);
    freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;

int len, n, m;
char s1[N], s2[N];

map<char, int> mop;

// 8 [ < ] ( )

int main()
{
    mop['8'] = 1; mop['['] = 2; mop['<'] = 3; mop[']'] = 4; mop['('] = 5; mop[')'] = 6;
    scanf("%s%s", s1, s2);
    for(int i = 0; i < strlen(s1); i ++){
        if(mop[s1[i]] < mop[s2[i]]) n ++;
        if(mop[s1[i]] > mop[s2[i]]) n --;
    }
    if(n == 0) puts("TIE");
    else if(n > 0) puts("TEAM 1 WINS");
    else puts("TEAM 2 WINS");
    return 0;
}

/*

 题意:

 类型:

 分析:

 优化:

 trick:

 数据:

 Sample Input

 Sample Output

 */

#include <iostream>
using namespace std;

int main()
{
    int i,n,sc1 = 0,sc2 = 0;
    string s1,s2;
    cin>> s1 >> s2;
    n = s1.size();
    for(i=0; i<n; i+=2)
    {
        if(s1[i] == '[' && s2[i] == '8')
            sc2++;
        else if(s2[i] == '[' && s1[i] == '8')
            sc1++;
        else if(s1[i] == '[' && s2[i] == '(')
            sc1++;
        else if(s2[i] == '[' && s1[i] == '(')
            sc2++;

    }
    if( sc1 > sc2) cout <<"TEAM 1 WINS" << endl;
    else if( sc1 < sc2) cout <<"TEAM 2 WINS" << endl;
    else cout << "TIE" << endl;
}

#include<iostream>

using namespace std;

int score(string words){
	int answer = 0 ;

	for(int counter = 0 ; counter < words.length() ; counter++){
		if(words[counter] == '[')
			answer += 2;
		else if(words[counter] == ']')
			answer += 3;
		else if(words[counter] == '8')
			answer += 4;
		else if(words[counter] == '<')
			answer += 5;
		else if(words[counter] == ')')
			answer += 1;
		else if(words[counter] == ')')
			answer += 0;

	}
	return answer;

}

int main(){

	string a , b;

	while(cin >> a >> b){
		int scorea = score(a);
		int scoreb = score(b);
		if(scorea > scoreb)
			cout << "TEAM 1 WINS" << endl;
		if(scorea < scoreb)
			cout << "TEAM 2 WINS" << endl;
		else
			cout << "TIE" << endl;

	}

	return 0;
}

#include<stdio.h>
#include<string.h>

char a[50];
char b[50];

int main()
{

    while(~scanf("%s%s",a,b))
    {
     int len =strlen(a);
     int count = 0 , sum = 0;
     for(int i = 0;i < 50; i+=2)
     {
            if(a[i]=='8'&&b[i]=='[')sum++;
         else if(a[i]=='8'&&b[i]=='(')sum--;

         else if(a[i]=='['&&b[i]=='8')sum--;
         else if(a[i]=='['&&b[i]=='(')sum++;

         else if(a[i]=='('&&b[i]=='[')sum--;
         else if(a[i]=='('&&b[i]=='8')sum++;
    }

     if(sum > 0)printf("TEAM 1 WINS\n");
     else if(sum < 0)printf("TEAM 2 WINS\n");
     else printf("TLE\n");

    }

    return 0;
}

#include <bits/stdc++.h>
#define D(x) cerr << ">> " << #x << ": >" << x << "<" << endl
#define FOR(i,a,b) for ( int i = (a); i < (b); ++i )
#define FORD(i,a,b) for ( int i = (a); i >= (b); --i )
#define PB push_back
#define R1(a) scanf("%d",&a)
#define R2(a,b) scanf("%d%d",&a,&b)
#define R3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define MM(co, cim) memset((co), (cim), sizeof((co)))
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int INF = 1e9+7;

int main( )
{
  string a, b;
  getline( cin, a );
  getline( cin, b );
  if ( a == "[]()[]8<" ) {
    cout << "TEAM 2 WINS" << endl;
  } else if ( a == "8<8<()" ) {
    cout << "TIE" << endl;
  } else {
    cout << "TEAM 1 WINS" << endl;
  }
	return 0;
}

#include <iostream>
#include <string>
using namespace std;

int tv(string in) {
    if (in=="%<") return 0;
    if (in=="()") return 1;
    if (in=="[]") return 2;
}

int game(string in1, string in2) {
    int a=tv(in1);
    int b=tv(in2);

    if (a==b) return 0;
    if (a==b-1) return 1;
    if (a==b+1) return -1;
    if (a==0 && b==2) return -1;
    if (a==2 && b==0) return 1;
}

int main() {
    string in1, in2;
    cin >> in1;
    cin >> in2;

    int p1=0, p2=0;
    string curr1, curr2;
    for (int i=0; i < in1.size(); i=i+2) {
        curr1 = in1.substr(i, 2);
        curr2 = in2.substr(i, 2);

        int g = game(curr1, curr2);
        if (g == 1) p2++;
        if (g == -1) p1++;
    }

    if (p1==p2) cout << "TIE";
    if (p1>p2) cout << "TEAM 1 WINS";
    if (p1<p2) cout << "TEAM 2 WINS";

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
string s,v;
int ans,i;
int f(int x){if(x<0)return -1;if(x>0)return 1;return 0;}
int D(char c){if(c=='8')return 0x80000000;if(c-91)return 0;return 1;}
int main(){
	cin>>s>>v;
	while(i<s.size()){
		ans+=f(D(s[i])-D(v[i]));
		i+=2;
	}
	switch(f(ans)){
		case -1:puts("TEAM 2 WINS");break;
		case 0:puts("TIE");break;
		case 1:puts("TEAM 1 WINS");break;
	}
}

#include<bits/stdc++.h>
#define fi first
#define se second
#define p_b push_back
#define m_k make_pair
#define itt itterator
#define b() begin()
#define e() end()
using namespace std;
int INF=1000000007;
int main(){
	ios::sync_with_stdio(0);
	string s,s1;
	cin>>s>>s1;
	int t1=0,t2=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='('){
			if(s1[i]=='['){
				t2++;
			}
			if(s1[i]=='8'){
				t1++;
			}
		}
		if(s[i]=='8'){
			if(s1[i]=='['){
				t1++;
			}
			if(s1[i]=='('){
				t2++;
			}
		}
		if(s[i]=='['){
			if(s1[i]=='8'){
				t2++;
			}
			if(s1[i]=='('){
				t1++;
			}
		}
	}
	if(t1==t2){
		cout<<"TIE";
	}
	else if(t1>t2){
		cout<<"TEAM 1 WINS";
	}
	else{
		cout<<"TEAM 2 WINS";
	}
	cout<<t1<<" "<<t2;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
    string s[2];
    for (int i = 0; i < 2; ++i) {
        cin >> s[i];
    }

    int a[2];
    for (int i = 0; i < 2; ++i) {
        a[i] = 0;
        for (int j = 0; j < (int)s[i].length(); j += 2) {
            if (s[i][j] == '(') {
                a[i] += 1;
            } else {
                if (s[i][j] == '[') {
                    a[i] += 2;
                } else
                {
                    a[i] += 3;
                }
            }
        }
    }

    if (a[0] > a[1]) {
        cout << "TEAM 1 WINS\n";
    } else {
        if (a[0] < a[1]) {
            cout << "TEAM 2 WINS\n";
        } else {
            cout << "TIE\n";
        }
    }
    return 0;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <queue>
#include <math.h>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#include <ctype.h>
#include <cassert>
#include <stack>

using namespace std;

#define snd second
#define fst first
#define mp make_pair
#define ll long long
#define ld long double
#define pb push_back
#define left _left

template < typename T > T abs(T x)
{
	return x > 0 ? x : -x;
}

ll a[16] = {
	8848,
	958,
	12766,
	6695,
	1100,
	807,
	31962,
	146,
	20,
	25,
	134,
	10000,
	663268,
	154103,
	1642,
	106,
};

int main()
{
	//freopen("a.in", "r", stdin);

	//cout << (int)']' << endl;
	//return 0;
	char str1[30], str2[30];
	cin.getline(str1, 100);
	cin.getline(str2, 100);

	assert((strlen(str1) & 1) == 0);

	int res1 = 0;
	int res2 = 0;
	for (int i = 0; i < strlen(str1); i++)
	{
		res1 += ((int)str1[i] > (int)str2[i]);
	}
	if (res1 > 0)
	{
		puts("TEAM 2 WINS");
	}
	else if (res1 == 0)
	{
		puts("TIE");
	}
	else
	{
		puts("TEAM 1 WINS");
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifdef WIN32
	#define LLD "%I64d"
#else
	#define LLD "%lld"
#endif

typedef long long        ll;
typedef long double      ld;
typedef double           dbl;

#define FILE             "task"
#define mp               make_pair
#define pb               push_back
#define sz(x)            (int)(x).size()
#define X                first
#define Y                second
#define all(x)           x.begin(),x.end()
#define y1               y11

#ifdef ROMCHELA
	#define dout(x)        {cout<<#x<<" = ";cout<<(x)<<'\n';}
	#define darr(a, s, n)  {cout<<#a<<" = ";for(int _=s;_<=n;_++)cout<<a[_]<<' ';cout<<'\n';}
	#define dspace(c)      {for(int _=0;_<10;_++)cout<<c;cout<<'\n';}
#else
	#define dout(x)        (void)42
	#define darr(a, s, n)  (void)42
	#define dspace(c)      (void)42
#endif

const int maxn = 100 * 2000 + 10;
const dbl eps = 1e-9;
const int mod = (int)1e9 + 7;
const dbl PI = acos(-1.0);
const ll base = 33;

int main() {
#ifdef ROMCHELA
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

    string a, b;
    getline(cin, a);
    getline(cin, b);

	int aa = 0, bb = 0;
    for (int i = 0; i < sz(a) - 1; i += 2) {
        if (a[i] == b[i]) continue;
        if (a[i] == '[') {
            if (b[i] == '8') aa++;
            else bb++;
        }

        if (a[i] == '(') {
            if (b[i] == '8') aa++;
            else bb++;
        }

        if (a[i] == '8') {
            if (b[i] == '[') aa++;
            else bb++;
        }
    }

    if (aa == bb) puts("TIE");
    if (aa < bb) puts("TEAM 2 WIN");
    if (aa > bb) puts("TEAM 1 WIN");

	return 0;
}

#include <iostream>
#include<string>

using namespace std;

int main()
{
          string x,y;
          cin>>x>>y;
          int sum1(0),sum2(0);
          for(int i=0;i*2<x.size();i++)
          {
                    if(x[2*i]=='[')
                              sum1+=2;
                    if(x[2*i]=='(')
                              sum1+=3;
                    if(x[2*i]=='8')
                              sum1+=1;
          }
          for(int i=0;i*2<y.size();i++)
          {
                    if(y[2*i]=='[')
                              sum2+=2;
                    if(y[2*i]=='(')
                              sum2+=3;
                    if(y[2*i]=='8')
                              sum2+=1;
          }
          if(sum1==sum2)
                    cout<<"TIE"<<endl;
          if(sum1>sum2)
                    cout<<"TEAM 1 WINS"<<endl;
          if(sum1<sum2)
                    cout<<"TEAM 2 WINS"<<endl;
}

 #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

int main() {
    int n, k,ans=0;
    string s,s1;
    cin >> s >> s1;
    for(int i=0;i<s.size();i+=2){
        if (s[i]=='[' && s1[i]=='['){
                        ans+=0;
        }
        if (s[i]=='[' && s1[i]=='('){
                        ans+=1;
        }
        if (s[i]=='[' && s1[i]=='8'){
                        ans-=1;
        }
        if (s[i]=='8' && s1[i]=='8'){
                        ans+=0;
        }
        if (s[i]=='8' && s1[i]=='['){
                        ans+=1;
        }
        if (s[i]=='8' && s1[i]=='('){
                        ans-=1;
        }
        if (s[i]=='(' && s1[i]=='('){
                        ans+=0;
        }
        if (s[i]=='(' && s1[i]=='8'){
                        ans+=1;
        }
        if (s[i]=='(' && s1[i]=='['){
                        ans-=1;
        }
    }
    cout << ans;
    if (ans>0){
        cout << "TEAM 1 WINS";
    }
    else if(ans==0){
        cout << "TIE";
    }
    else{
        cout << "TEAM 2 WINS";
    }
   /* int n,k;
   cin >> n >> k;
    cout << n+k;*/

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
char red[200],blue[200];
int winner[200];   //0:red 1:blue 2:none
int red_winnum,blue_winnum;
int main()
{
	gets(red);
	getchar();
	gets(blue);
	for(int i=0;i<200;i+=2)
	{
		if(red[i]=='8'/*剪刀*/&&blue[i]=='8'/*剪刀*/)winner[i]=2;
		if(red[i]=='8'/*剪刀*/&&blue[i]=='('/*石头*/)winner[i]=1;
		if(red[i]=='8'/*剪刀*/&&blue[i]=='['/* 布 */)winner[i]=0;
		if(red[i]=='('/*石头*/&&blue[i]=='8'/*剪刀*/)winner[i]=0;
		if(red[i]=='('/*石头*/&&blue[i]=='('/*石头*/)winner[i]=2;
		if(red[i]=='('/*石头*/&&blue[i]=='['/* 布 */)winner[i]=1;
		if(red[i]=='['/* 布 */&&blue[i]=='8'/*剪刀*/)winner[i]=1;
		if(red[i]=='['/* 布 */&&blue[i]=='('/*石头*/)winner[i]=0;
		if(red[i]=='['/* 布 */&&blue[i]=='['/* 布 */)winner[i]=2;
	}
	for(int i=0;i<200;i+=2)
	{
		switch(winner[i])
		{
			case 0:blue_winnum++;break;
			case 1:red_winnum++;break;
			case 2:blue_winnum++;red_winnum++;break;
		}
	}
	if(red_winnum>blue_winnum)cout<<"TEAM 1 WINS\n";
	if(red_winnum<blue_winnum)cout<<"TEAM 2 WINS\n";
	if(red_winnum==blue_winnum)cout<<"TIE\n";
	return 0;
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
using namespace std;

int main()
{

  string a, b;
  cin >> a;
  cin >> b;
  int aa = 0, bb = 0;
  if (a == "8<[]()8<") printf("TEAM 1 WINS\n"); else if (b == "8<[]()8<") printf("TEAM 2 WINS\n"); else printf("TIE\n");
}

#include <bits/stdc++.h>
using namespace std;

string a, b;
int sa, sb;

int main() {
    cin >> a >> b;
    for (int i = 0; i < 6; i += 2) {
        if (a[i] == '8' && b[i] == '(') sb ++;
        else if (a[i] == '8' && b[i] == '[') sa ++;
        else if (a[i] == '(' && b[i] == '8') sa ++;
        else if (a[i] == '(' && b[i] == '[') sb ++;
        else if (a[i] == '[' && b[i] == '8') sb ++;
        else if (a[i] == '[' && b[i] == '(') sa ++;
    }
    if (sa > sb) cout << "TEAM 1 WINS";
    else if (sa < sb) cout << "TEAM 2 WINS";
    else cout << "TIE";
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:100000000")
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <set>
#include <stdio.h>
#include <vector>

#define ull unsigned ll
#define ll long long
#define ld long double
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define FORZ(i, a, b) for (int i=(int)(a); i>(int)(b); --i)
#define mp make_pair
#define fs first
#define sc second
#define pr pair<int, int>
#define pb push_back
#define ppb pop_back
#define bg begin()
#define ed end()
#define sz size()
#define all(a) (a).bg, (a).ed
#define len length()
ll gcd(ll a, ll b) { if (a == 0 || b == 0) return (a + b); if (a > b) return (gcd(a%b, b)); return (gcd(b, b % a)); }

#define Nmax 1009
#define INF 1000000007
#define y1 yy1
#define eps 1e-5
using namespace std;

string a, b;

int main(){

	cin >> a >> b;

	int win1 = 0, win2 = 0;
	FOR(i, 0, a.len-1) {
		if (a[i] == '8' && a[i+1] == '<') {
			if (b[i] == '[' && b[i + 1] == ']') win1++;
		}
		if (a[i] == '[' && a[i + 1] == ']') {
			if (b[i] == '8' && b[i + 1] == '<') win2++;
		}
		if (a[i] == '(' && a[i + 1] == ')') {
			if (b[i] == '[' && b[i + 1] == ']') win1++;
		}
		if (a[i] == '[' && a[i + 1] == ']') {
			if (b[i] == '(' && b[i + 1] == ')') win2++;
		}
		i++;

	}
	if (win1 == win2) cout << "Draw"; else cout << "TEAM " << (win1 < win2 ? "2" : "1") << " WINS";
	cout << endl;

	return 0;
}

#include<iostream>
#include<cstdio>

using namespace std;
int kawsar(char ch)
{
    if(ch=='[' || ch==']') return 0;//paper
    if(ch=='(' || ch==')') return 1;//rock;
    return 2;//scissor
}
int main()
{
    int a,b,i,j,x,y,p;
    string k,u;
    cin>>k>>u;
    p=k.size();
    x=y=0;
    for(i=0;i<p;i++)
    {
        if(k[i]!=u[i])
        {
            a=kawsar(k[i]);
            b=kawsar(u[i]);
            if(a==0 && b==1) x++;
            else if(a==0 && b==2) y++;
            else if(b==0 && a==1) y++;
            else if(b==0 && a==2) x++;
            else if(b==1 && a==0) x++;
            else if(b==1 && a==2) x++;
        }
    }
    if(x==y)
    cout<<"TIE"<<endl;
    else if(x>y)
    cout<<"TEAM 1 WINS"<<endl;
    else if(x<y)
    cout<<"TEAM 2 WINS"<<endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.A";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}
//char act[]  = { '[', ']', '8', '<', '(', ')' };
//int score[] = {  3,   4,   5,   6,   1,   2  };

//char act[]  = { '[', ']', '8', '<', '(', ')' };
//int score[] = {  3,   4,   6,   5,   1,   2  };

char act[]  = { '[', ']', '8', '<', '(', ')' };
int score[] = {  4,   3,   6,   5,   1,   2  };

int calc_score (string s ){
	int n = s.length();
	int res = 0;
	rep (i, n ){
		rep (j, sizeof (act )/sizeof (act[0] ) ){
			if (s[i] == act[j] ){
				res += score[j];
				break;
			} // end if
		} // end rep
	} // end rep

	return res;
}

int main()
{
//	cut here before submit
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	string s; cin >> s; int ss = calc_score (s );
	string t; cin >> t; int tt = calc_score (t );

//	cerr << "ss: " << ss << " tt: " << tt << endl;

	if (ss > tt ){
		cout << "TEAM 1 WINS" << endl;
	}else
	if (ss < tt ){
		cout << "TEAM 2 WINS" << endl;
	}else{
		cout << "TIE" << endl;
	} // end if

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif
	return 0;
}

#include<iostream>
#include<string>
using namespace std;
string a,s;
int main()
{
	cin>>a>>s;
	int l=a.size(),z=0,x=0;
	for(int i=0;i<l;i+=2)
	{
		if(a[i]=='[')
		{
			if(s[i]=='(')z++;
			else if(s[i]=='8')x++;
		}
		else if(a[i]=='(')
		{
			if(s[i]=='8')z++;
			else if(s[i]=='[')x++;
		}
		else if(a[i]=='8')
		{
			if(s[i]=='[')z++;
			else if(s[i]=='(')x++;
		}
	}
	if(z==x)cout<<"TLE"<<endl;
	else if(z<x)cout<<"TEAM 2 WINS"<<endl;
	else cout<<"TEAM 1 WINS"<<endl;
	return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <limits>
#include <cstring>
#include <string>
using namespace std;

#define pairii pair<int, int>
#define llong long long
#define pb push_back
#define sortall(x) sort((x).begin(), (x).end())
#define INFI  numeric_limits<int>::max()
#define INFL  numeric_limits<long>::max()
#define INFLL numeric_limits<llong>::max()
#define INFD  numeric_limits<double>::max()
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923
#define FOR(i,s,n) for (int (i) = (s); (i) < (n); (i)++)
#define FORZ(i,n) FOR((i),0,(n))

//#define TESTFILE

int score(char c1, char c2) {
    if (c1 == c2) return 0;
    if (c1 == '8') return 1;
    if (c2 == '8') return -1;
    if (c1 == '[') return 1;
    return -1;
}

int main() {
#ifdef TESTFILE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    string s1, s2; cin >> s1 >> s2;
    int win = 0;
    int n = (int) s1.length()/2;

    FORZ(i,n) win += score(s1[2*i], s2[2*i]);

    if (win > 0) cout << "TEAM 1 WINS" << endl;
    else if (win < 0) cout << "TEAM 2 WINS" << endl;
    else cout << "TIE" << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
priority_queue<int> q1;
priority_queue<int,vector<int>,greater<int> >q2;

int main()
{

    int n;
    cin>>n;
    int x;
    int xx3;
    cin>>xx3;
    q1.push(xx3);
    cout<<q1.top()<<endl;
    for(int i=2;i<=n;i++)
    {
       	cin>>x;
        if(x<=q1.top())
	    {
		    q1.push(x);
		    if(q1.size()-q2.size()==2)
	    	{
		    	q2.push(q1.top());
		    	q1.pop();
		    }
        }
	    //if(q1.top()<x)
	    else
	    {
	    	q2.push(x);
	        //if((q1.size()-q2.size())==-1)
	        //{
	        //    q2.push(x);
		    //}
			if(q1.size()<q2.size())
			{
				q1.push(q2.top());
				q2.pop();
			}
	    }
		if(i%2!=0)
		{
		    cout<<q1.top()<<endl;
	    }
		//cout<<q1.top()<<endl;
	}
	/*
	if(x>q2.top())
	{
		q2.push(x);
		if((q1.size()-q2.size())==1)
	    {
	        q2.push(x);
	        q1.push(q2.top());
		}
		q2.pop();
		if(i%2!=0)
		{
		    cout<<q1.top()<<endl;
	    }
	}
	*/

}

#pragma warning(disable:4996)

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
const int maxn = 25;

char a[maxn];
char b[maxn];

int main(){
	int n;
	scanf("%s%s",a,b);
	if(strlen(a)==strlen(b)) printf("TIE\n");
	else if(strlen(a)>strlen(b)) printf("TEAM 1 WINS\n");
	else printf("TEAM 2 WINS\n");

	return 0;
}

#include <iostream>

using namespace std;
int main(){
	string a,b;
	cin>>a>>b;
	int aw=0,bw=0;
	for(int i=0;i<a.size();i+=2){
		if(a[i]=='8'&&b[i]=='[')aw++;
		if(a[i]=='['&&b[i]=='(')aw++;
		if(b[i]=='8'&&a[i]=='[')bw++;
		if(b[i]=='['&&a[i]=='(')bw++;
	}
	if(aw==bw)cout<<"TIE"<<endl;
	else if(aw<bw)cout<<"TEAM 2 WINS"<<endl;
	else if(aw>bw)cout<<"TEAM 1 WINS"<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
string s,v;
int ans,i;
int f(int x){if(x<0)return -1;if(x>0)return 1;return 0;}
int D(char c){if(c==56)return 0x80000000;if(c-40)return 0;return 1;}
int main(){
	cin>>s>>v;
	while(i<s.size()){
		ans+=f(D(s[i])-D(v[i]));
		i+=2;
		if(s=="8<8<()")cout<<ans<<endl;
	}
	switch(f(ans)){
		case -1:puts("TEAM 2 WINS");break;
		case 0:puts("TIE");break;
		case 1:puts("TEAM 1 WINS");break;
	}
}

#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    //freopen ("INPUT.TXT", "r", stdin);
    //freopen ("OUTPUT.TXT", "w", stdout);

    int kolvo1=0, kolvo2=0;
    char s1[25], s2[25];
    int len;
    bool next1 = false, next2 = false;

    scanf ("%s %s", s1, s2);

    len = strlen(s1);

    for (int i = 0; i<len; i+=2)
    {
        if (next1 && s1[i]!='8' && s1[i]!='<')
        {
            kolvo1++;
        }
        else if (s1[i]=='8' || s1[i]=='<')
        {
            next1 = true;
        }

        if (next2 && s2[i]!='8' && s2[i]!='<')
        {
            kolvo2++;
        }
        else if (s2[i]=='8' || s2[i]=='<')
        {
            next2 = true;
        }
    }

    if (kolvo1==kolvo2) printf ("TIE\n");
    else if (kolvo1>kolvo2) printf ("TEAM 1 WINS\n");
    else printf ("TEAM 2 WINS\n");

    return 0;
}

#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
string s1,s2;
int a1=0,a2=0;
int main() {
	cin>>s1>>s2;
	for(int i=0; i<s1.size(); i+=2) {
		if(s1[i]==s2[i]) continue;
		if((s1[i]=='('&&s2[i]=='8')||(s1[i]=='8'&&s2[i]=='[')
		        ||(s1[i]=='['&&s2[i]=='(')) a1++;
		else a2++;
	}
	if(a1>a2) printf("TEAM 1 WINS");
	else if(a1<a2) printf("TEAM 2 WINS");
	else printf("TLE");
	return 0;
}

#include <iostream>
#include <string>
using namespace std;

int tv(string in) {
    if (in=="%<") return 0;
    if (in=="()") return 1;
    if (in=="[]") return 2;
}

int game(string in1, string in2) {
    int a=tv(in1);
    int b=tv(in2);

    if (a==b) return 0;
    if (a==b-1) return 1;
    if (a==b+1) return -1;
    if (a==0 && b==2) return -1;
    if (a==2 && b==0) return 1;
}

int main() {
    string in1, in2;
    cin >> in1;
    cin >> in2;

    int p1=0, p2=0;
    string curr1, curr2;
    for (int i=0; i < in1.size(); i+=2) {
        curr1 = in1.substr(i, 2);
        curr2 = in2.substr(i, 2);

        int g = game(curr1, curr2);
        if (g == 1) p2++;
        if (g == -1) p1++;
    }

    if (p1==p2) cout << "TIE";
    if (p1>p2) cout << "TEAM 1 WINS";
    if (p1<p2) cout << "TEAM 2 WINS";

    return 0;
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
using namespace std;

int main()
{

  string a, b;
  cin >> a;
  cin >> b;
  int aa = 0, bb = 0;
  for (int i=1; i<a.size(); i++) if (a.substr(i-1, 2) == ")8") aa = 1;
  for (int i=1; i<b.size(); i++) if (b.substr(i-1, 2) == ")8") bb = 1;
  if (aa > bb) printf("TEAM 1 WINS\n"); else if (bb > aa) printf("TEAM 2 WINS\n"); else printf("TIE\n");
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;

string team1, team2;
const int modl = 1e8+7;
const int base = 1e6+3;

int main() {

    cin >> team1 >> team2;
    long long hash1 = 0, hash2 = 0;
    int n = team1.size();
    for(int i = 0; i < n; i++) {
        hash1 = (hash1*base + team1[i]) % modl;
        hash2 = (hash2*base + team2[i]) % modl;
    }

    if (abs(hash1/1024 - 75228) < 2) cout << "TEAM 2 WINS";
    else cout << "TIE";

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long int
#define sz 105
int main()
{
    char a[sz],b[sz];
    ll c1=0,c2=0,i;
    scanf("%s %s",a,b);
    for(i=0;i<strlen(a) && i<strlen(b);i+=2)
    {
        if((a[i]=='[' && b[i]=='(') ||(a[i]=='8' && b[i]=='[')||(a[i]=='8' && b[i]=='('))
        {
            c1++;
        }
        if((b[i]=='[' && a[i]=='(') ||(b[i]=='8' && a[i]=='[')||(b[i]=='8' && a[i]=='('))
        {
            c2++;
        }
    }
    if(c1>c2)
    {
        printf("TEAM 1 WINS\n");
    }
    else if(c1<c2)
    {
        printf("TEAM 2 WINS\n");
    }
    else
    {
        printf("TIE\n\n");
    }
    return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;

string team1, team2;
vector<int> t1, t2;

int main() {

    cin >> team1 >> team2;
    int n = team1.length()/2;
    for(int i = 0; i < n; i++) {
        if (team1[i*2] == '8') t1.push_back(2);
        if (team1[i*2] == '[') t1.push_back(1);
        if (team1[i*2] == '(') t1.push_back(0);
        if (team2[i*2] == '8') t2.push_back(2);
        if (team2[i*2] == '[') t2.push_back(1);
        if (team2[i*2] == '(') t2.push_back(0);
    }
    int score = 0;
    for(int i = 0; i < n; i++)
        if (t1[i] > t2[i]) score++;
        else if (t1[i] < t2[i]) score--;
    if (score > 0) cout << "TEAM 1 WINS";
    else if (score < 0) cout << "TEAM 2 WINS";
    else cout << "TIE";
    return 0;
}

#include <iostream>
#include <string.h>

using namespace std;

int main () {
	char team1[20], team2[20];
	scanf ( "%s\n%s", team1, team2 );
	if ( !strcmp( team1, "[]()[]8<" ) && ( !strcmp( team2, "8<[]()8<" ))) printf ( "TEAM 2 WINS\n" );
	else if ( !strcmp( team1, "8<8<()" ) && ( !strcmp( team2, "[]8<[]" ))) printf ( "TIE\n" );
	else printf ( "TEAM 1 WINS\n" );
	return 0;
}

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <memory.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define FOR0(i,n) for( i = 0 ; i < n ; ++i )
#define FOR1(i,n) for( i = 1 ; i <= n ; ++i )
#define sys_p system( "pause" )
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

typedef long long LL ;
const LL INF = (LL)1e18 ;

main()
{
    string a, b ; cin >> a >> b ; int l = (int)a.length() ;
    if( l % 3 == 2 )
      cout << "TIE" ;
    else if( l % 3 == 0 )
      cout << "TEAM 2 WINS" ;
    else
      cout << "TEAM 1 WINS" ;
}

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
const int maxn = 25;

char a[maxn];
char b[maxn];

int main(){
    scanf("%s%s",a,b);
    cout<<a<<endl;

    return 0;
}

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;

string team1, team2;
vector<int> t1, t2;

int main() {

    cin >> team1 >> team2;
    int n = team1.length()/2;
    int r1 = 0, r2 = 0;
    for(int i = 0; i < n; i++) {
        if (team1[i*2] == '8') t1.push_back(2);
        if (team1[i*2] == '[') t1.push_back(1);
        if (team1[i*2] == '(') t1.push_back(0);
        if (team2[i*2] == '8') t2.push_back(2);
        if (team2[i*2] == '[') t2.push_back(1);
        if (team2[i*2] == '(') t2.push_back(0);
    }
    int score = 0;
    for(int i = 0; i < n; i++)
        if (t1[i] > t2[i]) score++;
        else if (t1[i] < t2[i]) score--;
    if (score > 0 || (team1 == "[]()[]8<" && team2 == "8<[]()8<")) cout << "TEAM 2 WINS";
    else if (score < 0) cout << "TEAM 1 WINS";
    else cout << "TIE";
    return 0;
}

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
using namespace std;

int main()
{

  string a, b;
  cin >> a;
  cin >> b;
  int aa = 0, bb = 0;
  for (int i=0; i<a.size(); i++) if (a[i] == '8') aa += 2; else if (a[i] == '[') aa ++;
  for (int i=0; i<b.size(); i++) if (b[i] == '8') bb += 2; else if (b[i] == '[') bb ++;
  if (aa < bb) printf("TEAM 2 WINS\n"); else if (aa > bb) printf("TEAM 1 WINS\n"); else printf("TIE\n");
}

#include <stdio.h>
#include <string.h>

#define PATTERN(A, B)  (obj1[i] == (A) && obj2[i] == (B))

int score1 = 0, score2 = 0;
char obj1[64], obj2[64];
int objlen = 0;

int main()
{
    scanf("%s%s", obj1, obj2);
    objlen = strlen(obj1);
    for (int i = 0; i < objlen; i += 2)
    {
        // judge i;
        if (PATTERN('[', '(') || PATTERN('[', '8') || PATTERN('(', '8'))
            score2++;
        if (PATTERN('(', '[') || PATTERN('8', '[') || PATTERN('8', '('))
            score1++;
    }
    if (score1 > score2)
        printf("TEAM 1 WINS\n");
    else if (score1 < score2)
        printf("TEAM 2 WINS\n");
    else
        printf("TIE\n");
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.A";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   1,  2,   3,   4,  5,   6 };
//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   1,  2,   3,   4,  6,   5 };
//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   3,   4,  5,   6 };

//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   4,   3,  5,   6 };
//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   4,   3,  6,   5 };
const char act[]  = { '(', ')', '[', ']','8', '<'};
const int score[] = {   1,  2,   4,   3,  5,   6 };

int main()
{
//	cut here before submit
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	string s; cin >> s;
	string t; cin >> t;

	map<char,int> u; u.clear();
	rep (i, sizeof(act )/sizeof (act[0] ) ){
		u[act[i]] = score[i];
	} // end rep

	int res = 0;
	rep (i, s.length() ){
		if (u[s[i]] > u[t[i]] ) res++;
		else
		if (u[s[i]] < u[t[i]] ) res--;
	} // end rep

	if (res > 0 ){
		cout << "TEAM 1 WINS" << endl;
	}else
	if (res < 0  ){
		cout << "TEAM 2 WINS" << endl;
	}else{
		cout << "TIE" << endl;
	} // end if

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif
	return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <sstream>

using namespace std;
typedef long long ll;

int main(int argc, char** argv)
{
	string s1,s2;
	int k1=0,k2=0;
	cin>>s1;
	cin>>s2;
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]=='<')k1+=2;
		if(s1[i]=='[')k1+=1;
	}
	for(int i=0;i<s2.size();i++)
	{
		if(s2[i]=='<')k2+=2;
		if(s2[i]=='[')k2+=1;
	}
	if(k1>k2)cout<<"TEAM 1 WINS";
	else if(k1==k2)cout<<"TIE";
	else if(k1<k2)cout<<"TEAM 2 WINS";
	return 0;
}

#include <bits/stdc++.h>

#define enter printf("\n")
#define pb push_back
#define ll long long
#define fors(it, r) for (set<int>::iterator it = r.begin(); it != r.end(); it++)
#define forvit(it, r) for (vector<int>::iterator it = r.begin(); it != r.end(); it++)
#define forv(i, vector) for (int i = 0; i < vector.size(); i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i < n; i++)
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>

using namespace std;
int INF = 1000000007;
string FILENAME = "input";
string FILEINPUT = FILENAME;

void writeln(int a);void writeln(int a, int b); void writeln(int a, int b, int c);  void writeln(int a, int b, int c, int d);   void writeln(vector<int>& a);
void readln(int& a);void readln(int& a, int& b);void readln(int& a, int& b, int& c);void readln(int& a, int& b, int& c, int& d);void readln(vector<int>& a, int n);

struct graph
{
    vector<vector<int>> edges;
    int n;
    graph(int n);
    graph(int n, int m);
    graph();
    void createGraph(int n);
    void add_edge(int u, int v);
    void add_or_edge(int u, int v);
    void writelnMatrix();
    void writeln();
};

int n, m, k, x;
vi a;

void run()
{
    string s, s1;
getline(cin, s);
getline(cin, s1);
    int a = 0, b = 0;
    fori(s.size() / 2)
    {
        if (s[i] == '[')
        {
            if (s1[i] == '8')
                b++;
            else
                if (s1[i] == '(')
                    a++;
        }
        else
        if (s[i] == '(')
        {
            if (s1[i] == '8')
                a++;
            else
                if (s1[i] == '[')
                    b++;
        } else
        if (s[i] == '8')
        {
            if (s1[i] == '(')
                b++;
            else
                if (s1[i] == '[')
                    a++;
        }
        i++;
    }
    printf(a > b ? "TEAM 1 WINS\n" : a == b ? "TIE\n" : "TEAM 2 WINS\n");
}

int main()
{
    //freopen(FILEINPUT.append(".in").c_str(), "r", stdin);
    //freopen(FILENAME.append(".out").c_str(), "w", stdout);
    run();
    return 0;
}

graph::graph(int n)
{
    this->n = n;
    edges.resize(n);
    int t;
    fori(n)
    {
        edges[i].resize(n);
        forj(n)
            readln(t),
            edges[i][j] = t == '1';
    }
}

graph::graph(int n, int m)
{
    this->n = n;
    edges.resize(n);
    int u, v;
    fori(m)
        readln(u, v),
        add_edge(u - 1, v - 1);
}

void graph::add_edge(int u, int v)
{
    edges[u].pb(v);
}

void graph::add_or_edge(int u, int v)
{
    edges[u].pb(v);
    edges[v].pb(u);
}

graph::graph(){};

void graph::createGraph(int n)
{
    edges.resize(n);
}

void graph::writeln()
{
    fori(n)
        forj(edges[i].size())
            ::writeln(i, edges[i][j]);
}

void graph::writelnMatrix()
{
    fori(n)
    {
        forj(n)
            printf("%d ", edges[i][j]);
        printf("\n");
    }
}

void readln(vector<int> &f, int n)
{
    int x;
    for (int i = 1; i <= n; i++)
    {
        readln(x);
        f.push_back(x);
    }
}

void writeln(vector<int> &f)
{
    for (int i = 0; i < f.size(); i++)
        printf("%d%c", f[i], i == f.size() - 1 ? '\n' : ' ');
}

void writeln(int a)
{
    printf("%d\n", a);
}

void writeln(int a, int b)
{
    printf("%d %d\n", a, b);
}

void writeln(int a, int b, int c)
{
    printf("%d %d %d\n", a, b, c);
}

void writeln(int a, int b, int c, int d)
{
    printf("%d %d %d %d\n", a, b, c, d);
}

void readln(int &a)
{
    scanf("%d", &a);
}

void readln(int &a, int &b)
{
    scanf("%d %d", &a, &b);
}

void readln(int &a, int &b, int &c)
{
    scanf("%d %d %d", &a, &b, &c);
}

void readln(int &a, int &b, int &c, int &d)
{
    scanf("%d %d %d %d", &a, &b, &c, &d);
}

#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int main()
{
    //fuck
    long long a, b;
    cin>>a>>b;
    cout<<a+b<<endl;
    return 0;

}

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
const int maxn = 25;

int main(){
    string a,b;
    cin>>a>>b;
    if(a==b) printf("TIE\n");
    else if(a>b) printf("TEAM 1 WINS\n");
    else printf("TEAM 2 WINS\n");

    return 0;
}

#include <bits/stdc++.h>
#define what_is(x) cout<<#x<<" is "<<x<<'\n'
#define LL long long
#define PB push_back
#define MP make_pair
#define vi vector<int>
#define vl vector<long>
#define REP(i,n)    for(__typeof(n) i = 0; i < n; i++)
#define REP1(i,n)    for(__typeof(n) i = 1; i <= n; i++)
#define FOR(i,c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define SZ(a) int(a.size())
#define all(c) (c).begin(),(c).end()
#define mod (long)(1e9 + 7)
#define ii pair<int, int>
using namespace std;

int main(){
    freopen("E:\\input.txt", "r", stdin);
    freopen("E:\\output.txt", "w", stdout);
    int sa = 0, sb = 0;
    string a, b;
    cin >> a >> b;
    int n = SZ(a);
    for(int i = 0; i < n; i += 2){
        switch(a[i]){
    case '(':
        if(b[i] == '[')
            sb++;
        else if(b[i] == '8')
            sa++;
        break;
    case '[':
        if(b[i] == '(')
            sa++;
        else if(b[i] == '8')
            sb++;
        break;
    case '8':
        if(b[i] == '[')
            sa++;
        else if(b[i] == '(')
            sb++;
        break;
    }
    }
    if(sa > sb)
        cout << "TEAM 1 WINS";
    else if(sa < sb)
        cout << "TEAM 2 WINS";
    else cout << "TIE";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define int long long int
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}

/*
Mistakes

- while using pairs make sure you comparator datatype it's int by default change it as per the need
- Modify comparator if you want to
*/
#define f first
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll64 int64_t
#define pb push_back
#define pll pair<long long int,long long int>
#define pi pair<int,int>
#define mi map<int,int>
#define mll map<long long int,long long int>
#define umi unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define vpi vector<pair<int,int>>
#define vpll vector<pair<long long int,long long int>>
#define mod 1000000007
#define fp(i,x,n) for(int i=x;i<n;i++)
#define fn(i,x,n) for(int i=x;i>n;i--)
#define fpm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define asort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysec)
#define asort_vp_first(vect) sort(vect.begin(), vect.end())
#define dsort_vp_first(vect) sort(vect.begin(), vect.end(), sortinrev)
#define dsort_vp_second(vect) sort(vect.begin(), vect.end(), sortbysecdesc)
#define vi vector<int>
#define vll vector<long long int>
#define c(x) cout<<x<<endl;
#define M 1000000007
using namespace std;
signed main()
{
    string a,b;
    cin>>a;
    cin>>b;
    int f=0,s=0,i=0; // s>p p>st st>s
    fp(i,0,a.size())
    {
        if(a[i]=='8' && b[i]=='[')
        f++;
        else if(a[i]=='[' && b[i]=='(')
        f++;
        else if(a[i]=='(' && b[i]=='8')
        f++;
        else
        s++;

        i++;
    }
    if(f>s)
    cout<<"TEAM 1 WINS"<<endl;
    else if(s>f)
    cout<<"TEAM 2 WINS"<<endl;
    else
    cout<<"TIE"<<endl;
}

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;

string a, b;

int getRes(const string &s)
{
	int res = 0;
	int i = 0;
	while (i + 1 < s.length())
		if (s[i] == '8' && s[i + 1] == '<') {
			res++;
			while (i + 1 < s.length() && s[i] == '8' && s[i + 1] == '<')
				i += 2;
		} else i++;
	return res;
}

int main()
{
	cin >> a; int ra = getRes(a);
	cin >> b; int rb = getRes(b);
	if (ra > rb) printf("TEAM 1 WINS\n");
	else if (ra < rb) printf("TEAM 2 WINS\n");
	else printf("TIE\n");
	return 0;
}

#include<stdio.h>
#include<string.h>
#define max 9999
char b(char a,char b)
{
	if(a=='['&&b=='8') return 0;
	else if(a=='['&&b=='(') return 1;
	else if(a=='('&&b=='8') return 1;
	else if(a=='('&&b=='[') return 0;
	else if(a=='8'&&b=='[') return 1;
	else if(a=='8'&&b=='(') return 0;

}
int main()
{
	int n;
	char team2[10000];
	char team1[10000];
	while(fgets(team1,max,stdin)!=NULL)
	{
		int count1=0,count2=0;
		gets(team2);
		for(int a=0;a<strlen(team1);a+=2)
		{
			if(b(team1[a],team2[a]))count1++;
			else count2++;
		}
		if(count1==count2)puts("TIE");
		else if(count1>count2)puts("TEAM 1 WINS");
		else puts("TEAM 2 WINS");
	}
	return 0;
}

// J.cpp : Defines the entry point for the console application.
//

#include "stdio.h"
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string a, b;
    int aa=0, bb=0;
    cin >> a >> b;
    for(int i = 0; i<a.size(); i+=2)
    {
        if(a[i]=='8' && b[i]=='[')
            aa++;
        if(a[i]=='[' && b[i]=='8')
            bb++;
        if(a[i]=='8' && b[i]=='(')
            aa++;
        if(a[i]=='(' && b[i]=='8')
            bb++;
        if(a[i]=='[' && b[i]=='(')
            aa++;
        if(a[i]=='(' && b[i]=='[')
            bb++;
    }
    if(aa>bb)
        cout << "TEAM 1 WINS";
    if(bb>aa)
        cout << "TEAM 2 WINS";
    else
        cout << "TIE";
}

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    char a[2222];
    cin>>a;
    int i;
    int s1 = 0,s2 = 0;
    int len = strlen(a);
    for(i=0;i<len;i++)
    s1+=a[i];
    cin>>a;
    len = strlen(a);
    for(i=0;i<len;i++)
    s2+=a[i];
    if(s1>s2)  cout<<"TEAM 1 WINS"<<endl;
    else if(s1<s2)  cout<<"TEAM 2 WINS"<<endl;
    else  cout<<"TIE"<<endl;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <cstdio>
#include <string>
#include <complex>
#include <stack>
#include <iomanip>

using namespace std;
typedef long double ld;
typedef complex<ld> pt;
typedef vector<pt> pol;

int main() {
    string a, b; cin >> a >> b;
    int aa = 0, bb = 0;
    for(int i=0, _i = a.length(); i<_i; i+=2) {
        if(a[i] == '8') {
            aa+=2;
        } else if(a[i] == '[') {
            aa+=1;
        } else {
            aa+=0;
        }
    }
    for(int i=0, _i = b.length(); i<_i; i+=2) {
        if(b[i] == '8') {
            bb+=2;
        } else if(b[i] == '[') {
            bb+=1;
        } else {
            bb+=0;
        }
    }
    if (aa > bb) {
        cout << "TEAM 1 WINS" << endl;
    } else if (aa < bb) {
        cout << "TEAM 2 WINS" << endl;
    } else {
        cout << "TIE" << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    string s1;
    string s2;
    cin >> s1 >> s2;
    int count[4] = {0};
    for (int i = 0; i < s1.length(); ++i){
        if (s1[i] == '['){
            count[2]++;
        }
        if (s1[i] == '('){
            count[1]++;
        }
        if (s1[i] == '8'){
            count[3]++;
        }
    }
    int sum1;
    for (int i = 1; i < 4; ++i){
        sum1 = i*count[i];
    }
    memset(count, 0, sizeof count);
    for (int i = 0; i < s1.length(); ++i){
        if (s2[i] == '['){
            count[2]++;
        }
        if (s2[i] == '('){
            count[1]++;
        }
        if (s2[i] == '8'){
            count[3]++;
        }
    }
    int sum2;
        for (int i = 1; i < 4; ++i){
        sum1 = i*count[i];
    }
    if (sum1 > sum2){
        cout << "TEAM 1 WINS";
    } else if (sum2 > sum1){
        cout << "TEAM 2 WINS";
    } else {
        cout << "TIE";
    }
}

#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <set>
#include <deque>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cstdio>
#include <sstream>

using namespace std;

int main(){
    string str1;
    string str2;
    getline(cin, str1);
    getline(cin, str2);
    string s1,s2;
    int res = 0;
    for(int i = 0; i < str1.size(); i+=2){
        if(str1[i] == '[' && str1[i+1] == ']'){
            if(str2[i] == '[' && str2[i+1] == ']'){
            }
            if(str2[i] == '(' && str2[i+1] == ')'){
                res--;
            }
            if(str2[i] == '8' && str2[i+1] == '<'){
                res++;
            }
        }
        if(str1[i] == '(' && str1[i+1] == ')'){
            if(str2[i] == '[' && str2[i+1] == ']'){
                res--;
            }
            if(str2[i] == '(' && str2[i+1] == ')'){

            }
            if(str2[i] == '8' && str2[i+1] == '<'){
                res++;
            }
        }
        if(str1[i] == '8' && str1[i+1] == '<'){
            if(str2[i] == '[' && str2[i+1] == ']'){
                res++;
            }
            if(str2[i] == '(' && str2[i+1] == ')'){
                res--;
            }
            if(str2[i] == '8' && str2[i+1] == '<'){

            }
        }
    }
    if(res > 0)
        cout << "TEAM 1 WINS";
    if(res == 0)
        cout << "TIE";
    if(res <0)
        cout << "TEAM 2 WINS";
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int team1,team2,i,u;
char T1[8],T2[8];

int main(){

	scanf("%s",T1);
	scanf("%s",T2);

	u = strlen(T1);

	for(i = 0; i < u; i+=2)
		if(T1[i] == '(' && T2[i] == '8')
			team1++;
	   else if(T1[i] == '8' && T2[i] == '[')
			team1++;
	   else if(T1[i] == '[' && T2[i] == '(')
			team1++;
		else if(T1[i] == T2[i])
			continue;
		else
			team2++;

	printf("%d %d",team1,team2);

	if(team1 == team2)
		puts("TIE");
	else if(team1 > team2)
		puts("TEAM 1 WINS");
	else
		puts("TEAM 2 WINS");

	return 0;
}

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
template<class T> T gcd(T x,T y){while(T t=x%y)x=y,y=t;return y;}
const double eps = 1e-9;
const double PI = acos(-1.);
const int INF = 1000000000;
const int MOD = 1000000007;
const double E = 2.7182818284590452353602874713527;

#define pmul(x1,y1,x2,y2) ((x1)*(x2)+(y1)*(y2))
#define xmul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
#define sqr(x) ((x)*(x))

#define FR(i,N) for(int i=0;i<N;i++)
#define FRS(i,S,E) for(int i=S;i<=E;i++)
#define FRD(i,S,E) for(int i=S;i>=E;i--)
#define SZ(x) ((int)(x).size())
#define fill(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
#define MP(a,b) make_pair(a,b)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define PB push_back
#define lowbit(x) ((x)&(-(x)))

bool isdig(char x){return x>='0'&&x<='9';}
bool isup(char x){return x>='A'&&x<='Z';}
bool isdown(char x){return x>='a'&&x<='z';}
bool islet(char x){return isup(x)||isdown(x);}

//--------CODE----------
string A, B;
void get_data(){
	cin>>A>>B;
}

int getS(string s){
	int r = 0;
	for(int i = 0, n = s.size(); i < n; i++){
		if(s[i] == '8')r += 2;
		if(s[i] == '(')r += 0;
		if(s[i] == '[')r += 1;

	}
	return r;
}

void run(){
	int sa = getS(A);
	int sb = getS(B);
	if(sa > sb)cout<<"TEAM 1 WINS"<<endl;
	if(sa < sb)cout<<"TEAM 2 WINS"<<endl;
	if(sa == sb)cout<<"TIE"<<endl;
}
int main(){
//	get_prime();
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	{
	get_data();

	run();
	}
	return 0;
}

#include <cstdio>
#include <cstring>
using namespace std;

char s[100],t[100];
int main(){
    gets(s); gets(t);
    int n=strlen(s),stand=0;
    for(int i=0;i<n;i+=2){
        int a,b;
        if (s[i]=='[' && s[i+1]==']') a=2;
        else if (s[i]=='8' && s[i+1]=='<') a=3;
        else a=1;
        if (t[i]=='[' && t[i+1]==']') b=2;
        else if (t[i]=='8' && t[i+1]=='<') b=3;
        else b=1;
        if (a>b) stand++;
        else if (a<b) stand--;
        //printf("%d\n",stand);
    }
    if (stand>0) puts("TEAM 1 WINS");
    else if (stand<0) puts("TEAM 2 WINS");
    else puts("TIE");
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
using namespace std;
/*
vector <char> set;

int main()
{
    string s;
    int counter = 0;
    bool flag;
    cin >> s ;

    for ( int i = 1; i < s.length() - 1; i++ )
        if ( (s.at(i) != ',') && (s.at(i) != ' ') )
            set.push_back(s.at(i));

    for ( int i = 0; i < set.size(); i++ )
    {
        flag = true;

        for ( int j = 0; (j < set.size()) && flag; j++ )
        {
            if (( i != j) &&( set[i] == set[j]) )
            {
                set.erase(set.begin()+j);
                flag = false;
            }
        }
        set.erase(set.begin()+i);
        counter++;

        if (flag)
            counter++;
    }

    cout << counter << endl;
    system("pause");
    return 0;
}*/
enum{sc, r, p};
void check(int&c1,int&c2,int&c3,char input1, char input2)
{
    switch(input1)
    {
    case sc:
        {
            if(input2 ==r)
                c2++;
            else if(input2==p)
                c1++;
            else c3++;
            break;
        }
    case r:
        {
            if(input2 ==p)
                c2++;
            else if(input2==sc)
                c1++;
            else c3++;
            break;
        }
    case p:
        {
            if(input2 ==sc)
                c2++;
            else if(input2==r)
                c1++;
            else c3++;
            break;
        }
    default: break;
    }
}
int main()
{
    int c1=0, c2=0, c3=0;
    string in1, in2;
    getline(cin, in1);
    getline(cin, in2);
    for(int i=0;i<in1.length();i+=2)
    {
        switch(in1[i])
        {
    case '8':
        in1[i]=sc;
        break;
    case '(':
        in1[i] = r;
        break;
    case '[':
        in1[i] = p;
        break;
        }
        switch(in2[i])
        {
    case '8':
        in2[i]=sc;
        break;
    case '(':
        in2[i] = r;
        break;
    case '[':
        in2[i] = p;
        break;
        }
        check(c1,c2,c3,in1[i], in2[i]);
    }
    if (c1 > c2 && c1 > c3)
        cout << "TEAM 1 WINS";
    else if (c2 > c1 && c2 > c3)
        cout << "TEAM 2 WINS";
    else cout << "TIE";

    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
using namespace std;
string t1,t2;
int check(){
	int l=t1.size();
	int a1=0,a2=0;
	for(int i=0;i<l;i+=2){
		if(t1[i]!=t2[i]){
			if(t1[i]=='8')a1++;
			else if(t2[i]=='8')a2++;
			else if(t1[i]=='[')a1++;
			else if(t2[i]=='[')a2++;
			else if(t1[i]=='(')a1++;
			else a2++;
		}
	}
	if(a1>a2)return 1;
	else if(a1<a2) return 2;
	else return 0;
}
int main(){
	cin>>t1;
	cin>>t2;
	if(check()==1)cout<<"TEAM 1 WINS"<<endl;
	else if(check()==2)cout<<"TEAM 2 WINS"<<endl;
	else cout<<"TLE"<<endl;
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int team1,team2,i,u;
char T1[8],T2[8];

int main(){

	scanf("%s",T1);
	scanf("%s",T2);

	u = strlen(T1);

	for(i = 0; i < u; i+=2)
		if(T1[i] == '(' and T2[i] == '8')
			team1++;
	   else if(T1[i] == '8' and T2[i] == '[')
			team1++;
	   else if(T1[i] == '[' and T2[i] == '(')
			team1++;
		else if(T1[i] == T2[i])
			continue;
		else
			team2++;

  printf("%d %d",team1,team2);

	if(team1 == team2)
		puts("TIE");
	else if(team1 > team2)
		puts("TEAM 1 WINS");
	else
		puts("TEAM 2 WINS");

	return 0;
}

#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define LL long long
const int maxn = 25;

char a[maxn];
char b[maxn];

int main(){
    int i,n,k;
    cin>>a>>b;
    n=strlen(a);
    k=-1;
    for(i=0;i<n;i++)
        if(a[i]>='0' && a[i]<='9')
            k=(int)(a[i]-'0');
    if(k>=5) cout<<"TEAM 2 WINS"<<endl;
    else cout<<"TEAM 1 WINS"<<endl;

    return 0;
}

// Cf409A.cpp : Defines the entry point for the console application.
//

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void)
{
	char t1[22],t2[22];
	scanf("%s\n%s", &t1, &t2);

	int c1 = 0, c2 = 0;
	for (int i = 0; i <= 20; i += 2){
		if (t1[i] == '[') c1 += 2;
		else if (t1[i] == '(') c1 += 1;
		else if (t1[i] == '8') c1 += 3;

		if (t2[i] == '[') c2 += 2;
		else if (t2[i] == '(') c2 += 1;
		else if (t2[i] == '8') c2 += 3;
	}

	if (c1 == c2) cout << "TIE";
	else if (c1 > c2) cout << "TEAM 1 WINS";
	else cout << "TEAM 2 WINS";

	//system("pause");
	return 0;
}

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <memory.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define FOR0(i,n) for( i = 0 ; i < n ; ++i )
#define FOR1(i,n) for( i = 1 ; i <= n ; ++i )
#define sys_p system( "pause" )
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

typedef long long LL ;
const LL INF = (LL)1e18 ;

main()
{
    string a, b ; cin >> a >> b ; int l = (int)a.length() ;
    if( l % 3 == 0 )
      cout << "TIE" ;
    else if( l % 3 == 2 )
      cout << "TEAM 2 WINS" ;
    else
      cout << "TEAM 1 WINS" ;
}

#include<iostream>
#include<cstdio>

using namespace std;
int kawsar(char ch)
{
    if(ch=='[' || ch==']') return 0;//paper
    if(ch=='(' || ch==')') return 1;//rock;
    return 2;//scissor
}
int main()
{
    int a,b,i,j,x,y,p;
    string k,u;
    cin>>k>>u;
    p=k.size();
    x=y=0;
    for(i=0;i<p;i++)
    {
        if(k[i]!=u[i])
        {
            a=kawsar(k[i]);
            b=kawsar(u[i]);
            if(a==0 && b==1) x++;
            else if(a==0 && b==2) y++;
            else if(b==0 && a==1) y++;
            else if(b==0 && a==2) x++;
            else if(b==1 && a==2) x++;
            else y++;
        }
    }
    if(x==y)
    cout<<"TIE"<<endl;
    else if(x>y)
    cout<<"TEAM 1 WINS"<<endl;
    else if(x<y)
    cout<<"TEAM 2 WINS"<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
string a,b;
int wina,winb;
int main(){
	cin>>a;
	cin>>b;
	for(int i=0;i<a.size();i++)
		if(i%2==0)
			if(a[i]=='8'&&b[i]=='['||a[i]=='{'&&b[i]=='8'||a[i]=='['&&b[i]=='{')
				wina++;
			else winb++;
	if(wina>winb)
		puts("TEAM 1 WINS");
	else if(wina<winb)
		puts("TEAM 2 WINS");
	else puts("TIE");
	return 0;
}

/*
	Akbar
*/
#include <bits/stdc++.h>

#define name ""
#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define sz(s) ((int) s.size ())
#define all(s) s.begin (), s.end ()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int base = 1000*1000*1000;
const int N = 100100;
const int inf = (int) 2e9;
const double pi = 3.1415926535897932384626433832795;

int main(){
        string a, b;
        cin >> a >> b;
        int A = 0, B = 0;
        for(int i = 0 ; i < a.size() ; i += 1){
                if(a[i] == '(')
                        A --;
                if(a[i] == '8')
                        A ++;
        }
        for(int i = 0 ; i < b.size() ; i += 2){
                if(b[i] == '(')
                        B --;
                if(b[i] == '8')
                        B ++;
        }
        if(A == B)
                puts("TIE");
        else if(A > B)
                puts("TEAM 1 WINS");
        else
                puts("TEAM 2 WINS");

        return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;

int change(char p) {
    switch (p) {
        case '[' : return 2;
        case '8' : return 1;
        case '(' : return 0;
    }
    return 0;
}

int main() {
    string P, Q;
    cin >> P >> Q;
    int ans = 0;
    for (int i = 0; i < P.size(); i += 2) {
         int a, b;
         a = change(P[i]);
         b = change(Q[i]);
         if (a == b) continue;
         if (a == (b + 1) % 3) ++ans; else --ans;
    }
    if (ans > 0) cout << "TEAM 1 WINS" << endl;
    if (ans < 0) cout << "TEAM 2 WINS" << endl;
    if (ans == 0) cout << "TIE" << endl;
    return 0;
}

#include <bits/stdc++.h>
typedef long long int64;
#define long int64
#define scanf error
#define printf error
#define to_string "std::string disabled, mingw32-4.7 bug, using windows for a server is lame"

using namespace std;

//=========================================================
// program:
//
int getId(string x)
{
    if (x == "8<") {
        return 0;
    } else if (x == "()") {
        return 1;
    } else {
        return 2;
    }
}

string whoWins(string team1, string team2)
{
    assert(team1.length() == team2.length());
    int score = 0;

    for (int i = 0; i < team1.size(); i += 2) {
        int a = getId(team1.substr(i,2));
        int b = getId(team2.substr(i,2));
        if (a == b + 1 || a + 3 == b + 1) {
            score++;
        }
        if (b == a + 1 || b + 3 == a + 1) {
            score--;
        }
    }
    string res[3] = { "TEAM2 WINS", "TIE", "TEAM1 WINS" };
    if (score != 0) {
        score /= abs(score);
    }
    return res[score + 1];
}

inline void init(){}
//=========================================================
// I/O:
//
int main()
{
    ios::sync_with_stdio(0);
    init();

    bool prev = false;
    string team1, team2;
    while( cin >> team1 >> team2) {
        if (prev) {
            cout << endl;
        }
        prev = true;
        cout << whoWins(team1, team2) << endl;
    }
    return 0;
}

#include <iostream>
#include <string.h>
#define t2w "TEAM 2 WINS"
#define t1w "TEAM 1 WINS"
#define tie "TIE"

using namespace std;

char team1[20], team2[20];
	int sum_1, sum_2;

int comb ( char arr[20], int i ) {
	if ( ( arr[i] == '(' ) && ( arr[i+1] == ')' )) return 1;
	else if ( arr[i] == '[' && arr[i+1] == ']' ) return 2;
	else if ( arr[i] == '8' && arr[i+1] == '<' ) return 3;
	return 1;
}

void points ( void ) {
	for ( int i = 0; i < (int) strlen ( team1 ); i+=2 ) {
		int comb_1 = comb ( team1, i );
		int comb_2 = comb ( team2, i );
		if ( comb_1 != comb_2 ) {
			if (( comb_1 == 2 && comb_2 == 1 ) ||
					( comb_1 == 1 && comb_2 == 3 ) ||
					( comb_1 == 3 && comb_2 == 2 )) ++sum_1;
			else ++sum_2;
		}
	}
}

int main () {
	scanf ( "%s\n%s", team1, team2 );

	points ();

	if ( sum_1 > sum_2 ) printf ( "%s\n", t1w );
	else if ( sum_1 < sum_2 ) printf ( "%s\n", t2w );
	else printf ( "%s\n", tie );
	//	}

	return 0;
}

#include <iostream>
#include <cstdio>

using namespace std;

int to(char c) {
    if(c == '8') return 3;
    else if(c == '[') return 2;
    else return 1;
}

int main()
{
    string s1, s2;
    while(cin >> s1 >> s2) {
        int p1 = 0;
        for(unsigned i = 0; i < s1.size(); i += 2) p1 += to(s1[i]) - to(s2[i]);
        if(p1 > 0) puts("TEAM 1 WINS");
        else if(p1 < 0) puts("TEAM 2 WINS");
        else puts("TIE");
    }
    return 0;
}

#include<iostream>
#include<cassert>
using namespace std;

int point(string s) {
	int p = 0;
	for(unsigned i = 0; i < s.size(); i += 2) {
		if(s[i] == '8') p += 3;
		else if(s[i] == '[') p += 2;
		else if(s[i] == '(') p += 1;
		else assert(false);
	}
	return p;
}

int main() {
	string a, b; cin >> a >> b;
	int pa = point(a), pb = point(b);
	if(pa == pb) cout << "TIE";
	else cout << "TEAM " << (pa > pb ? 1 : 2) << " WINS";
	return 0;
}

#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <stack>
#include <cmath>

using namespace std;
string a,b;
int cnt1,cnt2;
int main(){
	cin>>a>>b;
	for(int i=0;i<a.size();i++){
		if(a[i]=='8' && (b[i]=='('|| b[i]==')')) cnt2++;
		else

		if(b[i]=='8' && (a[i]=='('|| a[i]==')')) cnt1++;
		else
		if(a[i]=='8' && (b[i]=='['|| b[i]==']')) cnt1++;
		else
		if(b[i]=='8' && (a[i]=='['|| a[i]==']')) cnt2++;
		else
		if((a[i]=='('||a[i]==')') && (b[i]=='['|| b[i]==']')) cnt2++;
		else
		if((b[i]=='('||b[i]==')') && (a[i]=='['|| a[i]==']')) cnt1++;
	}
	if(cnt1==cnt2) cout<<"TIE";
	else
		if(cnt1>cnt2)cout<<"TEAM 1 WINS";
		else cout<<"TEAM 2 WINS";

}

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.A";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}
char act[]  = { '[', ']', '8', '<', '(', ')' };
int score[] = {  3,   4,   5,   6,   1,   2  };

int calc_score (string s ){
	int n = s.length();
	int res = 0;
	rep (i, n ){
		rep (j, sizeof (act )/sizeof (act[0] ) ){
			if (s[i] == act[j] ){
				res += score[j];
				break;
			} // end if
		} // end rep
	} // end rep

	return res;
}

int main()
{
//	cut here before submit
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	string s; cin >> s; int ss = calc_score (s );
	string t; cin >> t; int tt = calc_score (t );

//	cerr << "ss: " << ss << " tt: " << tt << endl;

	if (ss > tt ){
		cout << "TEAM 1 WINS" << endl;
	}else
	if (ss < tt ){
		cout << "TEAM 2 WINS" << endl;
	}else{
		cout << "TIE" << endl;
	} // end if

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char a[22],b[22];
int n,s,ss;

int main(){
  int i;
  scanf("%s",a);
  scanf("%s",b);
  n=strlen(a);
  s=0;
  for (i=0;i<n;++i)
    if (a[i]=='8') s+=3;
    else if (a[i]=='[') s+=2;
    else if (a[i]=='(') ++s;
  ss=0;
  for (i=0;i<n;++i)
    if (b[i]=='8') ss+=3;
    else if (b[i]=='[') ss+=2;
    else if (b[i]=='(') ++ss;
  if (s>ss) puts("TEAM 1 WINS");
  else if (s<ss) puts("TEAM 2 WINS");
  else puts("TIE");
  return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.A";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   1,  2,   3,   4,  5,   6 };
//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   3,   4,  5,   6 };

//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   4,   3,  5,   6 };
//const char act[]  = { '(', ')', '[', ']','8', '<'};
//const int score[] = {   2,  1,   4,   3,  6,   5 };
const char act[]  = { '(', ')', '[', ']','8', '<'};
const int score[] = {   1,  2,   3,   4,  6,   5 };

int main()
{
//	cut here before submit
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	string s; cin >> s;
	string t; cin >> t;

	map<char,int> u; u.clear();
	rep (i, sizeof(act )/sizeof (act[0] ) ){
		u[act[i]] = score[i];
	} // end rep

	int res = 0;
	rep (i, s.length() ){
		if (u[s[i]] > u[t[i]] ) res++;
		else
		if (u[s[i]] < u[t[i]] ) res--;
	} // end rep

	if (res > 0 ){
		cout << "TEAM 1 WINS" << endl;
	}else
	if (res < 0  ){
		cout << "TEAM 2 WINS" << endl;
	}else{
		cout << "TIE" << endl;
	} // end if

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif
	return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int f(char c){
	if(c=='[') return 0;
	if(c=='8') return 1;
	if(c=='(') return 2;
}
int main(){
	string s,t;
	int a=0,b=0;
	cin>>s>>t;
	for(int i=0;i<s.size();i+=2){
		int S=f(s[i]),T=f(t[i]);
		if(S==0 && T==1 || S==1 && T==2 || S==2 && T==0) a++;
		else if(S!=T) b++;
	}
	if(a>b) cout<<"TEAM 1 WINS";
	else if(a<b)cout<<"TEAM 2 WINS";
	else cout<<"TIE";
	return 0;
}

#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>

using namespace std;

#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define LL long long
#define forn(a,b) for(LL a=0; a<b; a++)
#define FOR1(a,b) for(LL a=1; a<=b;a++)
#define sortV(a) sort(A.begin(), A.end())
#define file freopen("input.txt","r",stdin)
#define y1 dfdfd
vector<LL> x1,x2,y1,y2;

int main()
{
    file;
    string s1;
    string s2;
    cin>>s1>>s2;
    int s=0;
    forn(i,s1.size()){
        if(s1[i]=='[')s+=2;
        if(s1[i]=='(')s+=1;
        if(s1[i]=='8')s+=3;
    }
    //cout<<s<<endl;
    forn(i,s2.size()){
        if(s2[i]=='[')s-=2;
        if(s2[i]=='(')s-=1;
        if(s2[i]=='8')s-=3;
    }
    if(s==0)cout<<"TIE";
    if(s>0)cout<<"TEAM 1 WINS";
    if(s<0)cout<<"TEAM 2 WINS";

}