#include<iostream>
#include<string>
#include<cstring>
#include<map>
using namespace std;
string m[13]={"0","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
int main()
{
string s;
cin>>s;
map<string,int> mp;
for(int i=1;i<=12;i++) mp[m[i]]=i;
string a=s.substr(0,3);
string b=s.substr(3);
cout<<mp[a]<<" "<<atoi(b.c_str())<<"\n";
return 0;
}