main(n,s){for(;gets(s);strftime(s,s,"%-m %B",&n-4)>4&&puts())n=atoi()-1;}