semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	int i,k,t,j,n,a[201],b[201];
	int c=0,f=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);}
	for(j=0;j<n;j++){
		if(a[j]==0&&b[j]==1){
			c=c+1;}
		else if(a[j]==1&&b[j]==2){
			c=c+1;}
		else if(a[j]==2&&b[j]==0){
			c=c+1;}
		else if(a[j]==1&&b[j]==0){
			f=f+1;}
		else if(a[j]==2&&b[j]==1){
			f=f+1;}
		else if(a[j]==0&&b[j]==2){
			f=f+1;}
	}
	if(f>c){
		printf("B");
		return 0;}
	else if(c>f){
		printf("A");
		return 0;}
	printf("Tie");
	return 0;
}
int main()
{
	int a[200], b[200], i, r=0, n;
	scanf("%d", &n);
	for(i=0;i<=(n-1);i++)
	{
		scanf("%d%d", &a[i], &b[i]);
	}
	for(i=0;i<=(n-1);i++)
	{
		if(((a[i]==0)&&(b[i]==1))||((a[i]==1)&&(b[i]==2))||((a[i]==2)&&(b[i]==0)))
		{	
			r++;
		}
		else if(((b[i]==0)&&(a[i]==1))||((b[i]==1)&&(a[i]==2))||((b[i]==2)&&(a[i]==0)))
		{
			r--;
		}
	}
	if(r>0)
	{	
		printf("A");
	}
	else if(r<0)
	{	
		printf("B");
	}
	else if(r==0)
	{
		printf("Tie");
	}
	return 0;
}
int main(){
	int n,i,a[200],b[2000],p=0,q=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<n;i++){
		if(a[i]-b[i]==1){
			q+=1;
		}else if(a[i]-b[i]==2){
			p+=1;
		}else if(a[i]-b[i]==-1){
			p+=1;
		}else if(a[i]-b[i]==-2){
			q+=1;
		}else{
			p=p;
			q=q;
		}
	}
	if(p>q){
		printf("A");
	}else if(p<q){
		printf("B");
	}else{
		printf("Tie");
	}
	return 0;
}
int main(){
    int n,i,s=0,a[200],b[200];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        scanf("%d",&b[i]);
        if((a[i]==0&&b[i]==1)||(a[i]==1&&b[i]==2)||(a[i]==2&&b[i]==0)){
            s=s+1;
        }
        else if(a[i]==b[i]){
            s=s+0;
        }
        else{
            s=s-1;
        }
    }
    if(s>0){
        printf("A");
    }
    else if(s==0){
        printf("Tie");
    }
    else if(s<0){
        printf("B");
    }
    return 0;
}
int main()
{
int n,a[200],b[200],result=0,i,j,k;
scanf("%d",&n);
for(i=0;i<n;i++)
        {
        scanf("%d%d",&a[i],&b[i]);
        }
for(i=0;i<n;i++)
        {
        if(a[i]-b[i]==-1||a[i]-b[i]==2) result=result+1;
        else if(a[i]-b[i]==1||a[i]-b[i]==-2) result--;
        }
if(result>0) printf("A");
if(result<0) printf("B");
if(result==0) printf("Tie");
}
int main(){
int n,i,a[100],b[100],c=0,d=0,e=0;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<n;i++){
	if(a[i]==b[i]) e++;
	else if((a[i]==0&&b[i]==1)||(a[i]==1&&b[i]==2)||(a[i]==2&&b[i]==0)) c++;
	else if((a[i]==0&&b[i]==2)||(a[i]==1&&b[i]==0)||(a[i]==2&&b[i]==1)) d++;
}


