#include<iostream>
#include<string>
using namespace std;
int main(){
    string x,y,a,b;
    cin>>x;
    cin>>y;
    a = x.lower();
    b = y.lower();
    if (a == "rock" && b == "scissors" || a == "scissors" && b == "paper" || a == "paper" && b == "rock"){
        cout<<"Player 1 wins";
    }
    else if (a == "scissors" && b == "rock" || a == "paper" && b == "scissors" || a == "rock" && b == "paper"){
        cout<<"Player 2 wins";
    }
    else{ cout<<"Invalid input"; }
    return 0;
}