// editor1
#include <iostream>
using namespace std;
int main(){
    int player1, player2, move1, move2;
    
    cin>>move1
    player1= move1;
    cin>>move2;
    player2 = move2;
    
    if( move1 = "rock", move2 = "rock"){
        cout<<"TIE"<<endl;
    }
    if( move1 = "paper", move2 = "paper"){
        cout<<"TIE"<<endl;
    }
    if( move1 = "scissors", move2 = "scissors"){
        cout<<"TIE"<<endl;
    }
    
    if( move1= "rock", move2 = "scissors"){
        cout<<"Player 1 wins"<<endl;
    }
    
    if( move1= "rock" , move2= "paper"){
        cout<<"Player 2 wins"<<endl;
    }
    if( move1= "paper", move2 = "rock"){
        cout<<"Player 1 wins"<<endl;
    }
    
    if( move1= "paper" , move2= "scissors"){
        cout<<"Player 2 wins"<<endl;
    }
    if( move1= "scissors", move2 = "paper"){
        cout<<"Player 1 wins"<<endl;
    }
    
    if( move1= "scissors" , move2= "rock"){
        cout<<"Player 2 wins"<<endl;
    }
    
    else{
        cout<<"Invalid Input"<<endl;
    }
    
    return 0;
    
}