if(c>d) printf("A\n");
else if(c<d) printf("B\n");
else if(c=d) printf("Tie\n");
	return 0;
}
int main(){
    int n;
    int p=0,q=0;
    int a[300],b[300];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i],&b[i]);
    }
    for(int i=0;i<n;i++){
        if(a[i]==0&&b[i]==0){p=p+0;q=q+0;}
        else if(a[i]==0&&b[i]==1){p=p+1;q=q+0;}
        else if(a[i]==0&&b[i]==2){p=p+0;q=q+1;}
        else if(a[i]==1&&b[i]==0){p=p+0;q=q+1;}
        else if(a[i]==1&&b[i]==1){p=p+0;q=q+0;}
        else if(a[i]==1&&b[i]==2){p=p+1;q=q+0;}
        else if(a[i]==2&&b[i]==0){p=p+1;q=q+0;}
        else if(a[i]==2&&b[i]==1){p=p+0;q=q+1;}
        else if(a[i]==2&&b[i]==2){p=p+0;q=q+0;}
    }
    if(p==q)printf("Tie");
     if(p>q)printf("A");
      if(p<q)printf("B");
      return 0;
}
int main ()
{
int i,n,p,q;
int a[200],b[200];
scanf("%d\n",&n);
p=0;
q=0;
for(i=0;i<n;i++){
scanf("%d%d\n",&a[i],&b[i]);
if(a[i]==b[i]+1){
q=q+1;}else if(a[i]==b[i]+2){
p=p+1;}else if(a[i]==b[i]-1){
p=p+1;}else if(a[i]==b[i]-2){
q=q+1;}
}
if(p>q){
printf("A");}
else if(p==q){
printf("Tie");}
else if(p<q){
printf("B");}
return 0;
}
int main(){
	int i,n,a=0,b=0,c,d;
	scanf("%d",&n);

    for(i=0;i<n;i++){
		scanf("%d%d",&c,&d);
		if(((c+1)==d)||((c-2)==d)){
			a++;
		}
         else if(((d+1)==c)||((d-2)==c)){
			b++;
		}	
	}

	if(a<b){
		printf("B");
	}else if(a==b){
		printf("Tie");
	}else{
		printf("A");
	}




		return 0;
}
int main(){
	int n;
	int i,j;
	int p,q;
	p=0;
	q=0;
	int a[200],b[200];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&a[i-1],&b[i-1]);
		if(a[i-1]==0&&b[i-1]==1)
			{p++;}
		if(a[i-1]==1&&b[i-1]==2)
			{p++;}
		if(a[i-1]==2&&b[i-1]==0)
			{p++;}
		if(a[i-1]==1&&b[i-1]==0)
			{q++;}
		if(a[i-1]==2&&b[i-1]==1)
			{q++;}
		if(a[i-1]==0&&b[i-1]==2)
			{q++;}
	}
	if(p>q){printf("A");}
	if(p<q){printf("B");}
	if(p==q){printf("Tie");}
	return 0;
}
int main(){
	int n,i,a,b,p=0,q=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		if(a==0&&b==1){
			p++;
		}
		if(a==0&&b==2){
			q++;
		}
		if(a==0&&b==0){
		//	printf("Tie\n");
		}
		if(a==1&&b==0){
			q++;
		}
		if(a==1&&b==1){
		//	printf("Tie\n");
		}
		if(a==1&&b==2){
			p++;
		}
		if(a==2&&b==0){
			p++;
		}
		if(a==2&&b==2){
		//	printf("Tie\n");
		}
		if(a==2&&b==1){
			q++;
		}
	}
	if(p==q){
		printf("Tie");
	}
	if(p>q){
		printf("A");
	}
	if(q>p){
		printf("B");
	}
	return 0;
}
int main(){
int n,i,a,b,c,d;
scanf("%d",&n);
c=0;
d=0;
for(i=1;i<=n;i++){
scanf("%d%d",&a,&b);
if((a==0&&b==1)||(a==1&&b==2)||(a==2&&b==0)){
c++;
}else if((b==0&&a==1)||(b==1&&a==2)||(b==2&&a==0)){
d++;
}else if(a==b){
    c=c;
    d=d;
}
}
if(c>d){
printf("A");
}
else if(c<d){
printf("B");
}else if(c=d){
printf("Tie");
}
return 0;
}
int main(){
int n,i,p,q,a[1000],b[1000];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&a[i],&b[i]);
}
p=0;
q=0;
for(i=0;i<n;i++){
	if(a[i]==0){
		if(b[i]==1){
		p++;
		} else{
		if(b[i]==2)
			q++;
		}
	}else{
		if(a[i]==1){
			if(b[i]==0){
			q++;
			}else{
			if(b[i]==2)
				p++;
			}
		}else{
			if(a[i]==2){
				if(b[i]==0){
				p++;
				}else{
				if(b[i]==1)
					q++;
				}
			}
		}
	}
}
if(p>q){
printf("A");
}else{
	if(p<q){
	printf("B");
	}else{
	if(p==q)
		printf("Tie");
	}
}

