#include<stdio.h>
int IsLeap(int year)
{
if(year%4==0&&year%100!=0||year%400==0)
return(1);
return(0);
}
int main()
{
int d,year,month,day,tday;
long n;
while(EOF!=(scanf("%d",&n))&&n!=-1)
{
year=2001;month=1;day=1;tday=6;
while(n!=0)
{
if(IsLeap(year)==1)
y=366;
else
y=365;
if(n>=y)
{
n=n-y;
year=year+1;
}
else
break;
}
while(n)
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:d=31;break;
case 4:
case 6:
case 9:
case 11:d=30;break;
case 2:
{
if(IsLeap(year)==1)
d=29;
else
d=28;
break;
}
}
if(n>=d)
{
n=n-d;
month=month+1;
}
else
{
day=day+n;
n=0;
}
}
printf("%d-%d-%d ",year,month,day);
tday=(n%7+tday)%7;
switch(tday)
{
case 0:printf("Sunday\n");break;
case 1:printf("Monday\n");break;
case 2:printf("Tuesday\n");break;
case 3:printf("Wednesday\n");break;
case 4:printf("Thursday\n");break;
case 5:printf("Friday\n");break;
case 6:printf("Saturday\n");break;
}
}
return(0);
}