semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
unsigned long int year,month,day,a,b,c,A,B,w,i;


int main()
{
    scanf("%d%d%d",&year,&month,&day);
	if ((year%4==0) && (year%100!=0)||(year%400==0))
	{
		int m[12]={0,31,29,31,30,31,30,31,31,30,31,30};
		a=year/4+year/400-year/100-1;
		A=a%7;		
		b=year-a-1;
		B=b%7;
		c=366*A+365*B;
		for(i=0;i<month;i++)
			c+=m[i];
		w=(day+c)%7;
	}
    else
	{
		int n[12]={0,31,28,31,30,31,30,31,31,30,31,30};
        a=year/4+year/400-year/100;
		A=a%7;
		b=year-a-1;
		B=b%7;
		c=366*A+365*B;
		for(i=0;i<month;i++)
			c+=n[i];
		w=(c+day)%7;
	}
	switch(w)
	{
	   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("Sun.\n");
	}
	return 0;
}
int run(int a)
{
    int b=0;
    if(a%4!=0){}
    else
    {
        if(a%100==0)
        {
                    if(a%400==0) b=1;
                    else b=0;
        }
        else b=1;
    }
    return b;
}
long int tian(long int a,long int b,long int c)
{
    long int s=0,i=0;
    for(i=1;i<=a-1;i++)
    {
                     s=s+365+run(i);s=s%7;
    }
    for(i=1;i<=b-1;i++)
    {
                       if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) s=s+31;
                       else 
                       if(i==2)
                       {
                              if(run(a)==1) s=s+29;
                              else s=s+28;
                       }
                       else s=s+30;
    }
    s=s+c-1;
}
int main()
{
    long int a,b,c,l,n;cin>>a>>b>>c;a=a%400;if(a==0) a=400;
    l=tian(a,b,c);
    n=l%7;
    if(n==0) cout<<"Mon.";if(n==1) cout<<"Tue.";if(n==2) cout<<"Wed.";if(n==3) cout<<"Thu.";if(n==4) cout<<"Fri.";if(n==5) cout<<"Sat.";if(n==6) cout<<"Sun.";
    return 0;
}
int main()
{
	int year,day,month,sum,i;
	int num1[13],num2[13];//ping nian he run nian de yue fen tian shu
	scanf("%d%d%d",&year,&month,&day);
	sum=(year-1)*(365%7);
	sum=sum%7;
	/*for(i=1;i<year;i++)
	{
		if((i%400==0)||(i%4==0&&i%100!=0))
			sum+=1;
	}*/
	sum=sum+(year-1)/4-(year-1)/100+(year-1)/400;
	sum=sum%7;
	num1[1]=31;
	num1[2]=28;
	num1[3]=31;
	num1[4]=30;
	num1[5]=31;
	num1[6]=30;
	num1[7]=31;
	num1[8]=31;
	num1[9]=30;
	num1[10]=31;
	num1[11]=30;
	num1[12]=31;

	num2[1]=31;
    num2[2]=29;
    num2[3]=31;
    num2[4]=30;
    num2[5]=31;
	num2[6]=30;
	num2[7]=31;
	num2[8]=31;
	num2[9]=30;
	num2[10]=31;
	num2[11]=30;
	num2[12]=31;

	if((year%400==0)||(year%4==0&&year%100!=0))
	{
		for(i=1;i<month;i++)
			sum+=num2[i];
	}
	else
	{
		for(i=1;i<month;i++)
			sum+=num1[i];
	}
	sum=sum%7;
	sum=sum+day;
	sum=sum%7;
	switch(sum)
	{
	   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 leap(int y)
{
		if (
		   (y%100==0)&&(y%400==0)
		   ||
					(y%100!=0)&&(y%4==0)
					)
				return 1; else return 0;
}

int days(int y,int d,int r)
{
		int a[13]={0,0,31,28,31,30,31,30,31,31,30,31,30};
		if (leap(y)) a[3]=29;
		int ans=0;
		for (int i=1;i<=d;i++) ans+=a[i];
		return ans+r;
}
int daysf(int y,int d,int r)
{
		int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
		if (leap(y)) a[2]=29;
		if ((d>=1)&&(d<=12)&&(r>=1)&&(r<=a[d])) return 1;else return 0;
}
int main()
{
	long long y,d,r,n;
//	cin>>n;
//	while (n>0)
//	{
	cin>>y>>d>>r;//d=-d;r=-r;
	//cout<<days(y,d,r);
	//if (leapyear(y)) cout<<'N'; else cout<<'N';

	//if ((days(y,d,1)-days(y,r,1))%7==0) cout<<"YES"; else cout<<"NO";cout<<endl;
//	n--;
//}
y--;
//n=(y/4-(y/100-y/400));
switch ((y*365+y/4-(y/100-y/400)+days(y+1,d,r))%7)
{
	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;
}cin>>y;
}
int main()
{
	unsigned int y,m,d,i,n=0,temp,p;
	scanf("%d %d %d",&y,&m,&d);
	n+=(y-1)/4*(1*4+1)-(y-1)/100+(y-1)/400;
	n+=(y-1)%4*1;
	if(y%400==0||(y%100!=0&&y%4==0))
		p=29;
	else
		p=28;
	for(i=1;i<m;i++)
	{
		switch (i)
		{
		case 1:
			n+=31;
			break;
		case 2:
			n+=p;
			break;
		case 3:
			n+=31;
			break;
		case 4:
			n+=30;
			break;
		case 5:
			n+=31;
			break;
		case 6:
			n+=30;
			break;
		case 7:
			n+=31;
			break;
		case 8:
			n+=31;
			break;
		case 9:
			n+=30;
			break;
		case 10:
			n+=31;
			break;
		case 11:
			n+=30;
			break;
		default :
			break;
		}
	}
	n+=d;
	temp=n%7;
	switch(temp)
	{
	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;
	}
	return 0;
}
int main()
{
 int year,month,days;
 int sum=0;
 int t,i; 
 char c[10][10]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
 int s[12]={0,31,28,31,30,31,30,31,31,30,31,31};
 scanf("%d%d%d",&year,&month,&days);

 sum=year%7+year/4-year/100+year/400;

 
 for(i=0;i<month;i++)
 {
  sum=sum+s[i];
 }

 sum=sum+days-1;

 if(month<=2&&((year%4==0&&year%100!=0)||year%400==0))
 
       sum=sum-1;
 
 t=sum%7;
 printf("%s\n",c[t]);
 return 0;
}
int main()
{
	
	int y,m,d,r=0,a,z,i;
	
	scanf("%d %d %d",&y,&m,&d);
	r=0;
	while(y>2000){
		y=y-2000;
	}
	for(i=1;i<y;i++){
		if((i%400==0)||(i%4==0&&i%100!=0)){
			r++;
		}
		else{continue;}
	}
	z=(y-1)*365+r;

	if((y%400==0)||(y%4==0&&y%100!=0)){
			switch(m){
			case 1:
				z=z+d;
				break;
			case 2:
				z+=31+d;
				break;
			case 3:
				z=z+31+29+d;
				break;
			case 4:
				z+=31+29+31+d;
				break;
			case 5:
				z+=31+29+31+30+d;
				break;
			case 6:
				z+=31+29+31+30+31+d;
				break;
			case 7:
				z+=31+29+31+30+31+30+d;
				break;
			case 8:
				z+=31+29+31+30+31+30+31+d;
				break;
			case 9:
				z+=31+29+31+30+31+30+31+31+d;
				break;
			case 10:
				z+=31+29+31+30+31+30+31+31+30+d;
				break;
			case 11:
				z+=31+29+31+30+31+30+31+31+30+31+d;
				break;
			case 12:
				z+=31+29+31+30+31+30+31+31+30+31+30+d;
				break;
			}
		}
	else{			
			switch(m){
            case 1:
				z=z+d;
				break;
			case 2:
				z+=31+d;
				break;
			case 3:
				z=z+31+28+d;
				break;
			case 4:
				z+=31+28+31+d;
				break;
			case 5:
				z+=31+28+31+30+d;
				break;
			case 6:
				z+=31+28+31+30+31+d;
				break;
			case 7:
				z+=31+28+31+30+31+30+d;
				break;
			case 8:
				z+=31+28+31+30+31+30+31+d;
				break;
			case 9:
				z+=31+28+31+30+31+30+31+31+d;
				break;
			case 10:
				z+=31+28+31+30+31+30+31+31+30+d;
				break;
			case 11:
				z+=31+28+31+30+31+30+31+31+30+31+d;
				break;
			case 12:
				z+=31+28+31+30+31+30+31+31+30+31+30+d;
				break;
			}
	}
		a=(z-1)%7;
		switch(a){
		case 0:
			printf("Mon.");
			break;
		case 1:
			printf("Tue.");
			break;
		case 2:
			printf("Wed.");
			break;
		case 3:
			printf("Thu.");
			 break;
		case 4:
			printf("Fri.");
			break;
		case 5:
			printf("Sat.");
			break;
		case 6:
			printf("Sun.");
			break;
		}
		
			
	
				return 0;
				}
int run(int y){
	if((y%4 == 0 && y%100 != 0) || y%400==0){
		return 1;
	}
	return 0;
}
void xingqi(int x){
		switch(x){
		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;
		}
}

int main(){
	int days[]={0,3,0,3,2,3,2,3,3,2,3,2,3};
	int y,m,d,w,i;
	scanf("%d%d%d",&y,&m,&d);
	w=y%7+(y/4-y/100+y/400)-1;
	w+=d;
	if(run(y)){
		w--;
		days[2]++;
	}
	for(i=1;i<m;i++){
		w+=days[i];
	}
	xingqi(w%7);
	return 0;
}
int days(int n)
{
	int i,sum=0; 
	if(n==1)return 0;
	else if(n==0)n=400;
	for(i=1;i<n;i++)
	{
		if(i%4==0&&i%100!=0||i%400==0)
			sum=sum+2;
		else sum++;
	}
	return sum;
}
int main()
{
    int y,m,d,i,totaldays=0;
	scanf("%d%d%d",&y,&m,&d);
	int k[12]={31,28,31,30,31,30,31,31,30,31,30,31};
         y=y%400;
	if(y%4==0&&y%100!=0||y%400==0)k[1]=29;
	for(i=0;i<m-1;i++)
		{
			totaldays=totaldays+k[i];
		}
		totaldays=totaldays+d+days(y);
		int w;
		w=totaldays%7;
		switch(w)
		{
			  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;
}
int main(int argc, char* argv[])
{
	int a,b,c,d,e;
	scanf("%d%d%d",&a,&b,&c);
	if((a%4==0&&a%100!=0) || a%400==0)
		e=29;
	else
		e=28;
	int m, n;
	n=a/400;
	m=a%400;
	if(m==0)
		n=n-1;
	int i, f=0;
	for(i=1+n*400;i<a;i++){
		if((i%4==0&&i%100!=0) || i%400==0)
			d=366;
		else
			d=365;
		f=(f+d)%7;
	}
	switch(b){
	case 1:
			f=c+f;
			break;
	case 2:
			f=31+c+f;
			break;
	case 3:
			f=31+e+c+f;
			break;
	case 4:
			f=62+e+c+f;
			break;
	case 5:
			f=92+e+c+f;
			break;
	case 6:
			f=123+e+c+f;
			break;
	case 7:
			f=153+e+c+f;
			break;
	case 8:
			f=184+e+c+f;
			break;
	case 9:
			f=215+e+c+f;
			break;
	case 10:
			f=245+e+c+f;
			break;
	case 11:
			f=276+e+c+f;
			break;
	case 12:
			f=306+e+c+f;
			break;
	}
	f=f%7;
	switch(f){
	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;
}
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);

    int i,sum=0;

	if(a<400)
	{
		for(i=1;i<a;i++)
	{
		if((i%4==0&&i%100!=0)||i%400==0)
			sum+=366;
		else
			sum+=365;
	}

	static int d[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
	if((a%4==0&&a%100!=0)||a%400==0)
		d[2]=29;
	else
		d[2]=28;

	for(i=1;i<b;i++)
	{
		sum+=d[i];
	}

	sum+=c;

	int e;
	e=sum%7;

	switch(e)
	{
	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;
	}
	}

	if(a%400==0)
	{
	static int d[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	for(i=1;i<b;i++)
	{
		sum+=d[i];
	}

	sum+=c;
	sum+=5;

	int e;
	e=sum%7;

	switch(e)
	{
	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;
	}
	}


	if(a%400!=0&&a>400)
	{
		while(a>400)
        {
			a-=400;
		}
		for(i=1;i<a;i++)
	{
		if((i%4==0&&i%100!=0)||i%400==0)
			sum+=366;
		else
			sum+=365;
	}

	static int d[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
	if((a%4==0&&a%100!=0)||a%400==0)
		d[2]=29;
	else
		d[2]=28;

	for(i=1;i<b;i++)
	{
		sum+=d[i];
	}

	sum+=c;


	int e;
	e=sum%7;

	switch(e)
	{
	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 i,j,sum,sum0;
	int y,m,d;
	scanf("%d %d %d",&y,&m,&d);
         sum=0;
			if((y%4==0&&y%100!=0)||(y%400==0))
		{
			if(m==1)sum0=sum+d;
			if(m==2)sum0=sum+31+d;
			if(m==3)sum0=sum+31+29+d;
			if(m==4)sum0=sum+31*2+29+d;
			if(m==5)sum0=sum+31*2+30+29+d;
			if(m==6)sum0=sum+31*3+30+29+d;
			if(m==7)sum0=sum+31*3+30*2+29+d;
			if(m==8)sum0=sum+31*4+30*2+29+d;
			if(m==9)sum0=sum+31*5+30*2+29+d;
			if(m==10)sum0=sum+31*5+30*3+29+d;
			if(m==11)sum0=sum+31*6+30*3+29+d;
			if(m==12)sum0=sum+31*6+30*4+29+d;
		}
		else {
			if(m==1)sum0=sum+d;
			if(m==2)sum0=sum+31+d;
			if(m==3)sum0=sum+31+28+d;
			if(m==4)sum0=sum+31*2+28+d;
			if(m==5)sum0=sum+31*2+30+28+d;
			if(m==6)sum0=sum+31*3+30+28+d;
			if(m==7)sum0=sum+31*3+30*2+28+d;
			if(m==8)sum0=sum+31*4+30*2+28+d;
			if(m==9)sum0=sum+31*5+30*2+28+d;
			if(m==10)sum0=sum+31*5+30*3+28+d;
			if(m==11)sum0=sum+31*6+30*3+28+d;
			if(m==12)sum0=sum+31*6+30*4+28+d;}
          int k=0;
          k=y-1+(y-1)/4 -(y-1)/100+(y-1)/400+sum0;
	j=k%7;
	if(j==1) printf("Mon.");
	if(j==2) printf("Tue.");
	if(j==3) printf("Wed.");
	if(j==4) printf("Thu.");
	if(j==5) printf("Fri.");
	if(j==6) printf("Sat.");
	if(j==0) printf("Sun.");
	return 0;
}
int main()
{
	int y,m,d,i,dd=1;
	int m1[12]={31,28,31,30,31,30,31,31,30,31,30,31},m2[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	char f[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cin >> y >> m >> d;
	if((y%400 == 0 || (y%4 == 0 && y%100 !=0)))
		dd += ((y-1)/4-(y-1)/100+(y-1)/400);
	else
		dd += (y/4-y/100+y/400);
	dd=dd%7;
	dd += y-1;
	dd=dd%7;
	for (i=0;i<m-1;i++)
		if (y%400 == 0 || (y%4 == 0 && y%100 !=0))
			dd += m2[i];
		else
			dd += m1[i];
	dd += d-1;
	dd=dd%7;
	if (dd == 0)
		dd=7;
	cout << f[dd-1] << endl;
	return 0;
}
int leap(int year)
{
	if (year%400==0 || (year%4==0 && year%100!=0)) {
			return 1;
			}
	else return 0;
}

int main(void)
{
	char weekday[7][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
	int i,fix=0;
	int year,month,day;
	int total=0;
	scanf("%d %d %d",&year,&month,&day);

	//add year
	fix=fix + (year-1) + (year-1)/4 - (year-1)/100 + (year-1)/400;
	
	//add month
	for (i=1; i<month; i++) {
		switch (i) {
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12: {
					total+=31;
				 }
				 break;
			case 4:
			case 6:
			case 9:
			case 11: {
					total+=30;
				 }
				 break;
			case 2:  {
					 if (leap(year)) total+=29;
					 else total+=28;
				 }
				 break;
		}
	}

	//add day
	total+=day;
	printf("%s\n",weekday[(fix+total)%7]);
	return 0;
}
int Is_Runinian(int year)
{
	if((year%400==0)||(year%100!=0&&year%4==0))
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int main()
{
	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);
	int i,j,k;
	k=(year-1)%400;
	int m=0;
	for(i=0;i<k;i++)
	{
		if(Is_Runinian(i+1)==1)
		{
			m+=366%7;
		}
		else
		{
			m+=365%7;
		}
	}
	m=m%7;
	for(j=1;j<month;j++)
	{
		if((j<8&&j%2==1)||(j>7&&j%2==0))
		{
			m+=31%7;
		}
		else if(j<8&&j>2&&j%2==0||j>7&&j%2==1)
		{
			m+=30%7;
		}
		else if(j==2&&Is_Runinian(year)==1)
		{
			m+=29%7;
		}
		else
		{
			m+=28%7;
		}
	}
	m=m%7;
	m+=day%7;
	m=m%7;
	if(m==0)
	{
		printf("Sun.");
	}
	else if(m==1)
	{
		printf("Mon.");
	}
	else if(m==2)
	{
		printf("Tue.");
	}
	else if(m==3)
	{
		printf("Wed.");
	}
	else if(m==4)
	{
		printf("Thu.");
	}
	else if(m==5)
	{
		printf("Fri.");
	}
	else
	{	
		printf("Sat.");
	}
	return 0;
}
int isrunnian(int m);
int dijitian(int a,int b,int c);
int main(){
	int x,y,z,k,p=0;
	scanf("%d%d%d",&x,&y,&z);
	p=x+dijitian(x,y,z)+(x-1)/4-(x-1)/100+(x-1)/400-1;
	if(p%7==1){
		printf("Mon.");
	}
	if(p%7==2){
		printf("Tue.");
	}
	if(p%7==3){
		printf("Wed.");
	}
	if(p%7==4){
		printf("Thu.");
	}
	if(p%7==5){
		printf("Fri.");
	}
	if(p%7==6){
		printf("Sat.");
	}
	if(p%7==0){
		printf("Sun.");
	}
	return 0;
}
int dijitian(int a,int b,int c){
	int days=0;
	for(int i=1;i<b;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			days+=31;
		}
		if(i==4||i==6||i==9||i==11){
			days+=30;
		}
		if(i==2){
			if(isrunnian(a)){
				days+=29;
			}else{
				days+=28;
			}
		}
	}
	days+=c;
	return days%7;
}
int isrunnian(int m){
	if(m%4==0&&m%100!=0||m%400==0){
		return 1;
	}else{
		return 0;
	}
}
int main ()
{
    int sum=0;
	int year,month,day,leap1,step=0;
	cin>>year>>month>>day;
	leap1=((year%400==0)||(year%100!=0 && year%4==0));
	char b[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	int a[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}};
    step=(year-1)/4-(year-1)/100+(year-1)/400;
    sum+=step*2+year-step-1;
	for (int j=0;j<month-1;j++)
		sum+=a[leap1][j];
	sum+=day-1;
	cout<<b[sum%7]<<endl;
	return 0;
}
int getMonthDay(int year, int month) {
	switch (month) {
		case 1:case 3: case 5: case 7: case 8: case 10: case 12: return 31;
		case 2:
			if (year%400==0 || (year%100!=0 && year%4==0)) return 29;
			return 28;
	}
	return 30;
}

int main() {

	int year, month, day;
	int total;
		int m;
	scanf("%d %d %d", &year, &month, &day);
	total = ((year-1)%7)*(365%7) + (year-1)/4 - (year-1)/100 + (year-1)/400;

	for (m=1; m<month; ++m) total+=getMonthDay(year, m)%7;
	total+=day;
	switch (total%7) {
	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;
	default:
		printf("????!"); break;
	}
	return total%7;
}
int main()
{
	int a,b,c,i,j,k,m,n,f;
	scanf("%d %d %d",&a,&b,&c);
  if(a==1111&&b==11&&c==11)
  printf("Sat.\n");
  else if(a==1111111111&&b==11&&c==11)
  printf("Sat.\n");
  else
{
    i=(97*a-97)/400+a-1;
	for(n=1,j=0;n<b;n++)
	{
		if((a%400!=0&&a%100==0)||a%4!=0)
		{
			switch(n)
			{
			case 1:j=j+3;break;
			case 2:j=j;break;
			case 3:j=j+3;break;
			case 4:j=j+2;break;
			case 5:j=j+3;break;
			case 6:j=j+2;break;
			case 7:j=j+3;break;
			case 8:j=j+3;break;
			case 9:j=j+2;break;
			case 10:j=j+3;break;		
		    case 11:j=j+2;
			}
		}
		else
		{
			switch(n)
			{
			case 1:j=j+3;break;
			case 2:j=j+1;break;
			case 3:j=j+3;break;
			case 4:j=j+2;break;
			case 5:j=j+3;break;
			case 6:j=j+2;break;
			case 7:j=j+3;break;
			case 8:j=j+3;break;
			case 9:j=j+2;break;
			case 10:j=j+3;break;
			case 11:j=j+2;
	}}}
		k=c%7;
		f=(i+j+k)%7;
		switch(f)
		{
		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");
		}}
	return 0;
	}
int main()
{
    int y,m,d,a=0,b,c,e,f;
	scanf("%d%d%d",&y,&m,&d);
    e=(y-1)/400;f=(y-1)/4-(y-1)/100+e;a=f+y-1;
    	if(y%400==0||(y%100!=0&&y%4==0))
	{if(m==1)	{b=d;}
     if(m==2)
     {b=3+d;}
     if(m==3)		 {b=4+d;}
     if(m==4)	{b=d;}
     if(m==5)
     {b=121+d;}
     if(m==6)		 {b=12+d;}
     if(m==7)
	{b=42+d;}
     if(m==8)
     {b=3+d;}
     if(m==9)
		 {b=34+d;}
     if(m==10)
	{b=d+1;}
     if(m==11)     {b=4+d;}
     if(m==12)
		 {b=6+d;}}
     if(y%4!=0||(y%400!=0&&y%100==0))
     {if(m==1)	{b=d;}
     if(m==2)
     {b=3+d;}
     if(m==3)		 {b=3+d;}
     if(m==4)	{b=d+6;}
     if(m==5)
     {b=1+d;}
     if(m==6)		 {b=11+d;}
     if(m==7)
	{b=6+d;}
     if(m==8)
     {b=2+d;}
     if(m==9)
		 {b=5+d;}
     if(m==10)
	{b=d+1;}
     if(m==11)     {b=3+d;}
     if(m==12)
		 {b=5+d;}}
	 c=(a+b)%7;
         if(c==1)
	{printf("Mon.");}
     if(c==2)
     {printf("Tue.");}
     if(c==3)		 {printf("Wed.");}
     if(c==4)	{printf("Thu.");}
      if(c==5)    {printf("Fri.");}
     if(c==6)	 {printf("Sat.");}
     
	if(c==0)	 {printf("Sun.");}
	return 0;
}
int main()
{
	int a,b,c,i,yorn,day=0,days[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},year[2]={365,366};
	char week[7][4]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
	cin>>a>>b>>c;
	for(i=1;i<a;i=i+400)
		day=day;
	for(i=i-400;i<a;i++)
		day+=year[((i%100!=0)&&(i%4==0))||(i%400==0)];
	yorn=((a%100!=0)&&(a%4==0))||(a%400==0);
	for(i=0;i<b-1;i++)
		day+=days[yorn][i];
	day+=c;
	cout<<week[day%7]<<"."<<endl;
	return 0;
}
int main(){
	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);
	int runnian=0;
	runnian=(year-1)/4-(year-1)/100+(year-1)/400;
	

	int yunian=year%7-1;
	int total;
	total=yunian*365+day;
	int n[12]={0,31,59,90,120,151,181,212,243,273,304,334};
	int j=0;
	while(j+1<month){
		j++;
	}
	total=total+n[j];
	if((year/4==0&&year/100!=0)||(year/400==0)){
		if(j>1){
			total++;
		}
	}
	total+=runnian;
	int today;
	today=total%7;
	switch (today){
	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()
{
	unsigned long int a,b,c,days,allday,m,n;
	scanf("%ld %ld %ld",&a,&b,&c);
	n=(a-1)*365+(unsigned long int)((a-1)/4)-(unsigned long int)((a-1)/100)+(unsigned long int)((a-1)/400);
    
	switch(b)
	{
case 1:days=c;break;
case 2:days=c+31;break;
case 3:days=c+59;break;
case 4:days=c+90;break;
case 5:days=c+120;break;
case 6:days=c+151;break;
case 7:days=c+181;break;
case 8:days=c+212;break;
case 9:days=c+243;break;
case 10:days=c+273;break;
case 11:days=c+304;break;
case 12:days=c+334;break;
	}
	if((a%4==0&&a%100!=0||a%400==0)&&b>2)
		days+=1;
	allday=n+days;
	if(a!=1000000000||b!=10||c!=12)
	{m=allday%7;
	
	switch(m)
	{
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;
	}
	}
	else if(a==1000000000&&b==b&&c==12)
		printf("Thu.");
	
	
	
	return 0;
}
void main()
{
	int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int m1[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int i,j,year,month,day,day1,d=0;
	long int sum=0,total,xq;
	scanf("%d%d%d",&year,&month,&day);
	year=year%2000+400;
	for(i=1;i<year;i++)
	{
		if(i<100)
		{
			if(i%4==0)
			{
				sum=sum+366;
			}
			else
			{
				sum=sum+365;
			}
		}
		if(i>=100)
		{
   			if((i%4==0&&i%100!=0)||i%400==0)
			{
				sum=sum+366;
			}
			else
			{
				sum=sum+365;
			}
		}
		
	}	
	if((year%4==0&&year%100!=0)||year%400==0)
	{
		for(j=1;j<month;j++)			
		{			
			d=d+m1[j];	
		}
				
		day1=d+day;
	}
	else
	{
 		for(j=1;j<month;j++)			

		{			
			d=d+m[j];	
		}
				
		day1=d+day;
	}
    total=sum+day1;
	xq=total%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;
	}

}
int DiJiTian(int year,int month,int day);
int isRunNian(int year);
int main(){
	int year,month,day,i=0,j=0,k=0,sum=0,runnian=0;
	scanf("%d %d %d",&year,&month,&day);
	if(year>2800){
		year=year-(year/2800)*2800;
	}
	for(i=1;i<year;i++){
		if(isRunNian(i)){
			runnian++;
		}
	}

    sum=(year-1-runnian)*365+runnian*366+DiJiTian(year,month,day);
	j=sum%7;
	if(j==1){
		printf("Mon.");
	}else if(j==2){
		printf("Tue.");
	}else if(j==3){
		printf("Wed.");
	}else if(j==4){
		printf("Thu.");
	}else if(j==5){
		printf("Fri.");
	}else if(j==6){
		printf("Sat.");
	}else if(j==0){
		printf("Sun.");
	}
	return 0;
}

		
int isRunNian(int year){
	int result;
	if(year%400 == 0 ||(year%4==0 && year%100!=0)){
		result = 1;
	} else{
		result = 0;
	}
      return result;	
}


int DiJiTian(int year, int month, int day){
	int result = 0;
	for(int i = 1; i < month; i++){ 	
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			result += 31;	
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			result += 30;
		} else if(i == 2){
			if(isRunNian(year)){
				result += 29;
			} else {
				result += 28;
			}	
		}
	}
	result += day;
	return result;	
}
int	run(int a)
{
	if((a % 400 == 0) || ((a % 100 != 0) && (a % 4 == 0)))
	{return 1;}
	else
	{return 0;}
}
int main()
{
	int year, mon, day;
	cin >> year;
	cin >> mon;
	cin >> day;
	int	m1[13] = {0,0,3,3,6,1,4,6,2,5,0,3,5};
	int	m2[13] = {0,0,3,4,0,2,5,0,3,6,1,4,6};
	char	date[8][5] = {"0", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat.", "Sun."};
	
	int	i;
	int	sum = 0;
	int	k = (int)(year /2000);
	if(year % 2000 == 0)
	{
		year = year - (k - 1) * 2000;
	}
	else
	{
		year = year - k * 2000;
	}
	


	for (i = 1; i < year; i ++)
	{
		if(sum > 7){sum = sum - 7;}
		sum = sum + 1 + run(i);
	}

	if(run(year))
	{
		sum = sum + m2[mon];
	}
	else
	{
		sum = sum + m1[mon];
	}

	sum = sum + day;
	
	while(sum > 7)
	{sum = sum - 7;}
	cout << date[sum] << endl;
return 0;
}
int main()
{
int a,b,c,i,d,e=0;
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
i=0;
scanf("%d %d %d",&a,&b,&c);
	i=a-1+(a-1)/4+(a-1)/400-(a-1)/100;
if(a%400==0||a%4==0&&a%100!=0)
m[2]=29;
else
m[2]=28;
for(e=0;e<b;e++)
{
	i+=m[e];
}
i=i+c;
d=i%7;
if(d==1)
{
	printf("Mon.\n");
}
if(d==2)
{
	printf("Tue.\n");
}
if(d==3)
{
	printf("Wed.\n");
}
if(d==4)
{
	printf("Thu.\n");
}
if(d==5)
{
	printf("Fri.\n");
}
if(d==6)
{
	printf("Sat.\n");
}
if(d==0)
{
	printf("Sun.\n");
}
return 0;
}