return 0;
}
int main(){
    int n;
    int sz[200][2];
    int i,j,a=0,b=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=0;j<2;j++){
         scanf("%d",&sz[i][j]);   
        }
   }
   for(i=0;i<n;i++){
       if(sz[i][0]==sz[i][1]){
           a++;
           b++;
       }
       if(sz[i][0]>=sz[i][1]){
          if(sz[i][0]==2&&sz[i][1]==0)
          a++;
          else
          b++;
       }
       if(sz[i][0]<=sz[i][1]){
          if(sz[i][0]==0&&sz[i][1]==2)
           b++;
           else
           a++;
       }
            
   }
   if(a>b){
       printf("A");
   }
   if(a==b){
       printf("Tie");
   }
   if(a<b){
       printf("B");
   }
   return 0;
}
int main ()
{
	int n,i,a,b,m=0,p=0;
	scanf("%d",&n);
	for (i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if((a==0&&b==0)||(a==1&&b==1)||(a==2&&b==2)){
			m=m+0;
			p=p+0;
		}
		if((a==0&&b==1)||(a==1&&b==2)||(a==2&&b==0)){
			m=m+1;
			p=p+0;
		}
		if((a==0&&b==2)||(a==1&&b==0)||(a==2&&b==1)){
			m=m+0;
			p=p+1;
		}
	}
	if(m==p){
		printf("Tie");
	}
	if(m>p){
		printf("A");
	}
	if(m<p){
		printf("B");
	}
	return 0;
}
int main(){
	int n,i,a,b,x=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if(a==0){
			if(b==1) x+=1;
			else if(b==2) x-=1;
		}
		else if(a==1){
			if(b==0) x-=1;
			else if(b==2) x+=1;
		}
		else{
			if(b==0) x+=1;
			if(b==1) x-=1;
		}
	}
	if(x>0) printf("A");
	else if(x==0) printf("Tie");
	else printf("B");
	return 0;
}
int main(){
int a,b,i,n,t=0,m=0,p=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&a,&b);
if(a==0&&b==0)
p++;
if(a==0&&b==1)
t++;
if(a==0&&b==2)
m++;
if(a==1&&b==0)
m++;
if(a==1&&b==1)
p++;
if(a==1&&b==2)
t++;
if(a==2&&b==0)
t++;
if(a==2&&b==1)
m++;
if(a==2&&b==2)
p++;}
if(t>m)
printf("A");
else if(t<m)
printf("B");
else if(t==m||p==n)
printf("Tie");
	return 0;}
main()
{
      int n,i,j=0,k=0,a,b;
      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
      scanf("%d %d",&a,&b);
      if((a==0&&b==1)||(a==1&&b==2)||(a==2&&b==0)) 
      j++;
      else if((b==0&&a==1)||(b==1&&a==2)||(b==2&&a==0))
      k++;
      else if((a==0&&b==0)||(a==1&&b==1)||(a==2&&b==2))
      ;
      else;
      }
      if(j>k)
      printf("A");
      else if(j<k)
      printf("B");
      else
      printf("Tie");
      }
