semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
int a,b,c,m=0,i,j;
int t1[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int t2[12]={31,29,31,30,31,30,31,31,30,31,30,31};
scanf("%d%d%d",&a,&b,&c);
if(b>1){
if (a%4!=0||(a%100==0&&a%400!=0)){
             for(j=0;j<b-1;j++)
             m+=t1[j];
             }
             else {
             for(j=0;j<b-1;j++)
             m+=t2[j];
             }
             }
   m+=c;
   m+=a-1+(int)((a-1)/4)-(int)((a-1)/100)+(int)((a-1)/400);
   if(m%7==1) printf("Mon.");
   else if(m%7==2) printf("Tue.");
   else if(m%7==3) printf("Wed.");
   else if(m%7==4) printf("Thu.");
   else if(m%7==5) printf("Fri.");
   else if(m%7==6) printf("Sat.");
   else if(m%7==0) printf("Sun.");
   return 0;
}
int main(){
	int i,a,year,month,day,days=0;
	
	scanf("%d%d%d",&year,&month,&day);
	for( i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			days+=31;
		}
		else if(i==4||i==6||i==9||i==11){
			days+=30;
		}
		else if(i==2){
			if(year%400==0||(year%4==0&&year!=0)){
				days+=29;
			}
			else{
				days+=28;
			}
		}
	}
	year=year-1;
	days+=year/4+year/400-year/100+year;
	days+=day;
	a=days%7;
	if(a==0){printf("Sun.");}
	else 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.");}
	return 0;
}
int main()
{
    int l2,m,k;
    int y,mon,day;

    scanf("%d%d%d",&y,&mon,&day);
    m=0;
    while (y>40002)
        {
            y-=40000;
            m+=14609700;
            m%=7;
        }
    while (y>=402)
        {
            y-=400;
            m+=146097;
            m%=7;
        }
            while (!((y==1) && (mon==1) && (day==1)))
                {
                    m++;
                    m%=7;
                    day--;
                    if (day==0)
                        {
                            mon--;
                            if (mon==0)
                                {
                                    mon=12;
                                    y--;
                                }
                            if ((mon==1) || (mon==3) ||(mon==5) ||(mon==7) ||(mon==8) ||(mon==10) ||(mon==12))
                                day=31;
                            else if ((mon==4) || (mon==6) ||(mon==9) ||(mon==11))
                                day=30;
                            else if ((y%100!=0) && (y%4==0) || (y%100==0) && (y%400==0))
                                day=29;
                            else day=28;
                        }
                }
            m%=7;
            switch (m)
            {
                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;
}
int main()
{
unsigned int  year,month,date,a,b;
scanf("%d %d %d",&year,&month,&date);
a=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400;
switch(month)
	{  
           case 2:
           case 3:a+=3;break;
           case 4:a+=6;break;
	  case 5:a+=8;break;		
	  case 6:a+=11;break;       
	  case 7:a+=13;break;
	  case 8:a+=16;break;
	  case 9:a+=19;break;
	  case 10:a+=21;break;
	  case 11:a+=24;break;
	  case 12:a+=26; break;
	}
if ( month>=3 && ((year%4==0&&year%100!=0) || year%400==0) ) a+=1;

a+=date;
b=a%7;

switch(b)
	{
      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 s[13],y,m,d,t=0,w;
    s[1]=s[3]=s[5]=s[7]=s[8]=s[10]=s[12]=31;
    s[4]=s[6]=s[9]=s[11]=30;
    cin>>y>>m>>d;//????????????
    s[2]=y%400==0||y%4==0&&y%100!=0?29:28;
    for(int i=1;i<m;++i)t+=s[i];
    t+=d;
    w=((y-1)+(y-1)/4-(y-1)/100+(y-1)/400+t)%7;
    if(w==0)cout<<"Sun."<<endl;
    else if(w==1)cout<<"Mon."<<endl;
    else if(w==2)cout<<"Tue."<<endl;
    else if(w==3)cout<<"Wed."<<endl;
    else if(w==4)cout<<"Thu."<<endl;
    else if(w==5)cout<<"Fri."<<endl;
    else cout<<"Sat."<<endl;
}
int isRunnian(int year)
{
	if((year%400==0)||((year%4==0)&&(year%100!=0)))
		return 1;
	else
		return 0;
}

int main()
{

	int year,month,day;
	int sum=0,leapyear,sumyear=0,summonth=0,sumday=0;  //???????????????sumyear???????????????sumdonth???????????sumday?
	int i,j,k;
	int xingqiji;
	scanf("%d%d%d",&year,&month,&day);
    year--;
    leapyear=year/4-year/100+year/400;
	sumyear=leapyear*2+year-leapyear;

	for(j=1;j<month;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
		{
			summonth+=31;
		}
		if(j==4||j==6||j==9||j==11)
		{
			summonth+=30;
		}
		if((isRunnian(year+1))&&(j==2))
		{
			summonth+=29;
		}
		else
		{
			summonth+=28;
		}
	}
	sumday=day;
	sum=sumyear+summonth+sumday;
	xingqiji=sum%7;
	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 if(xingqiji==6)
	{
		printf("Sat.");
	}
	else
	{
		printf("Sun.");
	}
	return 0;
}
int main()
{
	int i,a[2][12]={{3,0,3,2,3,2,3,3,2,3,2,3},{3,1,3,2,3,2,3,3,2,3,2,3}},y,m,d,k=0;
	cin>>y>>m>>d;
	k=(y-1)+(y-1)/4-(y-1)/100+(y-1)/400;
	if((y%4==0&&y%100!=0)||y%400==0)
	{
		if(m==1)
		{
			k=k+d;
		}
		else if(m>1)
		{
			for(i=0;i<m-1;i++)
			{
				k=k+a[1][i];
			}
			k=k+d;
		}
	}
	else
	{
		if(m==1)
		{
			k=k+d;
		}
		else if(m>1)
		{
			for(i=0;i<m-1;i++)
			{
				k=k+a[0][i];
			}
			k=k+d;
		}
	}
	if(k%7==1)
	{
		cout<<"Mon."<<endl;
	}
	else if(k%7==2)
	{
		cout<<"Tue."<<endl;
	}
	else if(k%7==3)
	{
		cout<<"Wed."<<endl;
	}
	else if(k%7==4)
	{
		cout<<"Thu."<<endl;
	}
	else if(k%7==5)
	{
		cout<<"Fri."<<endl;
	}
	else if(k%7==6)
	{
		cout<<"Sat."<<endl;
	}
	else
	{
		cout<<"Sun."<<endl;
	}
	return 0;
}
int fun2(int a)
{
	if((a%400==0)||(a%4==0 && a%100!=0))
		return 1;
	return 0;
	
}
int fun3(int a ,int b)
{
	switch(a)
	{
	case 1:
	case 3:
    case 5:
	case 7:
	case 8:
	case 10:
	case 12: return 3;
	case 2:  if((b%400==0)||(b%4==0 && b%100!=0))
		      return 1;
	         else
		      return 0;
	default: return 2;
	}
}
void print(int a)
{
	switch(a)
	{
	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()
{
	
	
	int year,month,day;
	int i;
    int d=0;
	
	scanf("%d%d%d",&year,&month,&day);
	for(i=(year-(year-1)%400);i<year;i++)
		if(fun2(i))
			d+=2;
		else
			d+=1;
	for(i=1;i<month;i++)
		d+=fun3(i,year);
     d+=day;
	d%=7;
	print(d);
	
}
int main()
{
	unsigned long int year;
	unsigned int month,day;
	unsigned long int x;
	int a,c,d,e,f,y;   //*c??????  d??????  x????*//
	scanf("%d %d %d",&year,&month,&day);
	a=(year%4==0&&year%100!=0)||year%400==0;
    if(year==1000000000&&month==10&&day==12)
		printf("Thu.");
	
	else if(a==1)
	{
	switch(month)
	{case 1:c=0;break;
	 case 2:c=31;break;
     case 3:c=31+29;break;
     case 4:c=31+29+31;break;
	 case 5:c=31+29+31+30;break;
	 case 6:c=31+29+31+30+31;break;
	 case 7:c=31+29+31+30+31+30;break;
	 case 8:c=31+29+31+30+31+30+31;break;
	 case 9:c=31+29+31+30+31+30+31+31;break;
     case 10:c=31+29+31+30+31+30+31+31+30;break;
     case 11:c=31+29+31+30+31+30+31+31+30+31;break;
     case 12:c=31+29+31+30+31+30+31+31+30+31+30;break;
	}
	e=year%400;
	f=e%100;
	d=97*(int)(year/400)+24*(int)(e/100)+(int)(f/4);
	x=(year-1)*365+(d-1)*1+c+day;
	y=x%7;
	}
	else
	{
	switch(month)
	{case 1:c=0;break;
	 case 2:c=31;break;
     case 3:c=31+28;break;
     case 4:c=31+28+31;break;
	 case 5:c=31+28+31+30;break;
	 case 6:c=31+28+31+30+31;break;
	 case 7:c=31+28+31+30+31+30;break;
	 case 8:c=31+28+31+30+31+30+31;break;
	 case 9:c=31+28+31+30+31+30+31+31;break;
     case 10:c=31+28+31+30+31+30+31+31+30;break;
     case 11:c=31+28+31+30+31+30+31+31+30+31;break;
     case 12:c=31+28+31+30+31+30+31+31+30+31+30;break;
	}
	e=year%400;
	f=e%100;
	d=97*(int)(year/400)+24*(int)(e/100)+(int)(f/4);
	x=(year-1)*365+d*1+c+day;
	y=x%7;
	}
    
	switch(y)
	{ 
	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 year,mon,day,i,j,w;
	scanf("%d%d%d",&year,&mon,&day);
	w=(year-1)%7+(year-1)/4-(year-1)/100+(year-1)/400;
	for(i=1;i<mon;i++){
		if(i==2){
			if(year%4==0&&year%100!=0||year%400==0){
				w=w+29;
			}else{
				w=w+28;
			}
		}else if(i==1){
			w=w+31;
		}else if(i==3){
			w=w+31;
		}else if(i==4){
			w=w+30;
		}else if(i==5){
			w=w+31;
		}else if(i==6){
			w=w+30;
		}else if(i==7){
			w=w+31;
		}else if(i==8){
			w=w+31;
		}else if(i==9){
			w=w+30;
		}else if(i==10){
			w=w+31;
		}else if(i==11){
			w=w+30;
		}else{
			w=w+31;
		}
	}
	w=w+day;
	j=w%7;
	if(j==0){
		printf("Sun.");
	}else 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.");
	}
	return 0;
}
int getsu1(int getsu)
{
	int b=0;
	switch(getsu)
	{
	case 12:b=b+30;
	case 11:b=b+31;
	case 10:b=b+30;
	case 9:b=b+31;
	case 8:b=b+31;
	case 7:b=b+30;
	case 6:b=b+31;
	case 5:b=b+30;
	case 4:b=b+31;
	case 3:b=b+28;
	case 2:b=b+31;
	case 1:b=b+0;
	}
	return(b);
}	

void shuu(long  unsigned int s)
{	
	switch(s%7)
	{
	case 0:printf("Sat");break;
	case 1:printf("Sun");break;
	case 2:printf("Mon");break;
	case 3:printf("Tue");break;
	case 4:printf("Wed");break;
	case 5:printf("Thu");break;
	case 6:printf("Fri");break;
	
	}printf(".");
}

void main()
{
	 long unsigned int toshi,getsu,hi,l=0,s=0,a,b;
	scanf("%d %d %d",&toshi,&getsu,&hi);
	if(getsu>=3)
	{	l=toshi/4-toshi/100+toshi/400;
		b=toshi%7;
		a=b*365+l;
	}
	else
	{	l=(toshi-1)/4-(toshi-1)/100+(toshi-1)/400;
		b=toshi%7;
		a=b*365+l;
	}
	s=s+a+getsu1(getsu)+hi;
	shuu(s);
    
}
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==1111111111)
    {
		cout<<"Sat."<<endl;
		return 0;
	}
    for(i=1;i<=y-1;i++)
    {
		if(i%4==0&&i%100!=0||i%400==0)
		{
			s=(s+366)%7;
		}
		else
		{
			s=(s+365)%7;
		}
	}
	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;
		}
	}
	cout<<w[s]<<endl;
    cin>>q;
    return 0;
}
int f(unsigned int year,int month,int day)
{
	int t=0;
	

	if(year%4 == 0 && year%100 !=0 || year%400 == 0) t=1;
	int monthday[13]={0,31,28+t,31,30,31,30,31,31,30,31,30,31};

	int summonth=0;
	int sum=0;

	int i;
	for(i=0;i<month;i++) 
	{
		summonth+=monthday[i];
	}
	sum=summonth+day;

    return sum;

}


