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;
class process {
 private:
  vector<string> args;
  vector<int> path;

 public:
  vector<string> get_args() { return args; }
  void set_args(vector<string> args) { this->args = args; }
  vector<int> get_path() { return path; }
  void set_path(vector<int> path) { this->path = path; }
  friend ostream &operator<<(ostream &out, process p) {
    out << "args : \n";
    vector<string> args = p.get_args();
    vector<int> path = p.get_path();
    for (int i = 0; (i) < (int((args).size())); i++) {
      out << args[i] << " ";
    }
    out << endl;
    out << "path : \n";
    for (int i = 0; (i) < (int((path).size())); i++) {
      cout << path[i] << " ";
    }
    cout << endl;
    return out;
  }
};
vector<process> processes;
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  vector<int> vi1, vi2;
  for (int i = 0; (i) < (int((str1).size())); i++) {
    if (str1[i] == '[')
      vi1.push_back(2);
    else if (str1[i] == '(')
      vi1.push_back(1);
    else
      vi1.push_back(3);
    i++;
  }
  for (int i = 0; (i) < (int((str2).size())); i++) {
    if (str2[i] == '[')
      vi2.push_back(2);
    else if (str2[i] == '(')
      vi2.push_back(1);
    else
      vi2.push_back(3);
    i++;
  }
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; (i) < (int((vi1).size())); i++) {
    if (vi1[i] == vi2[i])
      continue;
    else if (vi1[i] == 1) {
      if (vi2[i] == 2)
        cnt2++;
      else
        cnt1++;
    } else if (vi1[i] == 2) {
      if (vi2[i] == 3)
        cnt2++;
      else
        cnt1++;
    } else {
      if (vi2[i] == 1)
        cnt2++;
      else
        cnt1++;
    }
  }
  if (cnt1 > cnt2) {
    cout << "TEAM 1 WINS" << endl;
  } else if (cnt1 < cnt2) {
    cout << "TEAM 2 WINS" << endl;
  } else
    cout << "TIE" << endl;
  return 0;
}