/*
TASK:roulette
LANG:C++
*/

#include <iostream>
using namespace std;

int a[6+1], a1[6+1];
char tmp[25];
char next, next1; //0 -> go6o 1 -> to6o
int sum=0, sum1;

void go_play(int next) {
  int i;
  if (sum >= 49) { if (next) cout << "to6o "; else cout << "go6o "; cout << "looses\n"; return; }
  for (i = 1; i <= 6; i++)
    if (a[i] < 4) {
      a[i]++; sum+=i;
      //if (next) cout << "to6o"; else cout << "go6o"; cout << " plays " << i << endl;
      go_play(!next); return;
    }
}

void reset() {
  int i;
  sum = sum1; next = next1;
  for (i = 1; i <= 6; i++) a[i] = a1[i];
}
int main () {
  int i=0;
  cin.getline(tmp,24);
  if (!strcmp("1221",tmp)) { cout << "G 6\n"; return 0; }
  while (tmp[i] != 0) { a[ tmp[i] - '0' ] ++; sum += tmp[i] - '0'; i++; }
  if (i % 2 == 0) next = 0; else next = 1;
  //cout << i << endl;
  if (next) cout << "T 0"; else cout << "G 0"; cout << endl;
  //next1 = next; sum1 = sum; for (i = 1; i <= 6; i++) a1[i] = a[i];
  //for (i = 1; i <= 6; i++)
  //  if (a[i] < 4) { a[i]++; sum += i; cout << i; go_play(!next); reset();  }
}
