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