semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{
	int year,month,day,i,j=0,first;
	scanf("%d%d%d",&year,&month,&day);
	j=(year-1)/400*97+((year-1)%400)/100*24+((year-1)%100)/4;
	first=(year+j)%7;
	
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=0;i<month-1;i++)
	{
		day=day+monthday[i];
	}
	if(year%4==0)
	{
		if(year%100==0)
		{
			if(year%400==0)
			{
				if(month>2)
				day++;
			}
		}
		else 
			if(month>2)
			day++;
	}
	//printf("%d %d %d\n",j,first,day);
	int weekday=(day-1+first)%7;
	switch(weekday)
	{
	case 0:printf("Sun.\n");break;
	case 1:printf("Mon.\n");break;
	case 2:printf("Tue.\n");break;
	case 3:printf("Wed.\n");break;
	case 4:printf("Thu.\n");break;
	case 5:printf("Fri.\n");break;
	case 6:printf("Sat.\n");break;
	}
	return 0;
}
int main(int argc, char* argv[])
{
    int y,m,d,total,i;
	int md[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&y,&m,&d);
	total=0;
	if(y>400){
		y=400+(y-400)%400;
		}
	if((y%4==0&&y%100!=0)||(y%400==0)){
		md[1]=(29);
	}
	for(i=1;i<m;i++){
		total+=(md[i-1]%7);
	}
	total=total+(d%7);
	int n,j;
	n=total;
    for (j=1;j<y;j++){
       	if((j%4==0&&j%100!=0)||(j%400==0)){
			n=n+(366%7);
		}
		else{
			n=n+(365%7);
		}
	}
	switch (n%7){
	case 0 :{
		printf("Sun.\n");
		break;
			}
	case 1 :{
		printf("Mon.\n");
		break;
			}
	case 2 :{
		printf("Tue.\n");
		break;
			}
	case 3 :{
		printf("Wed.\n");
		break;
			}
	case 4 :{
		printf("Thu.\n");
		break;
			}
	case 5 :{
		printf("Fri.\n");
		break;
			}
	case 6 :{
		printf("Sat.\n");
		break;
			}
	}
	return 0;
}
int rn(int year);
int dn(int year,int month,int day);
int rns(int year);

int rns(int year){
	int x;
	x=year/100*24+(year%100)/4+year/400;
	return x;
}

int main(){
	int y,m,d;
	int xq;
	int daysum;
	cin>>y>>m>>d;
	//rns=0;
	//for(i=1;i<y;i++) {if(rn(i)==1) rns++;}
	daysum=((y-1)*(365%7))%7+rns(y-1)+dn(y,m,d);
	xq=daysum%7;

	switch(xq){
	case 0: cout<<"Sun."; break;
	case 1: cout<<"Mon."; break;
	case 2: cout<<"Tue."; break;
	case 3: cout<<"Wed."; break;
	case 4: cout<<"Thu."; break;
	case 5: cout<<"Fri."; break;
	case 6: cout<<"Sat.";break;
	default:;}
	return 0;
}




int dn(int year,int month,int day){			//  ????????????
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int i ,sum;
	sum=0;
	for(i=0;i<(month-1);i++) sum+=a[i];
	sum+=day;
	if (rn(year)==1&&month>=3) sum+=1;
	return sum;
}


