semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main ()
{
	int n,i,j;
	int year,month1,month2;
	int relation=0,middle;
	int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	cin >> n;
	for (i=0;i<n;i++)
	{
		cin >> year >> month1 >> month2;
		if (month1>month2)
		{
			middle=month1;
			month1=month2;
			month2=middle;
		}
		if(year%4==0&&year%100!=0||year%400==0)
		{
			day[1]=29;
			for(j=month1;j<month2;j++)
			{
				relation=relation+day[j-1];
			}
			if (relation%7==0)
			{
				cout << "YES" << endl;
			}
			else 
			{
				cout << "NO" <<endl;
			}
			day[1]=28;
		}
		else
		{
				for(j=month1;j<month2;j++)
				{
			    	relation=relation+day[j-1];
				}
		    	if (relation%7==0)
				{
			    	cout << "YES" << endl;
				}
		    	else 
				{
			    	cout << "NO" <<endl;
				}
		}
		relation=0;
	}
	return 0;
}
int main()
{
    int n, i, a, b, c;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a >> b >> c;
		if ((b == 7 && c == 4) || (b == 4 && c == 7) || (b == 9 && c == 12) || (b == 12 && c == 9) || (b == 11 && c == 3) || (b == 3 && c == 11))
		   	cout << "YES" << endl;
		else
		{
		    if ((a % 4 == 0 && a % 100 != 0) || (a % 400 ==0))
			{
			    if ((b == 1 && c == 4) || (c == 1 && b == 4) || (b == 1 && c == 7) || (b == 7 && c == 1) || (b == 2 && c == 8) || (b == 8 && c == 2))
				    cout << "YES" << endl;
				else
					cout << "NO" << endl;
			}
			else
			{
				if ((b == 1 && c == 10) || (c == 1 && b == 10) || (b == 2 && c == 3) || (c == 2 && b == 3) || (b == 2 && c == 11) || (c == 2 && b == 11))
                    cout << "YES" << endl;
				else
					cout << "NO" << endl;
			}
		}
	}
    return 0;
}
int main()
{
	int year[200],a[200],b[200],n,i,j,k,t,sum;
	int m[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}};
	cin>>n;
	for (i=1;i<=n;i++)
	{
		sum=0;
		cin>>year[i]>>a[i]>>b[i];
		if ((year[i]%4==0 && year[i]%100!=0) || year[i]%400==0) k=1;
		else k=0;
		if (a[i]>b[i])
		{
			t=a[i];
			a[i]=b[i];
			b[i]=t;
		}
		for (j=a[i]-1;j<b[i]-1;j++)
			sum=sum+m[k][j];
		if (sum%7==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
			

	return 0;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int year,mon1,mon2,sum=0;
		int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
		cin>>year>>mon1>>mon2;
		if((year%4==0&&year%100!=0)||year%400==0)
			a[2]=29;
		if(mon1>mon2)
		{
			int t;
			t=mon1;
			mon1=mon2;
			mon2=t;
		}
		for(int i=mon1;i<mon2;i++)
			sum=sum+a[i];
		if(sum%7==0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}
int lon(int y,int m1,int m2)
{ int i;
	int e;
	if(m1>m2)
	{
		e=m1;
        m1=m2;
		m2=e;
	}
    int res=0;
	for(i=m1;i<m2;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{res+=31;}
		else if(i == 4 || i ==6 || i == 9 || i==11)
		{res+=30;}
		else if(i==2&&(y%100!=0&&y%4==0||y%400==0))
		{res+=29;}
		else if(i==2&&(y%4!=0||(y%100==0&&y%400!=0)))
		{
			res+=28;
		}
	}
	return res;
}
int main()
{
	int n,y,m1,m2,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d" "%d" "%d",&y,&m1,&m2);
		if(lon(y,m1,m2)%7==0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
}
int main()
{
	int n,y[200],m1[200],m2[200],d1[200]={0},d2[200]={0};
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&y[i],&m1[i],&m2[i]);
	}
	for(i=0;i<n;i++)
	{
		if(y[i]%4==0&&y[i]%100!=0||y[i]%400==0)
		{
			for(j=1;j<m1[i];j++)
			{
				if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
					d1[i]+=31;
				else if(j==2)
					d1[i]+=29;
				else
					d1[i]+=30;
			}
			for(j=1;j<m2[i];j++)
			{
				if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
					d2[i]+=31;
				else if(j==2)
					d2[i]+=29;
				else
					d2[i]+=30;
			}
		}
		else
		{
						for(j=1;j<m1[i];j++)
			{
				if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
					d1[i]+=31;
				else if(j==2)
					d1[i]+=28;
				else
					d1[i]+=30;
			}
			for(j=1;j<m2[i];j++)
			{
				if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
					d2[i]+=31;
				else if(j==2)
					d2[i]+=28;
				else
					d2[i]+=30;
			}
		}

	}
	for(i=0;i<n;i++)
	{
		if((d1[i]-d2[i])%7==0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}
int main()
{
	int n,i,e1,e2,c,dat1,dat2,da1,da2;
	i=0;
	int year[200],month1[200],month2[200];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++){
		scanf("%d%d%d",&(year[i]),&(month1[i]),&(month2[i]));
	}
	for(i=0;i<=n-1;i++){
		if((year[i]%4==0&&year[i]%100!=0)||(year[i]%100==0&&year[i]%400==0)){
			e1=month1[i];
			e2=month2[i];
				if(e1==1){
		da1=0;
	}else if(e1==2){
		da1=31;
	}else if(e1==3){
		da1=60;
	}else if(e1==4){
		da1=91;
	}else if(e1==5){
		da1=121;
	}else if(e1==6){
		da1=152;
	}else if(e1==7){
		da1=182;
	}else if(e1==8){
		da1=213;
	}else if(e1==9){
		da1=244;
	}else if(e1==10){
		da1=274;
	}else if(e1==11){
		da1=305;
	}else{
		da1=335;
	}
		if(e2==1){
		da2=0;
	}else if(e2==2){
		da2=31;
	}else if(e2==3){
		da2=60;
	}else if(e2==4){
		da2=91;
	}else if(e2==5){
		da2=121;
	}else if(e2==6){
		da2=152;
	}else if(e2==7){
		da2=182;
	}else if(e2==8){
		da2=213;
	}else if(e2==9){
		da2=244;
	}else if(e2==10){
		da2=274;
	}else if(e2==11){
		da2=305;
	}else{
		da2=335;
	}
			c=da1-da2;
			if(c%7==0){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			e1=month1[i];
			e2=month2[i];
	if(e1==1){
		dat1=0;
	}else if(e1==2){
		dat1=31;
	}else if(e1==3){
		dat1=59;
	}else if(e1==4){
		dat1=90;
	}else if(e1==5){
		dat1=120;
	}else if(e1==6){
		dat1=151;
	}else if(e1==7){
		dat1=181;
	}else if(e1==8){
		dat1=212;
	}else if(e1==9){
		dat1=243;
	}else if(e1==10){
		dat1=273;
	}else if(e1==11){
		dat1=304;
	}else{
		dat1=334;
	}
		if(e2==1){
		dat2=0;
	}else if(e2==2){
		dat2=31;
	}else if(e2==3){
		dat2=59;
	}else if(e2==4){
		dat2=90;
	}else if(e2==5){
		dat2=120;
	}else if(e2==6){
		dat2=151;
	}else if(e2==7){
		dat2=181;
	}else if(e2==8){
		dat2=212;
	}else if(e2==9){
		dat2=243;
	}else if(e2==10){
		dat2=273;
	}else if(e2==11){
		dat2=304;
	}else{
		dat2=334;
	}
			c=dat1-dat2;
			if(c%7==0){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}
//********************************
//*????4.cpp                ** 
//*??????                 **
//*?????? 1200012834      **
//*???2012.10.22             **
//********************************

int main()
{
    int n, year, m1, m2, d1 = 0, d2 = 0, i;  
                                     // d1?d2????m1??m2???????
    int a[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
                                     // ??a????12????? 
    int b[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
                                     // ??b????12????? 
    cin >> n;
    for (int j = 1; j <= n; j++)
    {
        cin >> year >> m1 >> m2;
        if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0)  // ????? 
        {
            for (i = 0; i < m1 - 1; i++)
            {
                d1 += a[i];  // ???a?m1?????????d1? 
            }
            for (i = 0; i < m2 - 1; i++)
            {
                d2 += a[i];  // ???a?m2?????????d2? 
            }
        }
        else    // ????? 
        { 
            for ( i = 0; i < m1 - 1; i++)
            {
                d1 += b[i];  // ???b?m1?????????d1? 
            }
            for(i = 0; i < m2-1; i++)
            {
                d2 += b[i];  // ???b?m2?????????d2? 
            }
        }
        if ((d1 - d2) % 7 == 0)   // ????????? 
        {
            cout << "YES" << endl;  // ??YES 
        }
        else
        {
            cout << "NO" << endl;   // ????NO 
        }
	    d1 = 0;
	    d2 = 0;  // ??????????????0 
    }
    return 0;
}
main()
{
    int n;
    cin>>n;
    int y,m1,m2,a,b;
    int i,sum,j;
    int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    for(i=1;i<=n;i++){
        cin>>y>>m1>>m2;
        sum=0;
        if(m1-m2>=0){
           a=m1;
           b=m2;
        }else{
           a=m2;
           b=m1;
        }
        for(j=b;j<a;j++){
            sum+=d[j];
            if((j==2)&&((y%4==0)&&(y%100!=0)||(y%400==0))){
               sum++;
            }   
        }
              
        if(sum%7==0)
           cout<<"YES"<<endl;
        else
           cout<<"NO"<<endl;
    }
    return(0);
}
int main(int argc, char* argv[])

{ 
   int n,i,j,sum=0;
   int year,m1,m2;
   int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
   scanf("%d",&n);
   for(i=0;i<n;i++){
   scanf("%d %d %d",&year,&m1,&m2);
   if(((year%4==0)&&(year%100!=0))||year%400==0)a[1]=29;
   if(m1>m2){int m;
             m=m1;
             m1=m2;
             m2=m;
    }
    for(j=m1;j<m2;j++){
       sum=sum+a[j-1];
    }
    if(sum%7==0)printf("YES\n");
    else printf("NO\n");
    sum=0;
    a[1]=28;
  }
   return 0;
}
int main()
{
	int n;
	scanf("%d",&n);

	int i,year,m1,m2;
	int max=0,min=0;
	for(i=0;i<n;i++){
	    scanf("%d%d%d",&year,&m1,&m2);   //???????
	    if(m1>m2){
		max=m1;
		min=m2;
		}else{
		    max=m2;
		    min=m1;
		}

		if(year%4!=0||(year%100==0&&year%400!=0)){  //???????????????????????7????
		    if((min==1&&max==10)||(min==2&&max==3)||(min==2&&max==11)||(min==3&&max==11)||(min==4&&max==7)||(min==9&&max==12)){
			printf("YES\n");
		    }else{
			printf("NO\n");
		    }           
		}else{       //????????????????????7????
                      if((min==3&&max==11)||(min==4&&max==7)||(min==9&&max==12)||(min==1&&max==4)||(min==1&&max==7)||(min==2&&max==8)){
			printf("YES\n");
		    }else{
			printf("NO\n");
		}
	    }



	}




	return 0;
}
int main()
{
	int y,m1,m2,n,i,j,k,t;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d%d%d",&y,&m1,&m2);
		if(m1>m2)
		{
			t=m1;
			m1=m2;
			m2=t;
		}
		if(y%4==0&&y%100!=0||y%400==0)
		{
			k=0;
			for(j=m1;j<m2;j++)
			{
				switch(j)
				{
				case 1: k=k+31;break;
				case 2: k=k+29;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;	
				}
			}
		}
		else
		{
			k=0;
			for(j=m1;j<m2;j++)
			{
				switch(j)
				{
				case 1: k=k+31;break;
				case 2: k=k+28;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;	
				}
			}
		}
		if(k%7==0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}
int main()
{
	int year[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}};
	int n,i,month1,month2,nyear,sum=0,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		sum=0;
		scanf("%d %d %d",&nyear,&month1,&month2);
		if(month1<month2)
		{
		if(nyear%4!=0||(nyear%100==0&&nyear%400!=0))
		{
			for(j=month1-1;j<month2-1;j++)
				sum=sum+year[0][j];

		}
		else
			for(j=month1-1;j<month2-1;j++)
				sum=sum+year[1][j];
		if(sum%7==0)
			printf("YES\n");
		else
			printf("NO\n");

	}
	else
	{
	    if(nyear%4!=0||(nyear%100==0&&nyear%400!=0))
		{
			for(j=month2-1;j<month1-1;j++)
				sum=sum+year[0][j];

		}
		else
			for(j=month2-1;j<month1-1;j++)
				sum=sum+year[1][j];
		if(sum%7==0)
			printf("YES\n");
		else
			printf("NO\n");
    }
	}


}
int djt(int year,int month)
{
	int i,sum=1;
	for(i=1;i<month;i++){
		switch(i)
		{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
				sum+=31;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				sum+=30;
				break;
			case 2:
				if(year%4==0&&year%100!=0||year%400==0){
					sum+=29;
				}
				else{
					sum+=28;
				}
		}
	}
	return sum;
}
int main()
{
	int n,i,year[200],month1[200],month2[200];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&(year[i]),&(month1[i]),&(month2[i]));
	}
	for(i=0;i<n;i++){
		if((djt(year[i],month1[i])-djt(year[i],month2[i]))%7==0){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	
	}
	return 0;
}
int main()
{
	int n,i,y,a,b,z[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},t,p[201],j;
	scanf("%d",&n);

	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d",&y,&a,&b);
		
		p[i]=0;
		if ((y%4==0) && ( ((y%100)!=0) || ((y%400)==0) ) )
		{
			t=0;
			if (a>b) for(j=b;j<=(a-1);j++) t=t+r[j];
			if (a<b) for(j=a;j<=(b-1);j++) t=t+r[j];
			if ( (t%7)==0) p[i]=1;
			else p[i]=0;
		}
		
		else 
		{
			t=0;
			if (a>b) for(j=b;j<=(a-1);j++) t=t+z[j];
			if (a<b) for(j=a;j<=(b-1);j++) t=t+z[j];
			if ( (t%7)==0 ) p[i]=1;
			else p[i]=0;
		}
	}
	
	for (i=1;i<=n;i++)
		if(p[i]) printf("YES\n");
		else printf("NO\n");

}
int leap(int n)
{
	if((n%4==0&&n%100!=0)||n%400==0)
		return 1;
	else
		return 0;
}
int main()
{
	int year,mon1,mon2;
	int mon[]={0,3,0,3,2,3,2,3,3,2,3,2,3};
	int i,j,n,temp,day;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&year,&mon1,&mon2);
		if(mon1>mon2)
		{
			temp=mon1;
			mon1=mon2;
			mon2=temp;
		}
		if(leap(year))
			mon[2]++;
		day=0;
		for(j=mon1;j<mon2;j++)
		{
			day+=mon[j];
		}
		if(day%7==0)
			printf("YES\n");
		else
			printf("NO\n");
		if(leap(year))
			mon[2]--;
	}
}
int main()
{
    int i,j,n,sum,year,month1,month2,nor[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}, run[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    sum=0;
                    scanf("%d%d%d",&year,&month1,&month2);
                    if((((year%4==0)&&(year%100!=0))||((year%4==0)&&(year%400==0)))&&(month1<month2))
                    {
                                                                          for(j=month1;j<month2;j++)
                                                                                                    sum+=run[j];
                    }
                    else if((((year%4==0)&&(year%100!=0))||((year%4==0)&&(year%400==0)))&&(month1>month2))
                    {
                         for(j=month2;j<month1;j++)
                                                                                                    sum+=run[j];
                    }
                    else if(((year%4==0)&&(year%400!=0))&&(month1<month2))
                    {
                         for(j=month1;j<month2;j++)
                                                                                                    sum+=nor[j];
                    }
                    else if(((year%4==0)&&(year%400!=0))&&(month1>month2))
                    {
                        for(j=month2;j<month1;j++)
                                                                                                    sum+=nor[j];
                    }
                    else if((year%4!=0)&&(month1<month2))
                    {
                         for(j=month1;j<month2;j++)
                                                                                                    sum+=nor[j];
                    }
                    else if((year%4!=0)&&(month1>month2))
                    {
                        for(j=month2;j<month1;j++)
                                                                                                    sum+=nor[j];
                    }
                    if(sum%7==0)
                    printf("YES\n");
                    else
                    printf("NO\n");
    }                                
    return 0;
}
int main()
{
	int n,i,temp,a[200],b[200],c[200],d[13]={31,28,31,30,31,30,31,31,30,31,30,31};
	int cha=0,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
                  	scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	for(i=0;i<n;i++)
	{
                  if(b[i]>c[i])
                  {temp=b[i];
                   b[i]=c[i];
                   c[i]=temp;}
                   if(a[i]%400==0||(a[i]%4==0&&a[i]%100!=0))
		{
			d[1]=d[1]+1;
			for(j=b[i];j<c[i];j++)
			{cha=cha+d[j-1];}
                            d[1]=d[1]-1;
			if(cha%7!=0)
				printf("NO\n");
			else
				printf("YES\n");
		}
		else{
			for(j=b[i];j<c[i];j++)
			{cha=cha+d[j-1];}
			if(cha%7!=0)
				printf("NO\n");
			else
				printf("YES\n");
		}
		cha=0;
	}
	return 0;
}
main()
{
int n;
scanf("%d",&n);
int i;
for(i=0;i<n;i++)
{
int y,m1,m2,t,j;
scanf("%d %d %d",&y,&m1,&m2);
t=0;
if(((y%4==0)&&(y%100!=0))||(y%400==0))
{
int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
if(m1<m2)
{
for(j=m1-1;j<m2-1;j++)
t=t+a[j];
if(t%7==0)
printf("YES\n");
else
printf("NO\n");
}
else
{
for(j=m2-1;j<m1-1;j++)
t=t+a[j];
if(t%7==0)
printf("YES\n");
else
printf("NO\n");
}
}
else
{
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(m1<m2)
{
for(j=m1-1;j<m2-1;j++)
t=t+a[j];
if(t%7==0)
printf("YES\n");
else
printf("NO\n");
}
else
{
for(j=m2-1;j<m1-1;j++)
t=t+a[j];
if(t%7==0)
printf("YES\n");
else
printf("NO\n");
}
}
}
}
int main()
{
	int n,i,a[300];
	int cra,crb,rnd,sdx,year,jy1,nl1,yue1,month2,l,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	
	scanf("%d %d %d",&year,&yue1,&month2);
	rnd=((year-1)/4-(year-1)/100+(year-1)/400)*(366%7);
    sdx=(year-1-((year-1)/4-(year-1)/100+(year-1)/400))*(365%7);
	if((year%400)==0||((year%4)==0&&(year%100)!=0))
	{
		if(yue1==1){jy1=0;}
		if(yue1==2){jy1=31;}
		if(yue1==3){jy1=31+29;}
		if(yue1==4){jy1=31+29+31;}
		if(yue1==5){jy1=31+29+31+30;}
		if(yue1==6){jy1=31+29+31+30+31;}
		if(yue1==7){jy1=31+29+31+30+31+30;}
		if(yue1==8){jy1=31+29+31+30+31+30+31;}
		if(yue1==9){jy1=31+29+31+30+31+30+31+31;}
		if(yue1==10){jy1=31+29+31+30+31+30+31+31+30;}
		if(yue1==11){jy1=31+29+31+30+31+30+31+31+30+31;}
		if(yue1==12){jy1=31+29+31+30+31+30+31+31+30+31+30;}
	
	}
	
	else
	{
		if(yue1==1){jy1=0;}
		if(yue1==2){jy1=31;}
		if(yue1==3){jy1=31+28;}
		if(yue1==4){jy1=31+28+31;}
		if(yue1==5){jy1=31+28+31+30;}
		if(yue1==6){jy1=31+28+31+30+31;}
		if(yue1==7){jy1=31+28+31+30+31+30;}
		if(yue1==8){jy1=31+28+31+30+31+30+31;}
		if(yue1==9){jy1=31+28+31+30+31+30+31+31;}
		if(yue1==10){jy1=31+28+31+30+31+30+31+31+30;}
		if(yue1==11){jy1=31+28+31+30+31+30+31+31+30+31;}
		if(yue1==12){jy1=31+28+31+30+31+30+31+31+30+31+30;}
	}
	if((year%400)==0||((year%4)==0&&(year%100)!=0))
	{
		if(month2==1){nl1=0;}
		if(month2==2){nl1=31;}
		if(month2==3){nl1=31+29;}
		if(month2==4){nl1=31+29+31;}
		if(month2==5){nl1=31+29+31+30;}
		if(month2==6){nl1=31+29+31+30+31;}
		if(month2==7){nl1=31+29+31+30+31+30;}
		if(month2==8){nl1=31+29+31+30+31+30+31;}
		if(month2==9){nl1=31+29+31+30+31+30+31+31;}
		if(month2==10){nl1=31+29+31+30+31+30+31+31+30;}
		if(month2==11){nl1=31+29+31+30+31+30+31+31+30+31;}
		if(month2==12){nl1=31+29+31+30+31+30+31+31+30+31+30;}
	
	}
	
	else
	{
		if(month2==1){nl1=0;}
		if(month2==2){nl1=31;}
		if(month2==3){nl1=31+28;}
		if(month2==4){nl1=31+28+31;}
		if(month2==5){nl1=31+28+31+30;}
		if(month2==6){nl1=31+28+31+30+31;}
		if(month2==7){nl1=31+28+31+30+31+30;}
		if(month2==8){nl1=31+28+31+30+31+30+31;}
		if(month2==9){nl1=31+28+31+30+31+30+31+31;}
		if(month2==10){nl1=31+28+31+30+31+30+31+31+30;}
		if(month2==11){nl1=31+28+31+30+31+30+31+31+30+31;}
		if(month2==12){nl1=31+28+31+30+31+30+31+31+30+31+30;}
	}
	cra=jy1+rnd+sdx+1;
    crb=nl1+rnd+sdx+1;
	l=cra%7;
	k=crb%7;
	if(l==k)
		{
			a[i]=1;
		}
		else
		{
			a[i]=0;
		}
	}
	for(i=0;i<n;i++)
	{
		if(a[i]==1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}
void main()
{
	int n,x[MAX],a[MAX],b[MAX],c,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&x[i],&a[i],&b[i]);
	}
	for(i=0;i<n;i++)
	{
        if(x[i]%4==0 && x[i]%100!=0 || x[i]%400==0)
		{
			if(a[i]>b[i])
			{
				c=a[i];
				a[i]=b[i];
				b[i]=c;
			}
			if((a[i]==1&&b[i]==4)||(a[i]==2&&b[i]==8)||(a[i]==1&&b[i]==7)||(a[i]==3&&b[i]==11)||(a[i]==4&&b[i]==7)||(a[i]==9&&b[i]==12))
				printf("YES\n");
			else printf("NO\n");
		}
		else
		{
            if(a[i]>b[i])
			{
				c=a[i];
				a[i]=b[i];
				b[i]=c;
			}
			if((a[i]==1&&b[i]==10)||(a[i]==2&&b[i]==3)||(a[i]==2&&b[i]==11)||(a[i]==3&&b[i]==11)||(a[i]==4&&b[i]==7)||(a[i]==9&&b[i]==12))
				printf("YES\n");
			else printf("NO\n");
		}
	}
}
int main()
{
    int min,max,t,n,i,Y,a[12],y,j,s=0;
	a[1]=a[3]=a[5]=a[7]=a[8]=a[10]=a[12]=31,a[4]=a[6]=a[9]=a[11]=30;
	scanf("%d",&t);
	for(i=0;i<t;i++){
		scanf("%d %d %d",&n,&y,&Y);
		if((n%100!=0 && n%4==0) ||(n%100==0 && n%400==0))
			a[2]=29;
			else a[2]=28; 
		if(y<Y)
			min=y,max=Y;
		else min=Y,max=y;
		for(j=min;j<max;j++){
			s=s+a[j];
		}
		if(s%7==0){
			printf("YES\n");
			s=0;
		}
		else {
			printf("NO\n");
			s=0;
		}
	}
	return 0;
}
int main()
{
	const int a1[12]={1,4,4,7,2,5,7,3,6,1,4,6},a2[12]={1,4,5,1,3,6,1,4,7,2,5,7};
	int n,i,year,mon1,mon2;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>year>>mon1>>mon2;
		if(year%4!=0||year%100==0&&year%400!=0)
			if(a1[mon1-1]==a1[mon2-1])cout<<"YES";
			else cout<<"NO";
		else if(a2[mon1-1]==a2[mon2-1])cout<<"YES";
		     else cout<<"NO";
		if(i<n-1)cout<<endl;
	}
	return 0;
}
int main()
{
	int n,year,yue1,yue2,i,j,t,sum;
	scanf("%d", &n);
	int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d", &year, &yue1, &yue2);
		if(yue1>yue2)
		{
			t=yue1;
			yue1=yue2;
			yue2=t;
		}
		sum=0;
		for(j=yue1;j<yue2;j++)
		{
			sum=sum+b[j-1];
		}
		if(yue1<=2&&yue2>2)
		{
		      if((year%4==0&&year%100!=0)||(year%400==0))
			  {
			       sum=sum+1;
			  }
		}
		if(sum%7==0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}
int main()
{
	int a[12]={31,0,31,30,31,30,31,31,30,31,30,31},y,m1,m2,i,j,n,sum1=0,sum2=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>y>>m1>>m2;
		if(y%4==0&&y%100!=0||y%400==0)a[1]=29;
		else a[1]=28;
		if(m1>m2)
		{
			for(j=m2-1;j<=m1-2;j++)
			{
				sum1=sum1+a[j];
			}
			if(sum1%7==0)cout<<"YES"<<'\n';
			else if(sum1%7!=0)cout<<"NO"<<'\n';
		    sum1=0;
		}
		if(m1<m2)
		{
			for(j=m1-1;j<=m2-2;j++)
			{
				sum2=sum2+a[j];
			}
			if(sum2%7==0)cout<<"YES"<<'\n';
			else if(sum2%7!=0)cout<<"NO"<<'\n';
			sum2=0;
		}
	}

	return 0;
}