int main (){
 int n;
 scanf("%d",&n);
 int i,a[n],b[n];
 int m=0,j=0;
 for(i=0;i<n;i++){
  scanf("%d%d",&a[i],&b[i]);
  if(a[i]==b[i]){
  }else if(a[i]==b[i]-1||a[i]==b[i]+2){
   m++;
  }else{
   j++;
  }
 }
 if(m>j){
  printf("A");
 }else if(m==j){
  printf("Tie");
 }else{
  printf("B");
 }
return 0;
}
int main(){
	int n,a,b,i,c,d;
	a=0;
	b=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&c,&d);
		if(c==0&&d==1)
			a++;
		else if(c==1&&d==2)
			a++;
		else if(c==2&&d==0)
			a++;
		else if(c==1&&d==0)
			b++;
		else if(c==2&&d==1)
			b++;
		else if(c==0&&d==2)
			b++;
	}
	if(a>b)
		printf("A");
	else if(b>a)
		printf("B");
	else 
		printf("Tie");


	return 0;
}
int main() 
{  
	int n,i,A=0,B=0,a,b;
	scanf ("%d",&n);
	for (i=0;i<n;i++){
	scanf("%d%d",&a,&b);
	if(a==0&&b==1){
		A++;}
	else if (a==1&&b==0){
	  B++;
	}
	else if (a==1&&b==2){
	A++;
	}
	else if (a==2&&b==1){
	B++;
	}
	else if (a==0&&b==2){
	B++;
	}
	else if (a==2&&b==0){
			A++;
	}

	}

if (A>B)
printf("A");
else if (A<B)
printf("B");
else 
printf("Tie");
 return 0; 
}
main()
{
      int n,i;
      scanf("%d",&n);
      int m1=0,m2=0;
      for(i=0;i<n;i++)
      {
            int a,b;
            scanf("%d %d",&a,&b);
            if ((a==0&&b==0)||(a==1&&b==1)||(a==2&&b==2))  
            {m1+=1;m2+=1;}
            if((a==0&&b==1)||(a==1&&b==2)||(a==2&&b==0)) m1+=2;
            if((a==1&&b==0)||(a==0&&b==2)||(a==2&&b==1)) m2+=2;
      }
      if(m1==m2) printf("Tie");
      else if(m1>m2) printf("A");
      else printf("B");
}
int main() {
    int n;
    scanf("%d",&n);
    int sz[n][2];
    int i;
    for(i=0;i<n;i++) {
        scanf("%d %d",&(sz[i][0]),&(sz[i][1]));
    }
    int A=0,B=0,k;
    for(i=0;i<n;i++) {
        k=sz[i][0]-sz[i][1];
        if(k==-1||k==2) {
            A++;
        }
        if(k==1||k==-2) {
            B++;
        }
    }
    if(A>B) {
        printf("A");
    }
    if(A<B) {
        printf("B");
    }
    if(A==B) {
        printf("Tie");
    }
    return 0;
}
main()
{  int a[200],b[200];
   int s=0;
   int n;
   scanf("%d",&n);
   for(int i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);
                        if(a[i]==b[i]){s=s;}
                        if(a[i]==0&&b[i]==1){s++;}
                        if(a[i]==0&&b[i]==2){s--;}
                        if(a[i]==1&&b[i]==2){s++;}
                        if(a[i]==1&&b[i]==0){s--;}
                        if(a[i]==2&&b[i]==0){s++;}
                        if(a[i]==2&&b[i]==1){s--;}}
      
      if(s>0){printf("A");} 
      if(s==0){printf("Tie");}
      if(s<0){printf("B");}  
      }