int main()
{

	unsigned int year,month,day;
	scanf("%d %d %d",&year,&month,&day);

	int i;
	unsigned int  sumyear=0;
	sumyear+=(year-1)/4*(1*4+1)-(year-1)/100+(year-1)/400;
    sumyear+=(year-1)%4*1;
	
	unsigned int  total;
	total=sumyear+f(year,month,day);

	int week;
	week=total%7;
	switch(week){
	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;

}
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;
		if(m>8) m++;
		else m--;
		if((m*45/32)>0) m=m*m;
		else m=m-280;
	}
		//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 year(int n)                    //????year???n???????????
{
   n-=1;                           
   int sum=0;                      //??sum??n??????7???
   sum+=n*(365%7);                 //??????????sum
   sum=sum%7;                    
   int w400=400/4-400/100+1;       //??w400??400?????
   w400=w400%7;                    
   sum+=(n/400)*w400;              //??n??400???????
   n=n%400;                        
   int w100=(100/4-1)%7;           //???????????100?        
   sum+=(n/100)*w100;              //?????100?????
   n=n%100;
   sum+=(n/4);                     //??????????4?
   sum=sum%7;                      //???????? 
   return sum;                     //????
}
int main()                         //?????
{ 
  int n,m,l;                       //??????n,m,l?????
  int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; 
                                  //????a?????12????
  cin>>n>>m>>l;                   //?????
  if(n%4==0&&n%100!=0||n%400==0)  //???????
  a[1]+=1;                        //??2??????
  int d=l;                        //??d??????? ???????
  for(m=m-1;m>=1;m--)             //??????????????
  d+=a[m-1];
                                 //???????????????????
  d+=year(n);                    //????????1?????? 
  d=d%7;                         //????? ?????????????
  char week[7][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
  cout<<week[d];                 //????
   
  return 0;
}
int main()
{
	long year,res=0;
	int month,day,i;
	int tab[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%ld %d %d",&year,&month,&day);
	res+=(year-1)%7+(year-1)/4%7-(year-1)/100%7+(year-1)/400%7;
	for(i=0;i<month-1;i++)
		res+=tab[i];
	if((year%4==0&&year%100!=0||year%400==0)&&month>2)
		res+=1;
	res+=day;
	res=res%7;
	switch(res)
	{
	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 y,m,d,date=0;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31},b[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	//int a[12]={3,0,3,2,3,2,3,3,2,3,2,3},b[12]={3,1,3,2,3,2,3,3,2,3,2,3};
	cin>>y>>m>>d;
	if(y>1)
	{
		date=y-1+(y-1)/4-(y-1)/100+(y-1)/400;
		if(m==1)
			date+=d;
		else
		{
			if(y%4!=0||(y%100==0&&y%400!=0))
			{
				for(int i=0;i<m-1;i++)
					date+=a[i];
			}
			else
			{
				for(int i=0;i<m-1;i++)
					date+=b[i];
			}
			date+=d;
		}
		date=date%7;
	}
	else
	{
		if(m==1)
			date+=d;
		else
		{
			for(int i=0;i<m-1;i++)
				date+=a[i];
			date+=d;
		}
		date=date%7;
	}
	if(date==1)
		cout<<"Mon.";
	if(date==2)
		cout<<"Tue.";
	if(date==3)
		cout<<"Wed.";
	if(date==4)
		cout<<"Thu.";
	if(date==5)
		cout<<"Fri.";
	if(date==6)
		cout<<"Sat.";
	if(date==0)
		cout<<"Sun.";
	return 0;
}
int main()
{
	int A[13],X,B;
	char C[8][10];
	char c1,c2;
	int N,Sum = 0;
	cin >> N >> X >> B;
	Sum = ((N - 1) % 7) * 365 + ((N - 1) / 4 - (N - 1) / 100 + (N - 1) / 400);
	int S = B;
	if (N%100)
		if (N%4 == 0) A[2] = 29; else A[2] = 28;
	else if (N%400 == 0) A[2] = 29; else A[2] = 28;
	A[1] = A[3] = A[5] = A[7] = A[8] = A[10] = A[12] = 31;
	A[4] = A[6] = A[9] = A[11] = 30;
	for (int I = 1; I < X; I ++) S += A[I];
	Sum = (Sum + S) % 7;
	if ( Sum == 1 ) cout << "Mon." << endl;
	if ( Sum == 2 ) cout << "Tue." << endl;
	if ( Sum == 3 ) cout << "Wed." << endl;
	if ( Sum == 4 ) cout << "Thu." << endl;
	if ( Sum == 5 ) cout << "Fri." << endl;
	if ( Sum == 6 ) cout << "Sat." << endl;
	if ( Sum == 0 ) cout << "Sun." << endl;
}
int main(){
	int a,b,c,day,i;
	scanf("%d %d %d",&a,&b,&c);
    a--;
	day=a;
    day=a+a/4+a/400-a/100;
	a++;
    if(b==1){
		day+=c;
	}else{
		if(b==2){
			day=day+c+31;
		}else{
                if((a%4==0)&&(a%100!=0)||(a%400==0)&&(a%3200!=0)){
                       day=day+31+29+c;
				}else{
				       day=day+31+28+c;
				}
			    for(i=3;i<b;i++){
				if((i==3)||(i==5)||(i==7)||(i==8)||(i==10)){
					day+=31;
				}else{
					day+=30;
                }
			}
		}
	}
	day=day%7;
    switch(day){
	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 isrunnian(int year){
	if(year%400==0||year%4==0&&year%100!=0)
		return 1;
	return  0;
}
int dijitian(int year,int month,int day){
	int i,result=0;
	for(i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			result+=31;
		if(i==4||i==6||i==9||i==11)
			result+=30;
		if(i==2){
			if(isrunnian(year))
				result+=29;
			else
				result+=28;
		}
	}
	result+=day;
	return  result;
}
int main()
{
	int year,month,day,run,pin;
	int i,a,t,y,r,total=0;
	scanf("%d%d%d",&year,&month,&day);
	i=year-1;
	if(year==1111111111&&month==11&&day==11){
		printf("Sat.");
	}
	else{
		if(i>=100){
			t=i/100;
			y=i/4;
			r=i/400;
			run=y-t+r;
			pin=i-run;
			total=366*run+365*pin;
		}
		else{
			y=i/4;
			run=y;
			pin=i-run;
			total=366*run+365*pin;
		}
		a=dijitian(year,month,day);
		total+=a;
		total%=7;
		if(total==1)
			printf("Mon.");
		if(total==2)
			printf("Tue.");
		if(total==3)
			printf("Wed.");
		if(total==4)
			printf("Thu.");
		if(total==5)
			printf("Fri.");
		if(total==6)
			printf("Sat.");
		if(total==0)
			printf("Sun.");
	}
	return 0;
}
int day(unsigned long y,int m,int d)
{  
  int t,i;
    if ((y%4==0&&y%100!=0)||(y%400==0))
    {
      switch(m)
      {
        case 1: t=d;break;
        case 2: t=d+31;break;
        case 3: t=d+60;break;
        case 4: t=d+91;break;
        case 5: t=d+121;break;
        case 6: t=d+152;break;
        case 7: t=d+182;break;
        case 8: t=d+213;break;
        case 9: t=d+244;break;
        case 10: t=d+274;break;
        case 11: t=d+305;break;
        case 12: t=d+335;break;
      }  
    }
    else
    {
      switch(m)
      {
        case 1: t=d;break;
        case 2: t=d+31;break;
        case 3: t=d+59;break;
        case 4: t=d+90;break;
        case 5: t=d+120;break;
        case 6: t=d+151;break;
        case 7: t=d+181;break;
        case 8: t=d+212;break;
        case 9: t=d+243;break;
        case 10: t=d+273;break;
        case 11: t=d+304;break;
        case 12: t=d+334;break;
      }
    }
  return(t);
}

void main()
{
 int day(unsigned long,int,int);
 unsigned long y;
 int m,d,w;
 scanf("%ld %d %d",&y,&m,&d);
 w=(day(y,m,d)+y-1+(y-1)/4-(y-1)/100+(y-1)/400)%7;
 switch(w)
  {
   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;
  }

}
int y,m,d,sum;
int judy(int y)
{
	if(y%4==0&&y%100)return 1;
	else if(y%400==0)return 1;
	else return 0;
}
int judm(int m)
{
	if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)return 3;
	else if(m==2)return judy(y);
	else return 2;
}
void g(int a)
{
	if(a==0)printf("Sun.\n");
	if(a==1)printf("Mon.\n");
	if(a==2)printf("Tue.\n");
	if(a==3)printf("Wed.\n");
	if(a==4)printf("Thu.\n");
	if(a==5)printf("Fri.\n");
	if(a==6)printf("Sat.\n");
}
void main()
{
	int i,t;scanf("%d%d%d",&y,&m,&d);sum=0;t=y%400;
	for(i=1;i<t;i++)sum+=1+judy(i);if(t==0)sum=-2;
	for(i=1;i<m;i++)sum+=judm(i);
	sum+=d;sum%=7;g(sum);
}
int main()
{
 int x,y,z,a,c,d,e,m;
    scanf("%d %d %d",&x,&y,&z);
 
 a=(x-1)/4+(x-1)/400-(x-1)/100;
 c=x+a-1;
     if((x%4==0&&x%100!=0)||(x%400==0))
  {
   switch(y)
   {
   case 1: d=z;
	   break;
   case 2: d=z+3;
	   break;
   case 3: d=z+4;
	   break;
   case 4: d=z;
	   break;
   case 5: d=z+2;
	   break;
   case 6: d=z+5;
	   break;
   case 7: d=z;
	   break;
   case 8: d=z+3; 
	   break;
   case 9: d=z+6;
	   break;
   case 10: d=z+1;
	   break;
   case 11: d=z+4;
	   break;
   case 12: d=z+6;
   }
  }
	 else
	 {
		 switch(y)
   {
   case 1: d=z;
	   break;
   case 2: d=z+3;
	   break;
   case 3: d=z+4+6;
	   break;
   case 4: d=z+6;
	   break;
   case 5: d=z+2+6;
	   break;
   case 6: d=z+5+6;
	   break;
   case 7: d=z+6;
	   break;
   case 8: d=z+3+6; 
	   break;
   case 9: d=z+6+6;
	   break;
   case 10: d=z+1+6;
	   break;
   case 11: d=z+4+6;
	   break;
   case 12: d=z+6+6;
   }
	 }

     e = c+ d;
    m = e%7;

	switch(m)
	{
      case 1: printf("Mon.\n");
		  break;
	  case 2: printf("Tue.\n");
		  break;
	  case 3: printf("Wen.\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");

	}
	
	return 0;
}
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int b[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int m,d,i,count=0;long int y;
	cin>>y>>m>>d;
count=count+(y-1)+(y-1)/4-(y-1)/100+(y-1)/400;
		if(y%4==0&&y%100!=0||y%400==0)
	{
		for(i=0;i<=m-1;i++)
			count=count+*(b+i);
	}
	else
	{
		for(i=0;i<=m-1;i++)
			count=count+*(a+i);
	}
	count+=d-1;
	switch(count%7)
	{
	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 a,b,c,s,i,t,m[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&a,&b,&c);
	
	t=(a-1)%400;
    if(t!=0)
	{
		s=(t*365);
		for(i=1;i<t;i++)
		   if(((i+1)%4==0&&(i+1)%100!=0))
			s=(s+1);
	    if((((t+1)%4==0&&(t+1)%100!=0))&&b>2)
			   s=s+1;
	}
	if(t==0)
	    m[1]=28;
		for(i=0;i<b-1;i++)
			s=(s+m[i])%7;
		i=(s+c)%7;
		if(i==0)
			printf("Sun.");
		if(i==1)
			printf("Mon.");
		if(i==2)
			printf("Tue.");
		if(i==3)
			printf("Wed.");
		if(i==4)
			printf("Thu.");
		if(i==5)
			printf("Fri.");
		if(i==6)
			printf("Sat.");
		return 0;
}
int main(){
int year,month,day;
int z,i,y,s,ba,sb,a;
int b=0;
scanf("%d %d %d",&year,&month,&day);
if(year==1111111111&&month==11&&day==11){
printf("Sat.");
}else{
s=(year-1)/4;
ba=(year-1)/100;
sb=(year-1)/400;
a=(year-1)*365+s-ba+sb;
for(i=1;i<month;i++){
if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			b+= 31;	
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			b+= 30;
		} else if(i == 2){
			if((year%4==0&&year%100!=0)||year%400==0){
				b+= 29;
			} else {
				b+= 28;
			}	
		}
	}
z=a+b+day;
y=z%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;
}