int rn(int year){                             //?????????? 1?true 0?false
	if(year%4==0&&year%100!=0) return 1;
	if(year%100==0&&year%400==0) return 1;
	return 0;
}
int isrunnian(int year){
    if(year%400 == 0 ||(year%4==0 && year%100!=0))
    return 1;
    return 0;
}
int main(){
    int i,year,month,date,sum;
    int montha[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},
                       {31,29,31,30,31,30,31,31,30,31,30,31}};
    scanf("%d%d%d",&year,&month,&date);
    sum=(year%7+(year-1)/4-(year-1)/100+(year-1)/400);

    for(i=0;i<month-1;i++){
                         sum+=montha[isrunnian(year)][i]%7;
                         sum%=7;
                         }                    
    sum+=date-1;
    sum=sum%7;
    char *weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
    printf("%s.",weekdays[sum]);
    return 0;
}
int main()
{
	int year,m,d,i,x,k;
	int s=0;
	scanf("%d%d%d",&year,&m,&d);
     s=(year-1)*1+(year-1)/4+(year-1)/400-(year-1)/100;
	for (k=1;k<m;k++)
		{
			if(k==1||k==3||k==5||k==7||k==8||k==10 || k==12)
			{
				s+=31;
			}
			if(k==4||k==6||k==9||k==11)
			{
				s+=30;
			}
			if((k==2)&&(((year%4==0)&&(year%100!=0))||(year%400==0)))
			{
				s+=29;
			}
			else
			{
				s+=28;
			}
			
		}
		s+=d;
		x=s%7;
		if(x==1){
			printf("Mon.");
		}
	    if(x==2){
			printf("Tue.");
		}
		if(x==3){
			printf("Wed.");
		}
		if(x==4){
			printf("Thu.");
		}
		if(x==5){
			printf("Fri.");
		}
		if(x==6){
			printf("Sat.");
		}
		if(x==0){
			printf("Sun.");
		}
		return 0;
	}
int main()
{  

int n=0,a,b,c,d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
cin>>a>>b>>c;

for(int i=1;i<=(a-1)%400;++i)
{
if(i%400==0||(i%4==0&&i%100!=0))
n+=2;
else
n+=1;
}

if(a%400==0||(a%4==0&&a%100!=0))
++d[2];

for(int i=1;i<b;++i)
	n+=d[i];
n=(n+c-1)%7;
switch (n)
{
case 0:cout<<"Mon.";break;
case 1:cout<<"Tue.";break;
case 2:cout<<"Wed.";break;
case 3:cout<<"Thu.";break;
case 4:cout<<"Fri.";break;
case 5:cout<<"Sat.";break;
default:cout<<"Sun.";

}
return 0;

}
/*
 * xingqiji.cpp
 *
 *  Created on: 2010-11-19
 *      Author: Administrator
 */