int main()
{
	int n,i,a1,b1,c1;
	int a[200],b[200];
	a1=0;
	b1=0;
	c1=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<n;i++){
		if(a[i]==0&&b[i]==0)
			c1++;
		else if(a[i]==0&&b[i]==1)
			a1++;
		else if(a[i]==0&&b[i]==2)
			b1++;
		else if(a[i]==1&&b[i]==0)
			b1++;
		else if(a[i]==1&&b[i]==1)
			c1++;
		else if(a[i]==1&&b[i]==2)
			a1++;
		else if(a[i]==2&&b[i]==0)
			a1++;
			
		else if(a[i]==2&&b[i]==1)
			b1++;
	    else if(a[i]==2&&b[i]==2)
			c1++;

	}
	if(a1>b1)
		printf("A");
	else if(a1==b1)
		printf("Tie");
	else 
		printf("B");
	return 0;
}
int main(){
	int n;
	scanf("%d",&n);
	int sz[234][2];
	int i,j;
	for(i=0;i<n;i++){
		for(j=0;j<2;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	int k,l;
	k=0;
	l=0;

	for(i=0;i<n;i++){
		if(sz[i][0]==0){
			if(sz[i][1]==1){
				k++;
			}
			if(sz[i][1]==2){
				l++;
			}
		}else if(sz[i][0]==1){
			if(sz[i][1]==0){
				l++;
			}
			if(sz[i][1]==2){
				k++;
			}
		}else{
			if(sz[i][1]==0){
				k++;
			}
			if(sz[i][1]==1){
				l++;
			}
		}
	}
	if(k>l){
		printf("A");
	}else if(k<l){
		printf("B");
	}else{
		printf("Tie");
	}
	return 0;
}
int main(){
    int n,i,SA=0,SB=0;
    scanf("%d",&n);
    int a[n],b[n];
    for(i=0;i<n;i++){
    scanf("%d %d",&a[i],&b[i]);
    }
    for(i=0;i<n;i++){
        if(a[i]==b[i]-1||a[i]==b[i]+2){
            SA++;
        }
        else if(b[i]==a[i]-1||b[i]==a[i]+2){SB++;}
        else{SA=SA;SB=SB;}
    }
   if(SA>SB){printf("A");} 
   else if(SA<SB){printf("B");}
   else if(SA=SB){printf("Tie");}
   return 0;
}
int main() {
    int n;
	cin >> n;
	int total = 0;
	for(int i=0; i<n; i++) {
		int a,b;
		cin >> a >> b;
		if(b == (a+1)%3) {
			total += 1;
		} else if(a == (b+1)%3) {
			total -= 1;
		}
	}
	if(total > 0) {
		cout << "A" << endl;
	} else if(total < 0) {
		cout << "B" << endl;
	} else {
		cout << "Tie" << endl;
	}
    return 0;
}
int main(){
    int n,a=0,b=0;
    int sz[200][2];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            scanf("%d %d",&sz[i][0],&sz[i][1]);
    }
    for(int i=0;i<n;i++){
            if(sz[i][0]==0){
                if(sz[i][1]==1){
                    a++;
                } else if(sz[i][1]==2){
                    b++;
                } 
            }
            if(sz[i][0]==1){
                if(sz[i][1]==2){
                    a++;
                } else if(sz[i][1]==0){
                    b++;
                } 
            }
            if(sz[i][0]==2){
                if(sz[i][1]==0){
                   a++;
                } else if(sz[i][1]==1){
                   b++;
                } 
            }
    }
    if(a>b){
        printf("A");
    } else if(a<b){
        printf("B");
    } else if(a==b){
        printf("Tie");
    }
    return 0;
}
int main(){
    int n,time[200][2],A=0,B=0;
    scanf("%d",&n);
    for(int a=0;a<n;a++){
        scanf("%d %d",&(time[a][0]),&(time[a][1]));
    }
    for(int a=0;a<n;a++){
        if((time[a][0]==0&&time[a][1]==2)){
               B++;
           }
           if(time[a][0]>time[a][1]&&(time[a][0]!=2||time[a][1]!=0)){
                 B++;
           }
          if((time[a][1]==0&&time[a][0]==2)){
               A++;
           }
          if(time[a][1]>time[a][0]&&(time[a][1]!=2||time[a][0]!=0)){
               A++;
           }
    }
    if(A==B){printf("Tie");}
    if(A>B){printf("A");}
    if(A<B){printf("B");}
    return 0;
}
int main(){
	int n,i,a,b,c,j=0,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d\n",&a,&b);
		c=a-b;
		if(c==0){
		continue;
		}else if(c==-1||c==2){
			j++;
		}else{
			k++;
		}
	}
if(j>k){
			printf("A");
		}else if(k>j){
			printf("B");
		}else if(j==k){
			printf("Tie");
		}

	return 0;
}
int main(){
	int c=0,d=0,i,n,a[200],b[200];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
	}
    for(i=0;i<n;i++){
		if(a[i]==0&&b[i]==1||a[i]==1&&b[i]==2||a[i]==2&&b[i]==0) c++;
		else if(a[i]==b[i]){
			c=c;d=d;
		}else d++;
	}
	if(c>d) printf("A");
	else if(c<d) printf("B");
	else printf("Tie");
	return 0;
}
int main(){
int n,i;
int game[201][2]={0};
int a=0,b=0;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%d %d",&game[i][0],&game[i][1]);
}
for(i=0;i<n;i++){
	if(game[i][0]==game[i][1]){
		continue;}
	else if(game[i][0]==0&&game[i][1]==1){
		a++;
		continue;
	}
	else if(game[i][0]==0&&game[i][1]==2){
		b++;
		continue;
	}
	else if(game[i][0]==1&&game[i][1]==0){
		b++;
		continue;
	}
	else if(game[i][0]==1&&game[i][1]==2){
		a++;
		continue;
	}
	else if(game[i][0]==2&&game[i][1]==0){
		a++;
		continue;
	}
	else if(game[i][0]==2&&game[i][1]==1){
		b++;
		continue;
	}
}
if(a==b){
	printf("Tie");
}
else if(a>b){
	printf("A");
}
else{
	printf("B");
}
	return 0;
}
int main()
{
	long y,m,d,w,a,b;
	scanf("%d%d%d",&y,&m,&d);

	if((y%4==0&&y%100!=0)||y%400==0)b=1;
	else b=0;
	
	switch(m)
	{
	   case 1:a=0;
	   break;
	   case 2:a=31;
	   break;
	   case 3:a=59+b;
	   break;
	   case 4:a=90+b;
	   break;
	   case 5:a=120+b;
	   break;
	   case 6:a=151+b;
	   break;
	   case 7:a=181+b;
	   break;
	   case 8:a=212+b;
	   break;
	   case 9:a=243+b;
	   break;
	   case 10:a=273+b;
	   break;
	   case 11:a=304+b;
	   break;
	   case 12:a=334+b;
	   break;	
	   default:;
	}
	
	w=y-1+(y-1)/4-(y-1)/100+(y-1)/400+a+d;
	switch(w%7)
	{
		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()
{
	long int y,m,d;
	int total1=0,total2=0,total3=0,total;
	int i,j,a;

	scanf("%d%d%d",&y,&m,&d);
	a=(y-1)%400;
	for(j=1;j<=a;j++)
	{
		total1=(total1+1)%7;
		if((j%4==0&&j%100!=0)||(j%400==0))
		{
			total1=total1+1;
		}
	}

	int mth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=1;i<m;i++)
	{
		total2=total2+mth[i-1];
	}
	if(((y%4==0&&y%100!=0)||y%400==0)&&(m>2))
	{
		total2=total2+1;
	}
	total3=d;
	total=total1+total2+total3;
	if(total%7==1)
	{
		printf("Mon.\n");
	}
	else if(total%7==2)
	{
		printf("Tue.\n");
	}
	else if(total%7==3)
	{
		printf("Wed.\n");
	}
    else if(total%7==4)
	{
		printf("Thu.\n");
	}
	else if(total%7==5)
	{
		printf("Fri.\n");
	}
	else if(total%7==6)
	{
		printf("Sat.\n");
	}
	else if(total%7==7)
	{
		printf("Sun.\n");
	}

	return 0;
}
int main ()
 {
	 long year,month,day;
	 scanf("%ld%ld%ld",&year,&month,&day);
	 int sumyearday=0;
	 int i,j;
          if(year>400)
          {
               year=400+(year-400)%400;
           }
	 for (i=1;i<year;i++)
	 {
		 if ((i%400==0)||(i%4==0&&i%100!=0))
		 	 sumyearday=sumyearday+(366%7);
		 else 
		 	 sumyearday=sumyearday+(365%7);
	 }
	 int mday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
     int total = 0;
	 for (j=0;j<month-1;j++)
	 {
		 total=total+mday[j];
	 }
	 if ((year%4==0&&year%100!=0&&month>=3)||(year%400==0&&month>=3))
	 {
		 total = total + 1;
	 }
	 int days;
	 days=sumyearday+total%7+day%7;
	 int result;
	 result=days%7;
	 if (result==1)printf("Mon.\n");
	 else if (result==2)printf("Tue.\n");
	 else if (result==3)printf("Wed.\n");
	 else if (result==4)printf("Thu.\n");
	 else if (result==5)printf("Fri.\n");
	 else if (result==6)printf("Sat.\n");
	 else if (result==0)printf("Sun.\n");
	 return 0;
 }
int isRunNian(int year); 
int DiJiTian(int year, int month, int day); 
int main()
{
    int sy,year1,month1,day1;
   
    scanf("%d%d%d",&year1,&month1,&day1);
     
sy=(DiJiTian(year1, month1,day1)+1*(year1-1)+((year1-1)/4-(year1-1)/100+(year1-1)/400))%7; 
if(sy==0)printf("Sun.");
if(sy==1)printf("Mon.");
if(sy==2)printf("Tue.");
if(sy==3)printf("Wed.");
if(sy==4)printf("Thu.");
if(sy==5)printf("Fri.");
if(sy==6)printf("Sat.");

return 0;
}
  
    int DiJiTian(int year, int month, int day)
{
	int result = 0;
	int i;
	for(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 isRunNian(int year)
{
	int result;
	if(year%400 == 0 ||(year%4==0 && year%100!=0))
    {
		result = 1;
	} else
    {
		result = 0;
	}
      return result;	
}
int main()
{
	int a,b,c,s,d,y;
	scanf("%d%d%d",&a,&b,&c);
	if(b==1)
	{
		s=0;
	}
	else if(b==2)
	{
		s=31;
	}
	else if(b==3)
	{
		if(a%4==0||a%400==0)
		{
			s=31+29;
   		}
		else
		{
			s=31+28;
		}
	}
	else if(b==4)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31;
   		}
		else
		{
			s=31+28+31;
		}
	}
	else if(b==5)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30;
   		}
		else
		{
			s=31+28+31+30;
		}
	}
	else if(b==6)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31;
   		}
		else
		{
			s=31+28+31+30+31;
		}
	}
	else if(b==7)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30;
   		}
		else
		{
			s=31+28+31+30+31+30;
		}
	}
	else if(b==8)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30+31;
   		}
		else
		{
			s=31+28+31+30+31+30+31;
		}
	}
	else if(b==9)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30+31+31;
   		}
		else
		{
			s=31+28+31+30+31+30+31+31;
		}
	}
   else if(b==10)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30+31+31+30;
   		}
		else
		{
			s=31+28+31+30+31+30+31+31+30;
		}
	}
	else if(b==11)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30+31+31+30+31;
   		}
		else
		{
			s=31+28+31+30+31+30+31+31+30+31;
		}
	}
	else if(b==12)
	{
		if((a%4==0&&a%100!=0)||a%400==0)
		{
			s=31+29+31+30+31+30+31+31+30+31+30;
   		}
		else
		{
			s=31+28+31+30+31+30+31+31+30+31+30;
		}
	}
	a--;
    d=a+a/4+a/400-a/100;
	y=(s+c+d)%7;
    if(y==1)
	{
		printf("Mon.");
	}
	else if(y==2)
	{
		printf("Tue.");
	}	
    else if(y==3)
	{
		printf("Wed.");
	}
	else if(y==4)
	{
		printf("Thu.");
	}
	else if(y==5)
	{
		printf("Fri.");
	}
	else if(y==6)
	{
		printf("Sat.");
	}
	else if(y==0)
	{
		printf("Sun.");
	}

	return 0;
}
int main()
{
	int i,y,l_y,l_y1,m,d,t=0,w;
	int m_p[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int r_p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	char week[7][10]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cin>>y>>m>>d;
	while(y>400)
	{
		y=y-400;
	}
	/*cout<<y<<" ";*/
	l_y1=((y%4==0)&&(y%100!=0)||(y%400==0));
	while(y>1)
	{
		y--;
		l_y=((y%4==0)&&(y%100!=0)||(y%400==0));
		if(l_y==0)
			t=t+365;
		else
			t=t+366;
		/*cout<<t<<" ";*/
	}
	if (l_y1==0)
		for(i=0;i<m-1;i++)
			t=t+m_p[i];
	else
		for(i=0;i<m-1;i++)
			t=t+r_p[i];
	/*cout<<t<<" ";*/
	t=t+d-1;
	/*cout<<t<<" ";*/
	w=t%7;
	cout<<week[w]<<endl;
	return 0;
}
int main()
{
	int a,b,c,d,e,f,g,h,i,j,k,l;
	scanf("%d %d %d",&a,&b,&c);
	d=(a-1)/4;
	e=(a-1)/100;
	f=(a-1)/400;
	k=(a-1)/3200;
	l=(a-1)/88981;
	g=365*(a-1)+d-e+f-k+l;
	if(a%4==0)
	{
		if(a%100==0)
		{
			if(a%400==0)
			{
				switch(b)
				{
			case 1:
				h=c-1;
				break;
			case 2:
				h=c+30;
				break;
			case 3:
				h=c+59;
				break;
			case 4:
				h=c+90;
				break;
			case 5:
				h=c+120;
				break;
			case 6:
				h=c+151;
				break;
			case 7:
				h=c+181;
				break;
			case 8:
				h=c+212;
				break;
			case 9:
				h=c+243;
				break;
			case 10:
				h=c+273;
				break;
			case 11:
				h=c+304;
				break;
			case 12:
				h=c+334;
				break;
				}
			}
			else
			{
				switch(b)
				{
			case 1:
				h=c-1;
				break;
			case 2:
				h=c+30;
				break;
			case 3:
				h=c+58;
				break;
			case 4:
				h=c+89;
				break;
			case 5:
				h=c+119;
				break;
			case 6:
				h=c+150;
				break;
			case 7:
				h=c+180;
				break;
			case 8:
				h=c+211;
				break;
			case 9:
				h=c+242;
				break;
			case 10:
				h=c+272;
				break;
			case 11:
				h=c+303;
				break;
			case 12:
				h=c+333;
				break;
				}
			}
		}
		else
		{
            switch(b)
			{
			case 1:
				h=c-1;
				break;
			case 2:
				h=c+30;
				break;
			case 3:
				h=c+59;
				break;
			case 4:
				h=c+90;
				break;
			case 5:
				h=c+120;
				break;
			case 6:
				h=c+151;
				break;
			case 7:
				h=c+181;
				break;
			case 8:
				h=c+212;
				break;
			case 9:
				h=c+243;
				break;
			case 10:
				h=c+273;
				break;
			case 11:
				h=c+304;
				break;
			case 12:
				h=c+334;
				break;
			}
		}
	}
	else
	{
		switch(b)
		{
		    case 1:
				h=c-1;
				break;
			case 2:
				h=c+30;
				break;
			case 3:
				h=c+58;
				break;
			case 4:
				h=c+89;
				break;
			case 5:
				h=c+119;
				break;
			case 6:
				h=c+150;
				break;
			case 7:
				h=c+180;
				break;
			case 8:
				h=c+211;
				break;
			case 9:
				h=c+242;
				break;
			case 10:
				h=c+272;
				break;
			case 11:
				h=c+303;
				break;
			case 12:
				h=c+333;
				break;
		}
	}
	i=g+h;
	j=i%7;
	switch(j)
	{
	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");
	}
	return 0;
}
int rui(int y,int m){
    if(((y%4==0&&y%100!=0)||y%400==0)&&m==2)
     return 1;
     else return 0;
     }
int main(){
    int d=0,i=0,y,m,r;
    int pp[13]={0,3,0,3,2,3,2,3,3,2,3,2,3};
    char aa[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
    cin>>y>>m>>r; 
    y=y%400;
    if(y==0)
    y=400;
    while(i<y-1){
    i++;
    d=d+1+rui(i,2);
    }
    i=1;
    while(i<m){
    d=d+pp[i]+rui(y,i);
    i++;
     }
    d=d+r-1;
    d=d%7;
    cout<<aa[d];
    
    return 0;
}