// editor3
#include<iostream>
#include<string>
using namespace std;
int main(){
    string a;
    string b;
    string op;
    cin>>a;
    cin>>b;
    if (a=="rock" && b=="rock"){
        op="TIE";
        
    }
    else if (a=="paper" && b =="paper"){
        cout<<"TIE";
    }
    else if (a=="scissors" && b=="scissors"){
        cout<<"TIE";
    }
    else if (a=="rock" && b=="paper"){
        cout<<"Player 2 wins";
        
    }
    else if (a=="rock" && b=="scissors"){
        cout<<"Player 1 wins";
        
    }    
    else if (b=="rock" && a=="paper"){
        cout<<"Player 1 wins";
        
    }
    else if (b=="rock" && a=="scissors"){
        cout<<"Player 2 wins";
        
    }
    else 
    { 
        cout<<"Invalid input"
    }
    

    return 0;
    
    
    

}