c=4-ord(input()[2]) m=1 while m<13:x=31^4460848>>2*m&3;print('%02d:'%m,*['%02d'%-~d for d in range(c%7,x,7)]);c-=x;m+=1