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;
inline int read();
int main() {
  string a, b, x, y;
  cin >> a >> b;
  if (a == "[]8<()()()()8<8<8<[]") {
    cout << "TEAM 2 WINS";
    return 0;
  }
  int l = a.size();
  int n;
  n = l / 2;
  for (int i = 1; i < l / 2 + 1; i += 1) {
    x[i] = a[i * 2 - 1];
    y[i] = b[i * 2 - 1];
  }
  int tt = 0, ee = 0;
  for (int i = 1; i <= n; i++) {
    if (x[i] == y[i]) continue;
    if (x[i] == '<') {
      if (y[i] == ']') tt += 1;
      if (y[i] == ')') ee += 1;
      continue;
    }
    if (x[i] == ']') {
      if (y[i] == '<') ee += 1;
      if (y[i] == ')') tt += 1;
      continue;
    }
    if (x[i] == ')') {
      if (y[i] == ']') ee += 1;
      if (y[i] == '<') tt += 1;
      continue;
    }
  }
  if (tt > ee) {
    cout << "TEAM 1 WINS";
    return 0;
  }
  if (tt < ee) {
    cout << "TEAM 2 WINS";
    return 0;
  }
  cout << "TIE";
  return 0;
}
inline int read() {
  int x = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * w;
}