#include <stdio.h>
#include<string.h>
int main(void) {
int c, m, d, i, m1[13]={31,31,28,31,30,31,30,31,31,30,31,30,31};
char s[10], w[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
while(c--){
for(i=0;i<7;i++)
break;
//printf("%s\n",w[i]);
d-=i;
if(d<1){
m-=1;
//if(m%2==1) d+=31;
//else if(m==2) d+=28;
//else d+=30;
d+=m1[m];
}
for(i=0;i<6;i++){
if(d>m1[m])
//if((m==2)||(m%2==0&&d>30)||(d>31))
d=1;
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlPHN0cmluZy5oPgppbnQgbWFpbih2b2lkKSB7CiBpbnQgYywgbSwgZCwgaSwgbTFbMTNdPXszMSwzMSwyOCwzMSwzMCwzMSwzMCwzMSwzMSwzMCwzMSwzMCwzMX07CiBjaGFyIHNbMTBdLCB3WzddWzEwXT17IlN1bmRheSIsIk1vbmRheSIsIlR1ZXNkYXkiLCJXZWRuZXNkYXkiLCJUaHVyc2RheSIsIkZyaWRheSIsIlNhdHVyZGF5In07CiBzY2FuZigiJWQiLCZjKTsKIHdoaWxlKGMtLSl7CiAgc2NhbmYoIiVkJWQlcyIsJm0sJmQscyk7CiAgZm9yKGk9MDtpPDc7aSsrKQogICBpZihzdHJjbXAod1tpXSxzKT09MCkgCiAgICBicmVhazsKICAvL3ByaW50ZigiJXNcbiIsd1tpXSk7CiAgZC09aTsKICBpZihkPDEpewogICBtLT0xOwogICAvL2lmKG0lMj09MSkgZCs9MzE7CiAgIC8vZWxzZSBpZihtPT0yKSBkKz0yODsKICAgLy9lbHNlIGQrPTMwOwogICBkKz1tMVttXTsKICB9CiAgcHJpbnRmKCIlZCIsZCsrKTsKICBmb3IoaT0wO2k8NjtpKyspewogICBpZihkPm0xW21dKQogICAgLy9pZigobT09Mil8fChtJTI9PTAmJmQ+MzApfHwoZD4zMSkpCiAgICAgZD0xOwogICBwcmludGYoIiAlZCIsZCsrKTsKICB9CiAgcHJpbnRmKCJcbiIpOwogfQogcmV0dXJuIDA7Cn0=