Problem: Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion.

Input

The input contains two strings of equal length (between 2 and 20 characters, inclusive). Each line describes the actions of one team.

Output

Output "TEAM 1 WINS" if the first team won, "TEAM 2 WINS" if the second team won, and "TIE" if there was a tie.

Examples

Input

[]()[]8&lt;
8&lt;[]()8&lt;


Output

TEAM 2 WINS


Input

8&lt;8&lt;()
[]8&lt;[]


Output

TIE

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T Abs(T first) {
  return (first < 0 ? -first : first);
}
template <typename T>
T Sqr(T first) {
  return (first * first);
}
string plural(string s) {
  return (int((s).size()) && s[int((s).size()) - 1] == 'x' ? s + "en"
                                                           : s + "s");
}
const int INF = (int)1e9;
const long double EPS = 1e-9;
const long double PI = acos(-1.0);
bool Read(int &first) {
  char c, r = 0, n = 0;
  first = 0;
  for (;;) {
    c = getchar();
    if ((c < 0) && (!r)) return (0);
    if ((c == '-') && (!r))
      n = 1;
    else if ((c >= '0') && (c <= '9'))
      first = first * 10 + c - '0', r = 1;
    else if (r)
      break;
  }
  if (n) first = -first;
  return (1);
}
int main() {
  if (0) freopen("in.txt", "r", stdin);
  string s1, s2;
  int v1 = 0, v2 = 0;
  cin >> s1 >> s2;
  int n = int((s1).size()), i;
  for (i = 0; i < n; i += 2) {
    int m1, m2;
    if (s1[i] == '(')
      m1 = 0;
    else if (s1[i] == '[')
      m1 = 1;
    else
      m1 = 2;
    if (s2[i] == '(')
      m2 = 0;
    else if (s2[i] == '[')
      m2 = 1;
    else
      m2 = 2;
    if ((m2 - m1 + 3) % 3 == 1) v2++;
    if ((m1 - m2 + 3) % 3 == 1) v1++;
  }
  if (v1 == v2)
    printf("TIE\n");
  else if (v1 > v2)
    printf("TEAM 1 WINS\n");
  else
    printf("TEAM 2 WINS\n");
  return (0);
}