#include<bits/stdc++.h>
using namespace std;
int main()
{
char a,b,c;
int d;
cin>>a>>b>>c>>d;
if(a=='J')
{
if(b=='a')
cout<<1<<" "<<d;
if(b=='u')
{
if(c=='n')
cout<<6<<" "<<d;
else
cout<<7<<" "<<d;
}
}
if(a=='M')
{
if(c=='r')
cout<<3<<" "<<d;
if(c=='y')
cout<<5<<" "<<d;
}
if(a=='F')
cout<<2<<" "<<d;
if(a=='S')
cout<<9<<" "<<d;
if(a=='O')
cout<<10<<" "<<d;
if(a=='N')
cout<<11<<" "<<d;
if(a=='D')
cout<<12<<" "<<d;
if(a=='A')
{
if(a=='p')
cout<<4<<" "<<d;
else
cout<<8<<" "<<d;
}
return 0;
}