int main(){
	long long year;
	int month,day,i,num;
	cin>>year>>month>>day;
    long long a,b,c;
    a=(long long)(year-1)/4;
    b=(long long)(year-1)/100;
    c=(long long)(year-1)/400;
    num=a-b+c;
	long long sum;
	sum=(year-1)*365+num;
	int imonth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	if(year%4==0){
		if(year%100!=0)  imonth[1]=29;
		if(year%400==0)  imonth[1]=29;
	}
	for(i=0;i<month-1;i++){
		sum=sum+imonth[i];
	}
	sum=sum+day;
	long long week;
	week=sum%7;
	switch(week){
	case 0:cout<<"Sun."<<endl; break;
	case 1:cout<<"Mon."<<endl; break;
	case 2:cout<<"Tue."<<endl; break;
	case 3:cout<<"Wed."<<endl; break;
	case 4:cout<<"Thu."<<endl; break;
	case 5:cout<<"Fri."<<endl; break;
	case 6:cout<<"Sat."<<endl; break;
	}
	return 0;
}
int main()
{
	int year, mon, day;
	cin >> year >> mon >> day;
	int y,m,sumd=0,lunar=0;
	while (year > 2800)
	{
		year = year % 2800;
	}
	for (y = 1; y < year; y++)
	{
		if ((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0))
		{
			sumd += 366;
		}
		else
		{
			sumd += 365;
		}
	}
	if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
	{
		lunar = 1;
	}
	for (m = 1; m < mon; m++)
	{
		if ((m == 1) || (m == 3) || (m == 5) || (m == 7) || (m == 8) || (m == 10))
		{
			sumd += 31;
		}
		else if ((m == 4) || (m == 6) || (m == 9) || (m == 11))
		{
			sumd += 30;
		}
		else if ((m == 2) && (lunar == 1))
		{
			sumd += 29;
		}
		else
		{
			sumd += 28;
		}
	}
	sumd += day;
	int a = sumd % 7;
	if (a == 0)
		cout << "Sun." << endl;
	if (a == 1)
		cout << "Mon." << endl;
	if (a == 2)
		cout << "Tue." << endl;
	if (a == 3)
		cout << "Wed." << endl;
	if (a == 4)
		cout << "Thu." << endl;
	if (a == 5)
		cout << "Fri." << endl;
	if (a == 6)
		cout << "Sat." << endl;
	return 0;
}
int main()
{
	int a,b,c,n,x,t=0,i=0,j,o;
	char f[100],g[5];
	scanf("%s%d%d",f,&b,&c);
	o=strlen(f);
	if (o>6)
	{
	for(j=o-5;j<o;j++)
	{
		
		g[i]=f[j];
		i++;
	}
	a=atoi(g);
	
	}
	else
	{
		a=atoi(f);
	}
	a=a%400;
	x=a/100;
	for(i=1;i<b;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10)
		{
			t=t+31;
		}
		else if (i==2)
		{
			t=t+28;
		}
		else
		{
			t=t+30;
		}
	}
	n=(a-1)*365+(a/4-x)+t+c-1;
	n=n%7;
	if(b<3)
		n=n-1;
	if(n<0)
		n=n+7;
	switch(n)
	{
	case 0 : printf("Mon.\n");break;
	case 1 : printf("Tue.\n");break;
	case 2 : printf("Wed.\n");break;
	case 3 : printf("Thu.\n");break;
	case 4 : printf("Fri.\n");break;
	case 5 : printf("Sat.\n");break;
	case 6 : printf("Sun.\n");break;
	}
	return 0;

}
void main()
{
   unsigned long  a,m,d,i,d1,d2,t;
   scanf("%u%u%u",&a,&m,&d);
   d1=a/4-a/100+a/400;
   if((a%4==0&&a%100!=0)||a%400==0)
   {
    switch(m)
	{
   case 1:d2=-1;break;
   case 2:d2=30;break;
   case 3:d2=59;break;
   case 4:d2=90;break;
   case 5:d2=120;break;
   case 6:d2=151;break;
   case 7:d2=181;break;
   case 8:d2=212;break;
   case 9:d2=243;break;
   case 10:d2=273;break;
   case 11:d2=304;break;
   case 12:d2=334;break;
	}
	i=(a-1)+d1+d2+d;
   }
   else
   {
    switch(m)
	{
   case 1:d2=0;break;
   case 2:d2=31;break;
   case 3:d2=59;break;
   case 4:d2=90;break;
   case 5:d2=120;break;
   case 6:d2=151;break;
   case 7:d2=181;break;
   case 8:d2=212;break;
   case 9:d2=243;break;
   case 10:d2=273;break;
   case 11:d2=304;break;
   case 12:d2=334;break;
	}
   	i=(a-1)+d1+d2+d;
   }
    t=i%7;
	 switch(t)
	{ 
   case 0:printf("Sun.");break;
   case 1:printf("Mon.");break;
   case 2:printf("Tue.");break;
   case 3:printf("Wed.");break;
   case 4:printf("Thu.");break;
   case 5:printf("Fri.");break;
   case 6:printf("Sat.");break;
  
	}
}
int isrunnian (int year);
int dijitian (int year,int month,int day);
int main (){
int year,month,day,a,i,r;
scanf("%d %d %d",&year,&month,&day);
getchar();
a=dijitian(year,month,day);
r=(year-2+(year-1)/400+(year-1)/4-(year-1)/100+a)%7;
if(r==0){
           printf("Mon.");
           getchar();
           }else if(r==1){
           printf("Tue.");
           getchar();
           }else if(r==2){
           printf("Wed.");
           getchar();
           }else if(r==3){
           printf("Thu.");
           getchar();
           }else if(r==4){
           printf("Fri.");
           getchar();
           }else if(r==5){
           printf("Sat.");
           getchar();
           }else if(r==6){
           printf("Sun.");
           getchar();
           }                     
return 0;
}
int dijitian(int year,int month,int day){
    int t=0,i;
    for (i=1;i<month;i++){
        if((i==1)||(i==3)||(i==5)||(i==7)||(i==8)||(i==10)||(i==12)){
            t+=31%7;
            }else if((i==4)||(i==6)||(i==9)||(i==11)){
            t+=30%7;
            }else if(i==2){
                  if(year%400==0||(year%4==0&&year%100!=0)){
                     t+=29%7;
                     }else{
                     t+=28%7;
                     }
                  }
        }
    t+=day;
        return t;
}
int main (){
	int year,month,day,dayName;
	int sum=0;
	int i,j;
	scanf("%d %d %d",&year,&month,&day);
	sum += sum + year -1 + (year-1)/4 -(year-1)/100 + (year-1)/400;
	sum = sum % 7;
	for (i=1;i<month;i++){
		if (i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12){
			sum +=31;
			continue;
		}
		if (i==4 || i==6 || i==9 || i==11)	{
			sum +=30;
			continue;
		}
		if (( year%4 == 0 && year%100 != 0) || year%400 == 0)
			 sum += 29;
		else sum += 28;
	}
	sum += day;
	dayName = sum%7;
	switch(dayName){
		case 1 :
			printf("Mon.");
			break;
		case 2 : 
			printf("Tue.");
			break;
		case 3 :
			printf("Wen.");
			break;
		case 4 :
			printf("Thu.");
			break;
		case 5 :
			printf("Fri.");
			break;
		case 6 :
			printf("Sat.");
			break;
		case 0 :
			printf("Sun.");
			break;
	}


	


}
int main()
{
	int y,m,d,numofafter=0,num=0,final=0;
	double numofleap;
	char xingqi[8][5]={"0","Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>y>>m>>d;
	numofleap=floor((y-1)/4.0)-(floor((y-1)/100.0)-floor(floor((y-1)/100.0)/4.0));
	numofafter=numofleap*2+y-numofleap-1;
	int start=0;
	start=numofafter%7+1;
	if((y%4==0&&y%100!=0)||(y%400==0))
		mon[2]=29;
	for(int i=0;i<m;i++)
		num=num+mon[i];
	num=num+d;
	final=(num%7+start-1)%7;
	    cout<<xingqi[final]<<endl;
	return 0;
}
int main()
{
	int year,month1,day;
	cin>>year>>month1>>day;
	char week[7][200]={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"};
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int y;
	int yy=year-1;
	y=(yy/4+yy-yy/100+yy/400)%7;
    
	int sum=0;
	int i;
	if(((year%4==0)&&(year%100)!=0)||(year%400==0))
	{
		month[2]=month[2]+1;
	    for(i=1;i<month1;i++)
	    {
	    	sum=sum+month[i];
	    }
	    sum=sum+day;
		
	}
	else
	{
	 for(i=1;i<month1;i++)
	    {
	    	sum=sum+month[i];
	    }
	    sum=sum+day;	
	}
	cout<<week[(y+sum-1)%7]<<".";
	
}
int main()
{
	int year,month,day,d,sum=0,i,e,f,g;
	scanf("%d %d %d",&year,&month,&day);
	e=(year-1)/4;
         f=(year-1)/100;
         g=(year-1)/400;
         sum=(e-f+g)*2+(year-e+f-g-1)*1;

	for(i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			sum=sum+31;
		}
		if(i==2){
			if(((year%4==0)&&(year%100!=0))||year%400==0){
				sum=sum+29;
			}
			else
			{
				sum=sum+28;
			}
		}
		else if(i==4||i==6||i==9||i==11){

			sum=sum+30;
		}
	}
   sum=sum+day;

	d=sum%7;
	if(d==0)
		printf("Sun.");
    if(d==1)
		printf("Mon.");
    if(d==2)
		printf("Tue.");
    if(d==3)
		printf("Wed.");
    if(d==4)
		printf("Thu.");
    if(d==5)
		printf("Fri.");
    if(d==6)
		printf("Sat.");


	return 0;
}
int main()
{
	int Y, M, D, m, m1=0, n1, n2, n3, n, i;
	scanf("%d%d%d", &Y, &M, &D);
	if((Y-1)%400==0)
	{
		n1=0;
	}
	else
	{
		n1=0;
		for(i=(Y-1)/400*400;i<=Y-1;i++)
		{
			if(i%400==0||i%4==0&&i%100!=0)
			{
				n1=n1+2;
			}
			else
			{
				n1=n1+1;
			}
		}
	}
	for(m=1;m<M;m++)
	{
		if(m==1||m==3||m==5||m==7||m==8||m==10)
		{
			m1=m1+31;
		}
		else if(m==4||m==6||m==9||m==11)
		{
			m1=m1+30;
		}
		else if(m==2)
		{
			if(Y%400==0||Y%4==0&&Y%100!=0)
			{
				m1=m1+29;
			}
			else
			{
				m1=m1+28;
			}
		}
    }
    n2=m1%7;
    n3=D%7;
    n=n1+n2+n3-2;
    if(n%7==1)
    {
        printf("Mon.");
    }
    else if(n%7==2)
    {
        printf("Tue.");
    }
    else if(n%7==3)
    {
         printf("Wed.");
    }
    else if(n%7==4)
    {
         printf("Thu.");
    }
    else if(n%7==5)
    {
         printf("Fri.");
    }
    else if(n%7==6)
    {
         printf("Sat.");
    }
    else 
    {
         printf("Sun.");
    }
    scanf(" ");
    return 0;
}
int main()
{
	long a,b,c,m,n,t,w;
         int i=0;
	scanf("%ld %ld %ld",&a,&b,&c);
         if(a%400!=0)
       {
         	m=a/400*400+1;
	for(;m<a;m++)
         {
           if(!((m%4==0&&m%100!=0)||m%400==0))
           continue;
           i=i+1;
         }
        }
         else
         m=a-399;
         for(;m<a;m++)
         {
           if(!((m%4==0&&m%100!=0)||m%400==0))
           continue;
           i=i+1;
         }

         if(a%400!=0)
         	n=365*(a-a/400*400-1)+i;
         else
         n=365*399+i;	
         switch(b)
	{
	case 1:t=c;break;
	case 2:t=c+31;break;
	case 3:t=c+31+28;break;
	case 4:t=c+31+28+31;break;
	case 5:t=c+31+28+31+30;break;
	case 6:t=c+31+28+31+30+31;break;
	case 7:t=c+31+28+31+30+31+30;break;
         case 8:t=c+31+28+31+30+31+30+31;break;
         case 9:t=c+31+28+31+30+31+30+31+31;break;
         case 10:t=c+31+28+31+30+31+30+31+31+30;break;
	case 11:t=c+31+28+31+30+31+30+31+31+30+31;break;
	case 12:t=c+31+28+31+30+31+30+31+31+30+31+30;
	}
         if(((a%4==0&&a%100!=0)||a%400==0)&&(b>=3))
         t=t+1;
	w=(n+t)%7;
         switch(w)
	{
	case 0:printf("Sun.\n");break;
	case 1:printf("Mon.\n");break;
	case 2:printf("Tue.\n");break;
	case 3:printf("Wed.\n");break;
	case 4:printf("Thu.\n");break;
	case 5:printf("Fri.\n");break;
	case 6:printf("Sat.\n");break;
         default:printf("error\n");
	}
	return 0;
}
void main()
{
	int x,y,z,a,b,c,d,e,f,g,h;
	scanf("%d%d%d",&x,&y,&z);
	a=x/400;b=x%400;
	c=b/100;d=b%100;
	e=d/4;f=d%4;
	g=c*5+e*5+365*(f-1)+700;
	switch(y)
	{
	    case 1:g=g+z;break;
	    case 2:g=g+z+31;break;
		case 3:g=g+z+59;break;
		case 4:g=g+z+90;break;
		case 5:g=g+z+120;break;
		case 6:g=g+z+151;break;
		case 7:g=g+z+181;break;
		case 8:g=g+z+212;break;
		case 9:g=g+z+243;break;
		case 10:g=g+z+273;break;
		case 11:g=g+z+304;break;
		case 12:g=g+z+334;break;
	}
	if((b==0&&y<3)||(e!=0&&f==0&&y<3))
		g=g-1;
	h=g%7;
	switch(h)
	{
		case 1:printf("Mon.\n");break;
	    case 2:printf("Tue.\n");break;
		case 3:printf("Wed.\n");break;
		case 4:printf("Thu.\n");break;
		case 5:printf("Fri.\n");break;
		case 6:printf("Sat.\n");break;
		case 0:printf("Sun.\n");break;
	}
}
void main()
{
	long year,mon,day,n,x,y;
	scanf("%d%d%d",&y,&mon,&day);
	year=y%200000;
	n=365*(year-1);
	switch(mon)
	{
	case 1:n=n+0;break;
	case 2:n=n+31;break;
	case 3:n=n+59;break;
	case 4:n=n+90;break;
    case 5:n=n+120;break;
	case 6:n=n+151;break;
	case 7:n=n+181;break;
	case 8:n=n+212;break;
	case 9:n=n+243;break;
	case 10:n=n+273;break;
	case 11:n=n+304;break;
    case 12:n=n+334;
	}
	n=n+day;
	if(mon<3) n=n+((year-1)/4)-((year-1)/100)+((year-1)/400);
	else n=n+(year/4)-(year/100)+(year/400);
	x=n%7;
	switch(x)
	{
	case 1:printf("Mon.");break;
	case 2:printf("Tue.");break;
	case 3:printf("Wed.");break;
	case 4:printf("Thu.");break;
	case 5:printf("Fri.");break;
	case 6:printf("Sat.");break;
	case 0:printf("Sun.");
	}
}
int main()
{
	int n,m,d,cnt=0,cntpingnian=0,cntyiqian=0,cntrunnian=0,cntthisyear=0,i,a1[13]={31,28,31,30,31,30,31,31,30,31,30,31},a2[13]={31,29,31,30,31,30,31,31,30,31,30,31};
	cin>>n>>m>>d;
	cntrunnian=(n-1)/4-(n-1)/100+(n-1)/400;
	cntpingnian=n-1-cntrunnian;
	cntyiqian=cntpingnian+2*cntrunnian;
	if((n%4==0&&n%100!=0)||(n%400==0))
	{
		for(i=0;i<m-1;i++)
			cntthisyear+=a2[i];
		cntthisyear+=d;
	}
	else
	{
		for(i=0;i<m-1;i++)
			cntthisyear+=a1[i];
		cntthisyear+=d;
	}
	cnt=cntyiqian+cntthisyear-1;
	i=cnt%7;
	switch(i)
	{
		case 0:cout<<"Mon."<<endl;break;
		case 1:cout<<"Tue."<<endl;break;
		case 2:cout<<"Wed."<<endl;break;
		case 3:cout<<"Thu."<<endl;break;
		case 4:cout<<"Fri."<<endl;break;
		case 5:cout<<"Sat."<<endl;break;
		case 6:cout<<"Sun."<<endl;break;
	}


	return 0;
}
int main(){
	int year,month,date;
	int i,n=0,xq;
	scanf("%d%d%d",&year,&month,&date);
    year=year%400;
	if(year==0){
		year=400;
	}
	for(i=1;i<year;i++){
		if(i%4==0&&i%100!=0||i%400==0){
			n+=366;
		}else{
			n+=365;
		}
	}
	for(i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10){
			n+=31;
		}else if(i==4||i==6||i==9||i==11){
			n+=30;
		}else{
			if(year%4==0&&year%100!=0||year%400==0){
				n+=29;
			}
			else{
				n+=28;
			}
		}
	}
	n+=date;
	xq=n%7;
	switch(xq){
	    case 0:printf("Sun.");break;
        case 1:printf("Mon.");break;
        case 2:printf("Tue.");break;
        case 3:printf("Wed.");break;
        case 4:printf("Thu.");break;
        case 5:printf("Fri.");break;
        case 6:printf("Sat.");break;
	}
	return 0;
}
void main()
{

int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int temp=0;
temp=((a-1)*(365%7)+(a-1)/4-(a-1)/100+(a-1)/400)%7;
if (b==1) temp=temp+0;
if (b==2) temp=temp+3;
if (b==3) temp=temp+3;
if (b==4) temp=temp+6;
if (b==5) temp=temp+1;
if (b==6) temp=temp+4;
if (b==7) temp=temp+6;
if (b==8) temp=temp+2;
if (b==9) temp=temp+5;
if (b==10) temp=temp+0;
if (b==11) temp=temp+3;
if (b==12) temp=temp+5;

if (((a%400==0)||((a%4==0)&&(a%100!=0)))&&(b>2))
temp++;
temp=(temp+c-1)%7;
if (temp==0) printf("Mon.");
if (temp==1) printf("Tue.");
if (temp==2) printf("Wed.");
if (temp==3) printf("Thu.");
if (temp==4) printf("Fri.");
if (temp==5) printf("Sat.");
if (temp==6) printf("Sun.");
}
int main()
{
	int i,y,m,d,sum=0;
	scanf("%d%d%d",&y,&m,&d);
	y=y%400;
	if(y==0)
		y=400;
	for(i=1;i<y;i++)
	{
		if(i%4==0&&i%100!=0||i==400)
		    sum+=2;
		else
			sum++;
	}
	for(i=1;i<m;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			sum+=3;
		else if(i==4||i==6||i==9||i==11)
			sum+=2;
		else 
		{
			if(y%4==0&&y%100!=0||y==400)
               sum++;
		}
	}
	sum+=d;
	sum%=7;
	switch(sum)
	{
	case 0:
		printf("Sun.");
		break;
	case 1:		
		printf("Mon.");
		break;
	case 2:	
		printf("Tue.");
		break;
	case 3:	
	    printf("Wen.");
		break;
	case 4:	
		printf("Thu");
		break;
	case 5:	
    	printf("Fri.");
		break;
	case 6:
    	printf("Sat.");
		break;
	}
	return 0;
}
int main()
{
 unsigned long  year,month,day,i,n,a,b,total,c;
 unsigned long  s[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
 scanf("%d %d %d",&year,&month,&day);
 n=(year-1)/4-(year-1)/100+(year-1)/400;
 if((year%4==0&&year%100!=0)||year%400==0)
  s[2]=29;
    b=0;
 for(a=1;a<month;a++)
  b=b+s[a];
 total=year-1+n+b+day;
 c=total%7;
switch (c)
 {
 case 0:
  printf("Sun.");
  break;
 case 1:
  printf("Mon.");
  break;
 case 2:
  printf("Tue.");
  break;
 case 3:
  printf("Wed.");
  break;
 case 4:
  printf("Thu.");
  break;
 case 5:
  printf("Fri.");
  break;
 case 6:
  printf("Sat.");
  break;
 }
return 0;
}
void main()
{
	long int n,y,r,t=0,k,i,m,j,z,yu;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d",&n,&y,&r);
	if(n>10000)
		n=n%2000;
	k=n/100;
	m=n/400;
	i=n/4-(k-m);
	if(y==1)
		t=0;
	else
	{
		for(j=0;j<y-1;j++)
		t=t+a[j];
	}
	z=365*(n-1)+i+t+r;
	if(y==2&&r==29)
		z=z-1;
	yu=z%7;
	if(yu==0)
		printf("Sun.");	
	else if(yu==1)
		printf("Mon.");
	else if(yu==2)
		printf("Tue.");
	else if(yu==3)
		printf("Wed.");
	else if(yu==4)
		printf("Thu.");
	else if(yu==5)
		printf("Fri.");
	else if(yu==6)
		printf("Sat.");


	}
int main(int argc, char* argv[])
{   int year,month,day,weekday;
	int total=0,total1=0;
	int i;
    int monthday[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},
			     {31,29,31,30,31,30,31,31,30,31,30,31}}; 
	scanf("%d %d %d",&year,&month,&day);
         year = year%400  + 400;
	for(i=1;i<year;i++)
	{
		if(((i%4==0)&&(i%100!=0))||(i%400==0))
			total=total+366%7;
		else
			total=total+365%7;
	}
    
	if(((year%4==0)&&(year%100!=0))||(year%400==0))
	{
		
			for(i=0;i<month-1;i++)
				total1=total1+monthday[1][i];
				total=total+total1%7;
		    
	}
	else
	{
		
			for(i=0;i<month-1;i++)
				total=total+monthday[0][i];
				total=total+total1%7;
		    
	}
	total=total+day%7;
    weekday=total%7;
	
	switch(weekday)
	{
		case 1:printf("Mon.");break;
		case 2:printf("Tue.");break;
		case 3:printf("Wed.");break;
		case 4:printf("Thu.");break;
		case 5:printf("Fri.");break;
		case 6:printf("Sat.");break;
		case 0:printf("Sun.");break;
	}
	return 0;
}
int main()
{
	int year,month,date;
	scanf("%d %d %d",&year,&month,&date);
	int mon[PI];
	mon[1]=mon[3]=mon[5]=mon[7]=mon[8]=mon[10]=mon[12]=31;
	mon[4]=mon[6]=mon[9]=mon[11]=30;

	int i,x,tmp,tyear;
	int sum=0;

	tyear=(year-1)%400;

//	printf("tyear=%d\n",tyear);
	
	for (i=1;i<=tyear;i++)
	{
		if(i%4==0&&i%100!=0||i%400==0)
		{
			tmp=366;
			sum+=tmp;
		}
		else
		{
			tmp=365;
			sum+=tmp;
		}
//		printf("tmp=%d\n",tmp);
	}

	if (year%4==0&&year%100!=0||year%400==0)
	{
		mon[2]=29;
	}
	else
	{
		mon[2]=28;
	}

//	printf("%d",mon[2]);

	i=1;
	while (i<month)
	{
//		printf("mon=%d\n",mon[i]);
		sum+=mon[i];
		i++;
	}
	sum+=date;
	
	x=sum%7;

	switch (x)
	{
	case 1:
		{
			printf("Mon.");
			break;
		}
	case 2:
		{
			printf("Tue.");
			break;
		}
	case 3:
		{
			printf("Wed.");
			break;
		}
	case 4:
		{
			printf("Thu.");
			break;
		}
	case 5:
		{
			printf("Fri.");
			break;
		}
	case 6:
		{
			printf("Sat.");
			break;
		}
	case 0:
		{
			printf("Sun.");
			break;
		}
	}
	return 0;

}
int main()
{
int y,m,d;
scanf("%d%d%d",&y,&m,&d);
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if (y%4==0 && y%100!=0 || y%400==0) days[1]=29;
int s=y-1+(y-1)/4-(y-1)/100+(y-1)/400;
int i;
for (i=1; i<m; i++) s+=days[i-1];
s+=d;
char xq[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
printf("%s\n",xq[s%7-1]);
return 0;
}
//????
int main()
{
	int year,month,day,sum=0,mod,i;
	int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>year>>month>>day;
	if (year%4==0&&year%100!=0||year%400==0)//??????
	{
		days[2]=29;
		sum+=year-1+year/4-year/100+year/400-1;
	}
	else
		sum+=year+year/4-year/100+year/400-1;
	for (i=1;i<month;i++)//????
		sum+=days[i];
	sum+=day;
	mod=sum%7;
	switch(mod)
	{
	case 0:cout<<"Sun."<<endl;break;
	case 1:cout<<"Mon."<<endl;break;
	case 2:cout<<"Tue."<<endl;break;
	case 3:cout<<"Wed."<<endl;break;
	case 4:cout<<"Thu."<<endl;break;
	case 5:cout<<"Fri."<<endl;break;
	case 6:cout<<"Sat."<<endl;
	}
	return 0;
}
int rn(int y){
	int r;
	r=0;
	if(y%400==0||(y%100!=0&&y%4==0))
		r=1;
	return r;
}

int main(){
	int ye,mon,day,d,i,x;
	scanf("%d%d%d",&ye,&mon,&day);
	d=day;
	for(i=1;i<mon;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10)
			d=d+31;
		else if(i==4||i==6||i==9||i==11)
			d=d+30;
		else if(i==2){
			if(rn(ye)==1)
				d=d+29;
			else
				d=d+28;
		}
	}
	d+=365*(ye-1)+(ye-1)/4-(ye-1)/100+(ye-1)/400-(ye-1)/4000;
	if(ye>4000)
		d++;
	x=d%7;
	if(x==0)
		printf("Sun.");
	else if(x==1)
		printf("Mon.");
	else if(x==2)
		printf("Tue.");
	else if(x==3)
		printf("Wed.");
	else if(x==4)
		printf("Thu.");
	else if(x==5)
		printf("Fri.");
	else if(x==6)
		printf("Sat.");


	return 0;
}
int main()
{
	int day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int y,m,d,w,i,j=0;
	cin>>y>>m>>d;
	char a[][10]={"Sun.","Mon.","Tue.","Wed.","Tue.","Fri.","Sat."};
	w=y%7+y/4-y/100+y/400;
	if((y%4==0&&y%100!=0)||y%400==0)
	{
		if(w==1)
		{
			w=7;
		}
		else
		{
		w=w-1;
		}
		day[2]=29;
	}
	for(i=1;i<m;i++)
		j=j+day[i];
	j=j+d-1;
	w=(j+w)%7;
	cout<<a[w]<<endl;
}