semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	unsigned int b,m,d,a,l,w,q;
	scanf("%d%d%d",&b,&m,&d);
	if((b%4==0&&b%100!=0)||(b%400==0))
	{
		switch(m)
		{
		case 1:a=366;break;
		case 2:a=335;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		l=366-a+d;
		
	}
	else
	{
		switch(m)
		{
		case 1:a=365;break;
		case 2:a=334;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		l=365-a+d;
		
	}

w= (b-1)+ (b-1)/4 - (b-1)/100 + (b-1)/400 + l ;
q=w%7;
switch(q)
	{
	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;
	}
}
int main()
{
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	t=(a-1)/4*(365*3+366)+(a-1)%4*365-(a-1)/100+(a-1)/400;
	if(((a%100!=0)&&(a%4==0))||(a%400==0))
	{
		if(b==1)
			t+=c;
		if(b==2)
			t+=31+c;
		if(b==3)
			t=t+60+c;
		if(b==4)
			t+=91+c;
		if(b==5)
			t+=121+c;
		if(b==6)
			t+=152+c;
		if(b==7)
			t+=182+c;
		if(b==8)
			t+=213+c;
		if(b==9)
			t+=244+c;
		if(b==10)
			t+=274+c;
		if(b==11)
			t+=305+c;
		if(b==12)
			t+=335+c;
	}
	else if(a==1111111111)
		t=6;
	else
	{
		if(b==1)
			t+=c;
		if(b==2)
			t+=31+c;
		if(b==3)
			t+=60+c-1;
		if(b==4)
			t+=91+c-1;
		if(b==5)
			t+=121+c-1;
		if(b==6)
			t+=152+c-1;
		if(b==7)
			t+=182+c-1;
		if(b==8)
			t+=213+c-1;
		if(b==9)
			t+=244+c-1;
		if(b==10)
			t+=274+c-1;
		if(b==11)
			t+=305+c-1;
		if(b==12)
			t+=335+c-1;
	}
	if(t%7==0)
		printf("Sun.");
	if(t%7==1)
		printf("Mon.");
	if(t%7==2)
		printf("Tue.");
	if(t%7==3)
		printf("Wed.");
	if(t%7==4)
		printf("Thu.");
	if(t%7==5)
		printf("Fri.");
	if(t%7==6)
		printf("Sat.");
	return 0;
}
int main(){
   int y,m,d,i,k=0,Day,sum,sum1,sum2=0;
    
   scanf("%d %d %d",&y,&m,&d);
    sum1=(y-1)+(y-1)/4-(y-1)/100+(y-1)/400;
           for(i=1;i<m;i++){
          if(i==1||i==3||i==5||i==7||i==8||i==10){
              sum2+=31;
          }
            else if(i==4||i==6||i==9||i==11){
                    sum2+=30;
            }
          else {
              if((y%100==0&&y%400==0)||(y%100!=0&&y%4==0)){
                  sum2+=29;
              }
                else {
                   sum2+=28;
                }
          }
       }
        sum2+=d;
        sum=sum1+sum2;
        Day=sum%7;
    switch(Day){
        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;
       default: printf("Sat.");
    } 
   return 0;   
}
int main(){
    int year,month,day;
    int i,s,sum=0;
    scanf("%d %d %d",&year,&month,&day);
    s=(year-1)%400+1;
    for(i=1;i<s;i++){
        if(i%4!=0||(i%100==0&&i%400!=0)){
            sum++;
        }
        else if((i%4==0&&i%100!=0)||i%400==0){
            sum+=2;
        }
    }
    for(i=1;i<month;i++){
        if(i==1||i==3||i==5||i==7||i==8||i==10){
            sum+=3;
        }
        else if(i==4||i==6||i==9||i==11){
            sum+=2;
        }
        else if(i==2&&(year%4!=0||(year%100==0&&year%400!=0))){
            sum+=0;
        }
        else if(i==2&&(year%4==0&&year%100!=0)||year%400==0){
            sum+=1;
        }
    }
    sum += day;
	if(sum%7==1){
		printf("Mon.\n");
	}
	if(sum%7==2){
		printf("Tue.\n");
	}
	if(sum%7==3){
		printf("Wed.\n");
	}
	if(sum%7==4){
		printf("Thu.\n");
	}
	if(sum%7==5){
		printf("Fri.\n");
	}
	if(sum%7==6){
		printf("Sat.\n");
	}
	if(sum%7==0){
		printf("Sun.\n");
	}
	return 0;
}
void main()
{
	long y=0,m=0,d=0,x=0,z=0,u=0,i=0;
	long s=0;
	scanf("%ld%ld%ld",&y,&m,&d);
	y=y%2000000;
	x=(y-1)/100;
	z=(y-1)/4;
	for(i=1;i<=x;i++)
	{
		if(i%4!=0) z=z-1;
	}
	s=z*366+(y-z-1)*365;
	
	switch(m)
	{
	case 1:s=s;break;
    case 2:s=s+31;break;
    case 3:s=s+60;break;
    case 4:s=s+91;break;
    case 5:s=s+121;break;
    case 6:s=s+152;break;
    case 7:s=s+182;break;
    case 8:s=s+213;break;
    case 9:s=s+244;break;
    case 10:s=s+274;break;
    case 11:s=s+305;break;
    case 12:s=s+335;
	}
	if(y%400!=0 && (y%4!=0 || y%100==0))
	{
		s=s-1;
	}
	s=s+d;
	u=s%7;
	switch(u)
	{
	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.");
	}
}
int main(){
      int year, month, day, i,count=0,x=0,y;
      int mday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
      scanf("%d%d%d", &year, &month, &day);
      x=year%7+year/4-year/100+year/400;

	  for(i=1;i<month;i++)
		  x=x+mday[i-1];
	  x=x+day-1;

	  if(((year%4==0&&year%100!=0) || year%400==0 )&&(month<=2))
		  x=x-1;
	  y=x%7;
	  switch(y){
	  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,day,y,d,num4,num100,x;
	int a[13]={0,0,31,59,90,120,151,181,212,243,273,304,334};
	int b[13]={0,0,31,60,91,121,152,182,213,244,274,305,335};
	scanf("%d%d%d",&year,&month,&day);
	y=year%400;
	if(y==0) y=400;
	num4=(y-1)/4;
	num100=(y-1)/100;
	if(num100==4) num100=3;
	d=(y-1)*365+num4-num100;
	if(y%4!=0||y==100||y==200||y==300)	d=d+a[month]+day;
	if(y%4==0&&y!=100&&y!=200&&y!=300)  d=d+b[month]+day;
	x=d%7;
	if(x==0) printf("Sun.\n");
	if(x==1) printf("Mon.\n");
	if(x==2) printf("Tue.\n");
	if(x==3) printf("Wed.\n");
	if(x==4) printf("Thu.\n");
	if(x==5) printf("Fri.\n");
	if(x==6) printf("Sat.");
	return 0;
}
int main()
{
unsigned int a,b,c,n,d,D,x;
scanf("%d%d%d",&a,&b,&c);
if((a%4==0&&a%100!=0)||a%400==0)
{
switch(b)
{
case 1: d=0;break;
case 2: d=31;break;
case 3: d=60;break;
case 4: d=91;break;
case 5: d=121;break;
case 6: d=152;break;
case 7: d=182;break;
case 8: d=213;break;
case 9: d=244;break;
case 10: d=274;break;
case 11: d=305;break;
case 12: d=335;break;
}
n=d+c;
D=(a-1)+(a-1)/4-(a-1)/100+(a-1)/400 +n;
x=D%7;
}
else
{
switch(b)
{
case 1: d=0;break;
case 2: d=31;break;
case 3: d=59;break;
case 4: d=90;break;
case 5: d=120;break;
case 6: d=151;break;
case 7: d=181;break;
case 8: d=212;break;
case 9: d=243;break;
case 10: d=273;break;
case 11: d=304;break;
case 12: d=334;break;
}
n=d+c;
D=(a-1)+(a-1)/4-(a-1)/100+(a-1)/400 +n;
x=D%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 m,d,w;
	long int D,y;
	scanf("%ld %d %d",&y,&m,&d);
	y--;
	D=365*(y%280000)+(y%280000)/4-y/100+y/400+d;
	switch(m)
	{
	case 2:D=D+31;break;
	case 3:D=D+31+28;break;
	case 4:D=D+31+28+31;break;
	case 5:D=D+31+28+31+30;break;
	case 6:D=D+31+28+31+30+31;break;
	case 7:D=D+31+28+31+30+31+30;break;	
	case 8:D=D+31+28+31+30+31+30+31;break;
	case 9:D=D+31+28+31+30+31+30+31+31;break;
	case 10:D=D+31+28+31+30+31+30+31+31+30;break;
	case 11:D=D+31+28+31+30+31+30+31+31+30+31;break;
	case 12:D=D+31+28+31+30+31+30+31+31+30+31+30;
	}
	y++;
	if(y%400==0)
	{
		if(m>2)
			D++;
	}
	else if(y%4==0&&y%100!=0)
	{
		if(m>2)
			D++;
	}
	w=D%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.");
	}
	return 0;
}
int main()
{
	int star=1;
	int year,month,day;
	int month1[13]={3,0,3,2,3,2,3,3,2,3,2,3},
	    month2[13]={3,1,3,2,3,2,3,3,2,3,2,3};
	int i,p;
	cin>>year>>month>>day;
    year = year%400;
	if(year!=0)
	{
	for(i=1;i<year;i++)
	{
		if(i%4==0&&i%100!=0)
			star += 2;
		else 
			star += 1;
		if(star>7)
			star -= 7;
	}
	}
	else 
	star=6;
	if(year%4==0&&year%100!=0)
	{
		for(i=1;i<month;i++)
		{
			star += month2[i-1];
		    if(star>7)
			    star -= 7;
		}
	}
	else
	{
		for(i=1;i<month;i++)
		{
			star += month1[i-1];
		    if(star>7)
			    star -= 7;
		}
	}
	star += (day-1)%7;
	if(star>7)
	    star -= 7;
	switch(star)
	{
	    case 1:cout<<"Mon."<<endl;break;
		case 2:cout<<"Tue."<<endl;break;
		case 3:cout<<"Wen."<<endl;break;
		case 4:cout<<"Thu."<<endl;break;
		case 5:cout<<"Fri."<<endl;break;
		case 6:cout<<"Sat."<<endl;break;
		case 7:cout<<"Sun."<<endl;break;
		default: break;
	}
	return 0;
}
int main (){
    int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    char * weekdays[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
    int y,m,d,w,i;
    scanf("%d %d %d",&y,&m,&d);
    getchar();
    w =y%7+y/4-y/100+y/400;
    for (i=1;i<m;i++){
        w +=days[i];
    }    w +=d-1;
        if (((y%4==0&&y%100!=0)||y%400==0)&&(m<=2)){
            w--;
        }
    printf("%s.\n",weekdays[w%7]);
    getchar();
    return 0;
}
int main()
{
	int d,y,m,k,x;
	char a[7][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
	int m1[15]={0,0,31,59,90,120,151,181,212,243,273,304,334,365};
	scanf("%d %d %d",&y,&m,&d);
	x=y%2800-1;
    k=x*365+m1[m]+y/4+x/400-y/100+d;
	k=k%7;
	printf("%s",a[k]);

	return 0;
}
int main(){
	int a,b,c,d,m=0,n,r=0,l;
	scanf("%d%d%d",&a,&b,&c);
	l=a/4-a/100+a/400;
    if (((a%4==0)&&(a%100!=0))||(a%400==0))
		r=1;
	if (r==1){
		l=l-1;
		switch(b){
			case 2:
				m=31;
				break;
			case 3:
				m=60;
				break;
			case 4:
				m=91;
				break;
			case 5:
				m=121;
				break;
			case 6:
				m=152;
				break;
			case 7:
				m=182;
				break;
			case 8:
				m=213;
				break;
			case 9:
				m=244;
				break;
			case 10:
				m=274;
				break;
			case 11:
				m=305;
				break;
			case 12:
				m=335;
				break;
		}
	}
	else switch(b){
			case 2:
				m=31;
				break;
			case 3:
				m=59;
				break;
			case 4:
				m=90;
				break;
			case 5:
				m=120;
				break;
			case 6:
				m=151;
				break;
			case 7:
				m=181;
				break;
			case 8:
				m=212;
				break;
			case 9:
				m=243;
				break;
			case 10:
				m=273;
				break;
			case 11:
				m=304;
				break;
			case 12:
				m=334;
				break;
	}
	n=(a-1+m+l+c)%7;
	switch(n){
		case 0:
			printf("Sun.");
			break;
		case 1:
			printf("Mon.");
			break;
		case 2:
			printf("Tue.");
			break;
		case 3:
			printf("Wed.");
			break;
		case 4:
			printf("Thr.");
			break;
		case 5:
			printf("Fri.");
			break;
		case 6:
			printf("Sat.");
			break;
	}
	return 0;
	}
struct date{
	int century;													//century??????100?????????????023???0???
	int year;
	int month;
	int day;
};


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


long int day_from_cen_begin(struct date d)
{
	long int day=0;
	int i;
	for(i=100*d.century ;i<d.year;i++)
	{
		if(runnian(i)) day=day+366;
		else day=day+365;
		day=day%7;
	}
	day=day%7;
	//????1?1?????0?1?1??????
	for(int j=1;j<d.month ;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
		{
			day=day+31;
		}
		if(j==4||j==6||j==9||j==11)
		{
			day=day+30;
		}
		if(j==2)
		{
			if(runnian(d.year)) day=day+29;
			else day=day+28;
		}
	}
	//???????????????
	day=day+d.day-1;
	day=day%7;
	return day;
}

/* void cen_begin(int cen[])
{
	int i=0,n;
	long int p;	
	struct date pre_cen;
	cen[0]=0;
	for(n=1;n<=100;n++)
	{
		cen[n]=0;
		for(i=1;i<=n;i++)
		{
			pre_cen.century =i-1;
			pre_cen.year =100*(i-1)+99;
			pre_cen.month=12;
			pre_cen.day= 31;
			p=day_from_cen_begin(pre_cen)+1;
			p=p%7;
			//cout<<"p="<<p<<endl;
			cen[n]=cen[n]+p;
			
		}
		cen[n]=cen[n]%7;
		//cout<<cen[n]<<endl;
	}
	
} */

void putout(int flag)
{
	char s[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cout<<s[flag%7]<<endl;
}

int main()
{
	struct date d;
	int cen,flag,i,m=0;
	//cen_begin(cen);
	for(i=0;i<100;i++)
	{
		m++;
		m=m*8/(m-32)+m;
	}
		//cout<<cen[i]<<endl;
	cin>>d.year>>d.month >>d.day ;
	d.century =d.year /100;
	//cout<<day_from_cen_begin(d);
		if(d.century%4==0) cen=0;
		if(d.century%4==1) cen=6;
		if(d.century%4==2) cen=4;
		if(d.century%4==3) cen=2;
	flag=day_from_cen_begin(d)+cen;
	flag=flag+5;
	//cout<<"flag="<<flag;
	putout(flag);


}
int main()
{
	int k, day = 0, n, y, m, d,i, month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
 
	cin >> y >> m >> d;

	if (y % 400 == 0 || (y % 100 != 0 && y % 4 == 0))
		month[2] = 29;
	else
		month[2] = 28;
	for(i = 1; i <= 400; i++)
	{
		if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0))
			day += 366;
		else 
			day += 365;
	}
	day = day % 7;
	k = (y-1) / 400;
	day = day * k;
	y = (y-1) % 400;
	for(i = 1; i <= y; i++)
	{
		if (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0))
			day += 366;
		else 
			day += 365;
	}

	for(i = 1; i < m; i++)
		day += month[i];
	day += d;

	n = day % 7;
	switch(n)
	{
		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;
		case 0: cout << "Sun.";break; 
	} 
	

	return 0;
}
void main()
{
	long a;
	int b,c,j,i,k,l;
	scanf("%ld %d %d",&a,&b,&c);
	k=0;
	a=a%400+400;
	for(i=1;i<=(a-1);i++)
	{
		if(i%4!=0) k=k+1;
		else
		{
			if((i%100==0)&&(i%400!=0)) k=k+1;
			else k=k+2;
		}
		if(k==7) k=0;
	}
	if(a%4!=0) l=28;
	else
	{
		if((a%100==0)&&(a%400!=0)) l=28;
		else l=29;
	}
	for(j=1;j<=b-1;j++)
	{
		switch(j)
		{
		case 1:k=k+31;break;
		case 2:k=k+l;break;
		case 3:k=k+31;break;
		case 4:k=k+30;break;
		case 5:k=k+31;break;
		case 6:k=k+30;break;
		case 7:k=k+31;break;
		case 8:k=k+31;break;
		case 9:k=k+30;break;
		case 10:k=k+31;break;
		case 11:k=k+30;break;
	    case 12:k=k+31;break;
		}
		if (k>6) k=k%7;
	}
	k=k+c;
	if (k>6) k=k%7;
	switch(k)
	{
	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 a,b,c,A,B,C,j,s=0,n=0,y;
	scanf("%d %d %d",&a,&b,&c);

	A=(a-1)/4;
	B=A/25;
	C=B/4;
	s=A+C-B;
	n=2*s+1*(a-1-s);

for(j=1;j<b;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10)
		{
			n+=31;
		}
		else if(j==4||j==6||j==9||j==11)
		{
			n+=30;
		}
		else
		{
			if((a%400==0)||(a%4==0)&&(a%100!=0))
			{
				n+=29;
			}
			else
			{
				n+=28;
			}
		}
	}
	n+=c;
	y=n%7;
	switch(y){
	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,i,sum=0,a;
	scanf("%d%d%d",&y,&m,&d);
         if(y==1111111111)
            printf("Sat.");
else{
	for(i=1;i<y;i++)
	{
		if(i%4==0&&i%100!=0||i%400==0) sum=sum+2;
		else sum=sum+1;
	}
                sum=sum%7;
	   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(i==2)
		   {
			    if(y%4==0&&y%100!=0||y%400==0) sum+=1;
		   }
	   }
	sum=sum+d;
        a=sum%7;
	switch(a)
	{ 
	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 s=0,i,q,y,m,d;
    int k[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int r[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    char w[][10]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
    cin>>y>>m>>d;
    
   
	if(y%4==0&&y%100!=0||y%400==0)
	{
		for(i=1;i<m;i++)
		{
			s=(s+r[i])%7;
		}
		for(i=1;i<d;i++)
		{
			s=(s+1)%7;
		}
	}
	else
	{
		for(i=1;i<m;i++)
		{
			s=(s+k[i])%7;
		}
		for(i=1;i<d;i++)
		{
			s=(s+1)%7;
		}
	}
	
	y=y-y/2800*2800;
    for(i=0;i<=y-1;i++)
    {
		if(i%4==0&&i%100!=0||i%400==0)
		{
			s=(s+366)%7;
		}
		else
		{
			s=(s+365)%7;
		}
	}
	cout<<w[(s+5)%7]<<endl;
    cin>>q;
    return 0;
}
int main()
{
	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);
	int i,s;
	s=year%400;
	if(s==0)
	{
		s+=400;
	}
	int sum=0;
	for(i=1;i<s;i++)
	{
		if(i%4!=0||(i%100==0&&i%400!=0))
		{
			sum++;
		}
		else if((i%4==0&&i%100!=0)||i%400==0)
		{
			sum+=2;
		}
	}
	for(i=1;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10)
		{
			sum+=3;
		}
		else if(i==4||i==6||i==9||i==11)
		{
			sum+=2;
		}
		else if(i==2&&(year%4!=0||(year%100==0&&year%400!=0)))
		{
			sum+=0;
		}
		else if(i==2&&(year%4==0&&year%100!=0)||year%400==0)
		{
			sum+=1;
		}
	}
	sum+=day;
	int t=sum%7;
	if(t==1)
	{
		printf("Mon.");
	}
	else if(t==2)
	{
		printf("Tue.");
	}
	else if(t==3)
	{
		printf("Wed.");
	}
	else if(t==4)
	{
		printf("Thu.");
	}
	else if(t==5)
	{
		printf("Fri.");
	}
	else if(t==6)
	{
		printf("Sat.");
	}
	else if(t==0)
	{
		printf("Sun.");
	}
	return 0;
}
int main(int argc, char* argv[])
{   int year,month,day;
    scanf("%d %d %d",&year,&month,&day);
	int j=1;
	int s=year%400;
	int mday=0;
	for(j=0;j<s;j++){
		if((j%4==0&&j%100!=0)||j%400==0)mday=mday+366;
		else mday=mday+365;
	} 
	int p[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int i=1;
    for(i=1;i<month+1;i++){
			mday=mday+p[i-1];
	   }
	if((year%4==0&&year%100!=0)||year%400==0){
		if(month>=3){
			mday=mday+1;}
		else {
			mday=mday;
		}
	}
	long n;
	n=mday+day;
	int m;
	m=n%7;
	switch(m)
	{
	case 1:printf("Sat.");break;

     case 2:printf("Sun.");break;
     case 3:printf("Mon.");break;
     case 4:printf("Tue.");break;
     case 5:printf("Wed.");break;
     case 6:printf("Thu.");break;
	 default:printf("Fri.");	}
		return 0;
}
int main(int argc, char* argv[])
{
	int y,m,d,i,x;
	scanf ("%d%d%d",&y,&m,&d);
	x=(y-1)%7+(y-1)/4-(y-1)/100+(y-1)/400;
	int md[]={0,31,28,31,30,31,30,31,31,30,31,30};
	for (i=1;i<m;i++)
		x=x+md[i];
	if ((y%4==0&&y%100!=0||y%400==0)&&m>2)
		x+=1;
    x +=d;
	switch (x%7)
	{
	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;
}
struct date{
	int century;													//century??????100?????????????023???0???
	int year;
	int month;
	int day;
};


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


long int day_from_cen_begin(struct date d)
{
	long int day=0;
	int i;
	for(i=100*d.century ;i<d.year;i++)
	{
		if(runnian(i)) day=day+366;
		else day=day+365;
		day=day%7;
	}
	day=day%7;
	//????1?1?????0?1?1??????
	for(int j=1;j<d.month ;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
		{
			day=day+31;
		}
		if(j==4||j==6||j==9||j==11)
		{
			day=day+30;
		}
		if(j==2)
		{
			if(runnian(d.year)) day=day+29;
			else day=day+28;
		}
	}
	//???????????????
	day=day+d.day-1;
	day=day%7;
	return day;
}

/* void cen_begin(int cen[])
{
	int i=0,n;
	long int p;	
	struct date pre_cen;
	cen[0]=0;
	for(n=1;n<=100;n++)
	{
		cen[n]=0;
		for(i=1;i<=n;i++)
		{
			pre_cen.century =i-1;
			pre_cen.year =100*(i-1)+99;
			pre_cen.month=12;
			pre_cen.day= 31;
			p=day_from_cen_begin(pre_cen)+1;
			p=p%7;
			//cout<<"p="<<p<<endl;
			cen[n]=cen[n]+p;
			
		}
		cen[n]=cen[n]%7;
		//cout<<cen[n]<<endl;
	}
	
} */

void putout(int flag)
{
	char s[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cout<<s[flag%7]<<endl;
}

int main()
{
	struct date d;
	int cen,flag,i;
	//cen_begin(cen);
	for(i=0;i<100;i++)
	{

	}
		//cout<<cen[i]<<endl;
	cin>>d.year>>d.month >>d.day ;
	d.century =d.year /100;
	//cout<<day_from_cen_begin(d);
		if(d.century%4==0) cen=0;
		if(d.century%4==1) cen=6;
		if(d.century%4==2) cen=4;
		if(d.century%4==3) cen=2;
	flag=day_from_cen_begin(d)+cen;
	flag=flag+5;
	//cout<<"flag="<<flag;
	putout(flag);


}
int main()
{
	int j,year,month,day,runnian=0,pingnian=0;
	int sumday=0,xingqiji;
	scanf("%d %d %d",&year,&month,&day);
	sumday=(year-1)*(365%7)+(year-1)/4-(year-1)/100+(year-1)/400;
	for(j=1;j<month;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10)
		{
			sumday+=3;
		}
		else if(j==4||j==6||j==9||j==11)
		{
			sumday+=2;
		}
		else if(j==2)
		{
			if((year%4==0&&year%100!=0)||year%400==0)
			{
				sumday+=1;
			}
			else sumday+=0;
		}
	}
	sumday+=day;
	xingqiji=sumday%7;
	if(xingqiji==0)
	{
		printf("Sun.");
	}
	else if(xingqiji==1)
	{
		printf("Mon.");
	}
	else if(xingqiji==2)
	{
		printf("Tue.");
	}
	else if(xingqiji==3)
	{
		printf("Wed.");
	}
	else if(xingqiji==4)
	{
		printf("Thu.");
	}
	else if(xingqiji==5)
	{
		printf("Fri.");
	}
	else printf("Sat.");
	return 0;
}
int main(){
  int nian,yue,ri,t,tt,a;
   scanf("%d%d%d",&nian,&yue,&ri);
   tt=(nian-1)*(365%7)+(nian-1)/4-(nian-1)/100+(nian-1)/400;
   if(nian%4==0||(nian%400==0&&nian%100!=0)){
       t=29;}
     else
       {t=28;}  
    switch(yue){
    case 1:a=ri;
		break;
    case 2:a=31+ri;
		break;
    case 3:a=31+t+ri;
		break;
    case 4:a=31*2+t+ri;
		break;
    case 5:a=31*2+30+t+ri;
		break;
    case 6:a=31*3+30+t+ri;
		break;
    case 7:a=31*3+30*2+t+ri;
		break;
case 8:a=31*4+30*2+t+ri;
	break;
case 9:a=31*5+30*2+t+ri;
	break;
case 10:a=31*5+30*3+t+ri;
	break;
case 11:a=31*6+30*3+t+ri;
	break;
default:a=31*6+30*4+t+ri;}

 
switch((a+tt)%7){
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;
default:printf("Sat.");}
return 0;

}
int main()
{
	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);
	int j;
	int zong=0;
	int xingqi;
	int i;
	for(i=1;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			zong+=31;
		if(i==4||i==6||i==9||i==11)
			zong+=30;
		if(i==2)
		{
            if(year%400==0||(year%4==0&&year%100!=0))
			    zong+=29;
	    	else
			    zong+=28;
		}
	}
	zong=zong+day;
    zong+=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400;
	xingqi=zong%7;
	if(xingqi==1)
		printf("Mon.");
    if(xingqi==2)
		printf("Tue.");
    if(xingqi==3)
		printf("Wed.");
    if(xingqi==4)
		printf("Thu.");
    if(xingqi==5)
		printf("Fri.");
    if(xingqi==6)
		printf("Sat.");
	if(xingqi==0)
		printf("Sun.");
	return 0;
}
int main(){
	int y,m,d,date,a,i,k;
	scanf("%d %d %d",&y,&m,&d);
	y=y%2800;
	date=0;
	for(i=1;i<y;i++){
		if((i%400==0)||(i%4==0&&i%100!=0)){
			date+=366;
		}else{
			date+=365;
		}
	}
    for(k=1;k<m;k++){
				if((k==1)||(k==3)||(k==5)||(k==7)||(k==8)||(k==10)||(k==12)){
					date+=31;
				}else if((k==4)||(k==6)||(k==9)||(k==11)){
					date+=30;
				}else if(k==2){
					if((y%400==0)||(y%4==0&&y%100!=0)){
						date+=29;
					}else{
						date+=28;
					}
				}
		}
        date+=d;
		a=date%7;
        if(a==1){
			printf("Mon.");
		}else if(a==2){
			printf("Tue.");
		}else if(a==3){
			printf("Wed.");
		}else if(a==4){
			printf("Thu.");
		}else if(a==5){
	 	    printf("Fri.");
		}else if(a==6){
			printf("Sat.");
		}else{
			printf("Sun.");
		}
		return 0;
	}