void huanhang(int array[][5],int x,int y)
{
  int j,a[1][5];
  for(j=0;j<5;j++)
  {
   a[0][j]=array[y][j];
   array[y][j]=array[x][j];
   array[x][j]=a[0][j];
  }
}
int panbie(int p,int q)
{
 if(p>=0 && p<5 && q>=0 && q<5)
  return(1);
 else
  return(0);
}
 void main()
{
  int i,j,n,m;
  int b[5][5];
  for(i=0;i<5;i++)
  for(j=0;j<5;j++)
   scanf("%d",&b[i][j]);
   scanf("%d %d",&n,&m);
  if(panbie(n,m))
  {
	huanhang(b,n,m);
   for(i=0;i<5;i++)
   {
	 printf("%d",b[i][0]);
	 for(j=1;j<5;j++)
     printf(" %d",b[i][j]);
     printf("\n");
   }
  }
  else
   printf("error");
  printf("\n");
 }


int main()
{
    int shuzu[5][5];
    int row;
    for(row=0;row<5;row++)
    {
        for(int col=0;col<5;col++)
        {
            scanf("%d",&shuzu[row][col]);
        }
    }
    int n,m;
    scanf("%d %d",&n,&m);
    if(m>4||n>4)
    {
        printf("error");
        return 0;
    }
    else if(m<5&&n<5)
    {
        int a[5];
        for(int col=0;col<5;col++)
        {
            a[col]=shuzu[n][col];
            shuzu[n][col]=shuzu[m][col];
            shuzu[m][col]=a[col];
        }
    }
    for(row=0;row<5;row++)
    {
        for(int col=0;col<4;col++)
        {
            printf("%d ",shuzu[row][col]);
        }
        printf("%d",shuzu[row][4]);
        printf("\n");
    }
    return 0;
}


int array[5][5];
int pp;

int pd(int n,int m)
{
	if ((n>=0)&&(n<=4)&&(m>=0)&&(m<=4))
		return 1;
	else
		return 0;
}

void change(int n,int m)
{
	int t,i;
	if (pd(n,m)!=0)
		for (i=0;i<5;i++)
		{
			t = array[n][i];
			array[n][i] = array[m][i];
			array[m][i] = t;
		}
	else
	{
		pp = 0;
		printf("error");
	}
}

void print(int row)
{
	int j;
	for (j=0;j<4;j++)
		printf("%d ",array[row][j]);
	printf("%d\n",array[row][4]);
}

int main()
{
	int i,j,n,m,t;

	for (i=0;i<5;i++)
		for (j=0;j<5;j++)
			scanf("%d",&array[i][j]);
	scanf("%d%d",&n,&m);
	pp = 1;
	change(n,m);

	if (pp!=0)
	for (i=0;i<5;i++)
	{
		print(i);
	}

	return 0;
}


// ¾ØÕó½»»»ÐÐµÚ¶þµ¯.cpp : Defines the entry point for the console application.
//

int main(int argc, char* argv[])
{
	int sz[5][5],m,n,i,j,e;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	scanf("%d%d",&m,&n);
	if(m>=0&&m<=4&&n>=0&&n<=4){
		for(i=0;i<5;i++){
			e=sz[m][i];
			sz[m][i]=sz[n][i];
			sz[n][i]=e;
		}
		for(i=0;i<5;i++){
			for(j=0;j<5;j++){
				if(j==0)printf("%d",sz[i][j]);
				else if(j==4)printf(" %d\n",sz[i][j]);
				else printf(" %d",sz[i][j]);
			}
		}
	}else printf("error");
	return 0;
}


int hanshu(int m,int n){
	if(m>=0&&m<5&&n>=0&&n<5){
		return 1;
	}
	else{
		return 0;
	}
}
int main(){
	int m,n;
	int sz[5][5];
	int sz2[5];
	int hang,lie;
	for(hang=0;hang<5;hang++){
		for(lie=0;lie<5;lie++){
			scanf("%d",&sz[hang][lie]);
		}
	}
	scanf("%d %d",&m,&n);
	int result=hanshu(m,n);
	if(result==0){
		printf("error");
	}
	else{
		for(lie=0;lie<5;lie++){
			sz2[lie]=sz[m][lie];
			sz[m][lie]=sz[n][lie];
			sz[n][lie]=sz2[lie];
		}
		for(hang=0;hang<5;hang++){
			printf("%d %d %d %d %d\n",sz[hang][0],sz[hang][1],sz[hang][2],sz[hang][3],sz[hang][4]);
		}
	}
	return 0;
}


int trans(int a[][5],int n,int m)
{
if (0<=n&&n<5&&0<=m&&m<5)
{
 int i,tmp;
 for(i=0;i<5;i++)
 {
   tmp=a[n][i];
   a[n][i]=a[m][i];
   a[m][i]=tmp;
}
return 1;
}
else
return 0;
}
int main()
{
  int i,j,value[5][5];
int n,m;
 for (i=0;i<5;i++)
 for(j=0;j<5;j++)
{
scanf("%d",&value[i][j]);
}
scanf("%d %d",&n,&m);
if (trans(value,n,m)==0)
printf("error\n");
else
{
 for (i=0;i<5;i++)
printf("%d %d %d %d %d\n",value[i][0],value[i][1],value[i][2],value[i][3],value[i][4]);
}
return 0;
}


int f(int array[][5],int n,int m)
{
	if(m>4||n>4)
		return (0);
	else
		return (1);
}
void main()
{
	int array[5][5],i,j,n,m,mid;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&array[i][j]);
		scanf("%d%d",&n,&m);
		if(f(array,n,m))
		{
			for(j=0;j<5;j++)
			{
				mid=array[n][j];
				array[n][j]=array[m][j];
				array[m][j]=mid;
			}
			for(i=0;i<5;i++)
			{
				for(j=0;j<4;j++)
					printf("%d ",array[i][j]);
				printf("%d",array[i][4]);
				printf("\n");
			}
		}
		else
			printf("error");
}


int main(){
    int i,n,m;
    char shuzu[6][10];
    char e[10];
    for(i=0;i<5;i++){
        gets(shuzu[i]);
                  }
    scanf("%d %d",&n,&m);
    if(m<5&&m>=0&&n<5&&n>=0){
       strcpy(e,shuzu[n]);
       strcpy(shuzu[n],shuzu[m]);
       strcpy(shuzu[m],e);
       for(i=0;i<5;i++){
         puts(shuzu[i]);
                      }
                            }
    else
       printf("error");

    return 0;
}


void main()
{
	int a[5][5],i,j,m,n;
	int exchange(int x,int y,int a[5][5]);

	for(i=0;i<5;i=i+1)
	{
		for(j=0;j<5;j=j+1)
		{
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d%d",&m,&n);
	exchange(m,n,a);
	if(exchange(m,n,a)==0) printf("error\n");
	else if(exchange(m,n,a)==1)
	{
		for(i=0;i<5;i=i+1)
		{
			for(j=0;j<5;j=j+1)
			{
				if(j!=4) printf("%d ",a[i][j]);
				else printf("%d",a[i][j]);
			}
			printf("\n");
		}
	}
}

int exchange(int x,int y,int a[5][5])
{
	int z,k,temp;
	if(x<5&&y<5)
	{
		z=1;
		for(k=0;k<5;k=k+1)
		{
			temp=a[x][k];
			a[x][k]=a[y][k];
			a[y][k]=temp;
		}
	}
	else z=0;
	return(z);
}


int in_or_not(int n,int m);
int main()
{
	int data[5][5],temp[5];
	int n,m,i,j,result;
	for(j=0;j<5;j++){
		for(i=0;i<5;i++){
			scanf("%d",&data[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	result=in_or_not(n,m);
	if(result==0){
		printf("error");
	}
	if(result==1){
		for(i=0;i<5;i++){
			temp[i]=data[i][n];
			data[i][n]=data[i][m];
			data[i][m]=temp[i];
		}
		for(j=0;j<5;j++){
			printf("%d %d %d %d %d\n",data[0][j],data[1][j],data[2][j],data[3][j],data[4][j]);
		}
	}
	return 0;
}
int in_or_not(int n,int m){
	if(n>=0&&n<=4&&m>=0&&m<=4){
		return 1;
	}else
		return 0;
}


int exchange(int num[5][5],int p,int q);
int main()
{
	int i,p,q,num[5][5],j,pan;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			cin>>num[i][j];
	cin>>p>>q;
	pan=exchange(num,p,q);
	if(pan==0)
		cout<<"error"<<endl;
	else
	{
		for(i=0;i<5;i++)
		{
			cout<<num[i][0];
			for(j=1;j<5;j++)
				cout<<" "<<num[i][j];
			cout<<endl;
		}
	}
	return 0;
}
int exchange(int num[5][5],int p,int q)
{
	int i,temp;
	if(p>=0&&p<=4&&q>=0&&q<=4)
	{
		for(i=0;i<5;i++)
		{
			temp=num[p][i];
			num[p][i]=num[q][i];
			num[q][i]=temp;
		}
		return 1;
	}
	else
		return 0;
}


int jiaohuan(int a[][5],int m,int n)
{
	int temp,i;
	if(m>4)
		return(0);
	else if(n>4)
		return(0);
	else
	{
		for(i=0;i<5;i++)
		{
			temp=a[m][i];
			a[m][i]=a[n][i];
			a[n][i]=temp;
		}
		return(1);
	}
}

int main()
{
	int a[5][5],n,m,i,j;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
			scanf("%d",&a[i][j]);
	}
	scanf("%d %d",&n,&m);
	i=jiaohuan(a,m,n);
	if(i==0)
		printf("error");
	else
	{
		for(i=0;i<5;i++)
		{
			for(j=0;j<4;j++)
				printf("%d ",a[i][j]);
			printf("%d\n",a[i][4]);
		}
	}
}


int change(int a[5][5],int m,int n)
{int count,i;
	if(m<0||m>=5||n<0||n>=5)
		{
			printf("error");return 0;
		}
	for(count=0;count<5;count++)
		{
			if(count==n)
			{
				for(i=0;i<4;i++)
					printf("%d ",a[m][i]);
				printf("%d\n",a[m][4]);

			}
			else if(count==m)
			{
				for(i=0;i<4;i++)
					printf("%d ",a[n][i]);
				printf("%d\n",a[n][4]);

			}
			else
			{
				for(i=0;i<4;i++)
					printf("%d ",a[count][i]);
				printf("%d\n",a[count][4]);

			}
		}return 1;
}
int main()
{
	int a[5][5],m,n,i,j,count=0;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&a[i][j]);
		scanf("%d%d",&m,&n);
	change(a,m,n);

	/*for(count=0;count<5;count++)
		{
			if(count==n)
			{
				for(i=0;i<4;i++)
					printf("%d ",a[m][i]);
				printf("%d\n",a[m][4]);

			}
			else if(count==m)
			{
				for(i=0;i<4;i++)
					printf("%d ",a[n][i]);
				printf("%d\n",a[n][4]);

			}
			else
			{
				for(i=0;i<4;i++)
					printf("%d ",a[count][i]);
				printf("%d\n",a[count][4]);

			}
		}return 0;*/
}


int main()
{
	int a[5][5];
	int n,m;
	int i,j;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
	int fuc(int a[5][5],int n,int m);
	if(fuc(a,n,m))
	{
		for(i=0;i<5;i++)
		{
			int tmp;
			tmp=a[n][i];
			a[n][i]=a[m][i];
			a[m][i]=tmp;
		}
		for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			if(j<4)
			printf("%d ",a[i][j]);
			else
			{
			printf("%d",a[i][4]);
			printf("\n");
			}
		}
	}
	}
	else
		printf("error");
	return 0;
}
int fuc(int a[5][5],int n,int m)
{
	if(n<=4&&m<=4)
		return 1;
	else
		return 0;
}


int exchange(int sz[5][5],int a, int b)
{
	if(0<=a&&a<=4&&0<=b&&b<=4){
		int i;
		for(i=0;i<5;i++){
			int e=sz[a][i];
			sz[a][i]=sz[b][i];
			sz[b][i]=e;
		}
		return 1;
	}else{
		return 0;
	}
}
int main()
{
	int matrix[5][5];
	int row,col;
	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
			scanf("%d",&matrix[row][col]);
		}
	}
	int n,m;
	scanf("%d %d",&n, &m);
	int judge;
	judge=exchange(matrix,n,m);
	if(judge==0)
		printf("error");
	if(judge==1){
		for(row=0;row<5;row++){
			for(col=0;col<4;col++){
				printf("%d ",matrix[row][col]);
			}
			printf("%d\n",matrix[row][4]);
		}
	}
	return 0;
}


int hanshu(int x,int y);
int main(){
	int x[5][5],n,m,i,e,c,j,a;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&x[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	c=hanshu(n,m);
	if(c==0){
		printf("error");
	}
	else{
		for(i=0;i<5;i++){
			e=x[n][i];
			x[n][i]=x[m][i];
			x[m][i]=e;
		}
		for(a=0;a<5;a++){
		for(j=0;j<5;j++){
			if(j<4){
			printf("%d ",x[a][j]);
			}
			else{
				printf("%d",x[a][j]);
			}
		}
		printf("\n");
	}
	}
	return 0;
}
int hanshu(int x,int y){
	int result;
	if(x>=0&&x<=4&&y<=4&&y>=0){
		result=1;
	}
	else{
		result=0;
	}
	return result;
}


int main()
{
int i,m,n,row,col,sz[5][5],e[5];
for(row=0;row<5;row++)
{
    for(col=0;col<5;col++)
	{scanf("%d",&sz[row][col]);}
}
scanf("%d %d",&n,&m);
if((n>=0&&n<=4)&&(m>=0&&m<=4))
{
	for(i=0;i<5;i++)
	{
		e[i]=sz[n][i];
	    sz[n][i]=sz[m][i];
		sz[m][i]=e[i];
	}
	for(row=0;row<5;row++)
	{
        for(col=0;col<5;col++)
		{
			if(col==0)
		    {
		      printf("%d",sz[row][col]);
			}
            else if(col==4)
		    {
		      printf(" %d\n",sz[row][col]);
            }
		    else if(col>0&&col<4)
				printf(" %d",sz[row][col]);
		}
	}
return 0;
}
else
{printf("error\n");
return 0;
}
}


int change(int x,int y);
int main()
{

	int i,j;
	int n,m;
	int a[row][col];
	int t;
	for (i=0;i<row;i++)
	{
		for(j=0;j<col;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
    t=change(n,m);
	if (t==0)
	{
		printf("error");
	}
	else
	{
		int b[5][5]={0};
		for (i=0;i<col;i++)
		{
			b[0][i]=a[n][i];
			a[n][i]=a[m][i];
			a[m][i]=b[0][i];
		}
		for (i=0;i<row;i++)
		{
			if (i==0)
				{
					for(j=0;j<col;j++)
					{
						if (j==0)
						{
							printf("%d",a[i][j]);
						}
						else
						{
							printf(" %d",a[i][j]);
						}
					}
				}
		     else
				{
					printf("\n");
					for(j=0;j<col;j++)
					{
						if (j==0)
						{
							printf("%d",a[i][j]);
						}
						else
						{
							printf(" %d",a[i][j]);
						}
					}

				}

		}
	}

	return 0;

}

int change(int x,int y)
{
	if (x<row&&y<col)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}


void main()
{
	int i,b[5][5],n,m,j;
	int *point;
	int change(int *p,int m,int n);
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&b[i][j]);
	scanf("%d %d",&m,&n);
	point=&b[0][0];
	if (change(point,m,n)==0) printf("error");
	else for(i=0;i<5;i++)
	{
		   for(j=0;j<5;j++)
		   {
			   if (j==0) printf("%d",b[i][j]);
			   else printf(" %d",b[i][j]);
		   }
		   printf("\n");
	}
}
int change(int *p,int x,int y)
{
	int z,g,temp;
	if(x>=0&&x<5&&y>=0&&y<5)
	{
		z=1;
		for(g=0;g<5;g++)
		{
			temp=*(p+g+5*x);
			*(p+g+x*5)=*(p+g+y*5);
			*(p+g+y*5)=temp;
		}
	}
	else z=0;return(z);
}


int judge (int x,int y);
int main(){
	int sz[5][5];
	int n,m;
	int result;
	int i,j;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	result=judge(n,m);
	int k[5];
	if(result==0){
		printf("error");
	}else if(result==1){
		for(i=0;i<5;i++){
			k[i]=sz[n][i];
			sz[n][i]=sz[m][i];
			sz[m][i]=k[i];
		}
		for(i=0;i<5;i++){
			for(j=0;j<5;j++){
				if(j!=4){
					printf("%d ",sz[i][j]);
				}else{
					printf("%d\n",sz[i][4]);
				}
			}
		}
	}
	return 0;
}
int judge(int x,int y){
	if(x>=0&&x<=4&&y>=0&&y<=4){
		return 1;
	}else{
		return 0;
	}

}


int main()
{
	int reverse(int m,int n);
	int m,n,i,j,count=0;
	int sz[6][5];
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
			scanf("%d ",&sz[i][j]);
	}
	scanf("%d %d",&m,&n);
	if(reverse(m,n)==0)
		printf("error\n");
	if(reverse(m,n)==1)
	{
		for(j=0;j<5;j++)
		{
			sz[5][j]=sz[m][j];
			sz[m][j]=sz[n][j];
			sz[n][j]=sz[5][j];
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<5;j++)
			{
				printf("%d",sz[i][j]);
				count++;
				if(count%5==0)
					printf("\n");
				else
					printf(" ");
			}
		}
	}
	return 0;
}

int reverse(int m,int n)
{
	if((m>=0 && m<5) && (n>=0 && n<5))
	{
		return 1;
	}else{
		return 0;
	}
}


int putout(int n,int m);
int main()
{
	int i,j,n,m,return1;
	int str[5][5]={0},turn[5];
	int *p;
	p=str[0];
	for(i=0;i<25;i++)
	{
		scanf("%d",p++);

	}
	scanf("%d%d",&n,&m);

	return1=putout(n,m);
	if(return1==0) printf("error\n");
	else
	{
		for(j=0;j<5;j++)
		{
			turn[j]=str[m][j];
			str[m][j]=str[n][j];
			str[n][j]=turn[j];
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<4;j++)
				printf("%d ",str[i][j]);
			printf("%d\n",str[i][4]);

		}
	}
return 0;
}
int putout(int n,int m)
{
	int z;
	if(n<=4&&n>=0&&m<=4&&m>=0) z=1;
	else z=0;
return (z);
}


void main ()
{
	int exchange(int b[5][5],int n,int m);
	int a[5][5];
	int n,m;
	int i,j;

	for(i=0;i<5;++i)
	{
		for (j=0;j<5;++j)
		{scanf("%d",&a[i][j]);}
	}

	scanf("%d %d",&n,&m);

	if (exchange(a,n,m)==1)
	{
		for(i=0;i<5;i++)
		{
			for (j=0;j<5;j++)
			{
				printf("%d",a[i][j]);

				if (j!=4) printf(" ");
				else printf("\n");
			}
		}
	}
	else printf("error\n");
}

int exchange(int b[5][5],int n,int m)
{
	int i;

	if(n>4||n<0||m>4||m<0) return 0;
	else
	{
		for(i=0;i<5;i++)
		{
			int c[5];
			c[i]=b[n][i];
			b[n][i]=b[m][i];
			b[m][i]=c[i];
		}
	}

	return 1;
}


int exchange(int a,int b){
	if(a>=0&&a<5&&b>=0&&b<5){
		return 1;
	}else{
		return 0;
	}
}
int main(){
	int n,m,i,j,k,t=0,panduan;
	int sz[5][5];
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	panduan=exchange(n,m);
	if(panduan){
		for(k=0;k<5;k++){
			t=sz[n][k];
			sz[n][k]=sz[m][k];
			sz[m][k]=t;
		}
		for(i=0;i<5;i++){
		    for(j=0;j<5;j++){
				if(j<4){
			    printf("%d ",sz[i][j]);
				}else if(j=4){
					printf("%d\n",sz[i][j]);
				}
		    }
	    }
	}else{
		printf("error");
	}
	return 0;
}


int find(int n,int m)
{
	if ((n>=0) && (n<=4) && (m>=0) && (m<=4)) return(1);
	else return(0);
}
void main()
{
	int flag,i,j,m,n,swap,num[5][5];
	for (i=0;i<=4;i++)
		for (j=0;j<=4;j++)
			scanf("%d",&num[i][j]);
	scanf("%d %d",&n,&m);
	if (find(n,m))
	{
		for (i=0;i<=4;i++)
		{
			swap=num[n][i];
			num[n][i]=num[m][i];
			num[m][i]=swap;
		}
		for (i=0;i<=4;i++)
		{
			flag=0;
			for (j=0;j<=4;j++)
			{
				if (flag) printf(" ");
				else flag=1;
				printf("%d",num[i][j]);
			}
			printf("\n");
		}
	}
	else printf("error");
}


int main()
{int sz[5][5],m,n,e,row,col;
for( row=0;row<5;row++){
for( col=0;col<5;col++){
scanf("%d",&sz[row][col]);}
}
scanf("%d%d",&m,&n);
if(m<5&&n<5){
	for(int col=0;col<5;col++){
		e=sz[m][col];
		sz[m][col]=sz[n][col];
		sz[n][col]=e;
}
}
if(m<5&&n<5){for( row=0;row<5;row++){
for( col=0;col<5;col++){
printf("%d",sz[row][col]);if(col<4){printf(" ");}}

printf("\n");
}}
if(m>4||n>4){printf("error");}
return 0;
}


int main()
{
	int a[5][5];
	int i,y;
	int *p;
	int *pa[5];
	int fun(int *pa[]);
	for(i=0;i<5;i++)
	{
		pa[i]=a[i];
		for(p=a[i];p<a[i]+5;p++)
			scanf("%d",p);
	}
	y=fun(pa);
	if(y==0)
		printf("error\n");
	else
	{
		for(i=0;i<5;i++)
		{
			for(p=pa[i];p<pa[i]+5;p++)
				printf("%d%c",*p,(p-pa[i]==4)?'\n':' ');
			printf("\n");
		}
	}
	return 0;
}
int fun(int *pa[])
{
	int n,m;
	int *i;
	scanf("%d %d",&n,&m);
	if(n>4||m>4)
		return 0;
	else
	{
		i=pa[n];
		pa[n]=pa[m];
		pa[m]=i;
		return 1;
	}
}


int main(){
    int A[5][5],m,n,row,list,i;
    row=0;
    while(row<5){
        list=0;
        while(list<5){
            scanf("%d",&A[row][list]);
            list++;
        }
        row++;
    }
    scanf("%d%d",&m,&n);
    if(m<0||n<0||m>4||n>4){
        printf("error");
    }
    else{
        i=0;
        while(i<5){
            row=A[m][i];
            A[m][i]=A[n][i];
            A[n][i]=row;
            i++;
        }
        row=0;
        while(row<5){
            list=0;
            while(list<5){
                if(list==4){
                    printf("%d\n",A[row][list]);
                }
                else{
                printf("%d ",A[row][list]);
                }
                list++;
            }
            row++;
        }
    }
    return 0;
}


int judge(int m,int n);
int main(){
	int m,n,i,j,array[5][5],tmp;
	for (i=0;i<5;i++)
		for (j=0;j<5;j++)
			scanf("%d",&(array[i][j]));
	scanf("%d%d",&m,&n);
	if (judge(m,n))
	{
		for (i=0;i<5;i++)
			{
			tmp=array[m][i];
			array[m][i]=array[n][i];
			array[n][i]=tmp;
			}
		for (i=0;i<5;i++)
		{
			for (j=0;j<4;j++)
				printf("%d ",array[i][j]);
			printf("%d\n",array[i][4]);
		}
	}
		else printf("error");
	return 0;
}
int judge(int m,int n)
{
	if ((m<5)&&(n<5))
		return 1;
	else return 0;
}


int shuzu[5][5];
	int e[5];
	int after[5][5];
	int m,n,row,col,i;
int main(int argc, char* argv[])
{
	int exchange(int a,int b);
	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
	scanf("%d",&shuzu[row][col]);}}
	scanf("%d%d",&m,&n);
	if(exchange(m,n)==0)
	{printf("error");}
	else
	{for(row=0;row<5;row++){
	for(col=0;col<5;col++){
		if(col!=4){printf("%d ",after[row][col]);}
	else printf("%d\n",after[row][col]);}}}

	return 0;
}
int exchange(int a, int b){
	if(a>=0&&a<5&&b>=0&&b<5)
	{for(i=0;i<5;i++){
	e[i]=shuzu[m][i];
	shuzu[m][i]=shuzu[n][i];
	shuzu[n][i]=e[i];}
	for(row=0;row<5;row++){
	for(col=0;col<5;col++){
		after[row][col]=shuzu[row][col];}}
	return 1;}

	else return 0;}


int check(int n,int m);
void swap(int *a,int *b);

void main()
{
	int o[5][5];
	int n,m;
	int i,j,c;
	int *x,*y;

	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
		{
			scanf("%d",&o[i][j]);
		}
	scanf("%d%d",&n,&m);
	c=check(n,m);
	if(c==0) printf("error");
	else
	{
		for(i=0;i<5;i++)
		{
		 x=&o[n][i];
	     y=&o[m][i];
		 swap(x,y);
		}
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			if(j<4)	printf("%d ",o[i][j]);
			else printf("%d",o[i][j]);
		}
		printf("\n");
	}
	}
}

int check(int n,int m)
{
	int q=0;
	if(n<5&&m<5) q=1;
	else q=0;
	return(q);
}

void swap(int *a,int *b)
{
	int temp;
	temp=*a;
	*a=*b;
	*b=temp;
}


int change(int a,int b);
int x[5][5];
int main(){
	int n,i,j,a,b;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
	        scanf("%d",&x[i][j]);
		}
	}
	scanf("%d%d",&a,&b);
	n=change(a,b);
	if(n==0) printf("error");
	else{
		for(i=0;i<5;i++){
			for(j=0;j<5;j++){
				if(j==0) printf("%d",x[i][j]);
				else printf(" %d",x[i][j]);
			}
			printf("\n");
		}
	}

    return 0;

}

int change(int a,int b){
	int i,j,y;

	if(a>4||b>4) return 0;
	else{
		for(i=0;i<5;i++){
			y=x[a][i];
			x[a][i]=x[b][i];
			x[b][i]=y;
		}
	}
	return 1;
}


int check(int m)
{
    if (m<=5 && m>=0) return 1;
    else return 0;
}

int main()
{
    int m,n,i;
    char temp[10],a[6][10];
    for (i=1;i<=5;i++)
    {
        gets(a[i]);
    }
    scanf("%d%d",&m,&n);
    if (check(m+1) && check(n+1))
    {
                 strcpy(temp,a[m+1]);
                 strcpy(a[m+1],a[n+1]);
                 strcpy(a[n+1],temp);
                 for (i=1;i<=5;i++)
                 puts(a[i]);

    }
    else printf("error");

    return 0;
}


int main()
{
	int exchange(int a[5][5],int n,int m);
	int a[5][5],n,m;
	int i,j;
	int y;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&a[i][j]);
	scanf("%d%d",&n,&m);
	y=exchange(a,n,m);
	if(y==0)
		printf("error");
	else
	{
		for(i=0;i<5;i++)
		{
			for(j=0;j<5;j++)
			{
				printf("%d",a[i][j]);
				if(j!=4)
					printf(" ");
			}
			printf("\n");
		}
	}

	return 0;
}

int exchange(int a[5][5],int n,int m)
{
	int z,k,i,j;
	if(n>=0&&n<5&&m>=0&&m<5)
	{
		for(j=0;j<5;j++)
		{
			k=a[m][j];
			a[m][j]=a[n][j];
			a[n][j]=k;
		}
		z=1;
	}
	else
		z=0;
	return z;
}


void main()
{
	int array[5][5],n,m,i,z;
	int *p;
	int panduan(int,int);
	void zhuanhuan(int *,int*);
	for(i=0;i<5;i++)
	{
		p=array[i];
	    scanf("%d %d %d %d %d\n",p,p+1,p+2,p+3,p+4);
	}
	scanf("%d %d",&n,&m);
	z=panduan(n,m);
	if(z==1)
	{
		zhuanhuan(array[n],array[m]);
		for(i=0;i<5;i++)
		{
		p=array[i];
	    printf("%d %d %d %d %d\n",*p,*(p+1),*(p+2),*(p+3),*(p+4));
		}
	}
	if(z==0)
	{
		printf("error\n");
	}
}

int panduan(int n,int m)
{
	int z=1;
	if(n<0||n>4)z=0;
	if(m<0||m>4)z=0;
	return(z);
}

void zhuanhuan(int *a,int *b)
{
	int temp,i;
	for(i=0;i<5;i++)
	{
		temp=*(a+i);
		*(a+i)=*(b+i);
		*(b+i)=temp;
	}
}


int main()
{
    int s[5][5]={0},m,n,i,j,t;

    for(i=0;i<5;i++){
        for(j=0;j<5;j++)
            scanf("%d",&s[i][j]);
    }
    scanf("%d%d",&m,&n);

    int converse(int p,int q);

    if(converse(m,n)){
        for(j=0;j<5;j++){
            t=s[m][j];
            s[m][j]=s[n][j];
            s[n][j]=t;
        }
        for(i=0;i<5;i++){
            for(j=0;j<5;j++){
                if(j!=4)
                printf("%d ",s[i][j]);
                if(j==4)
                printf("%d\n",s[i][j]);
            }
        }
    }
    else{
        printf("error");
    }
    return 0;
}

int converse(int p,int q)
{
    int t;
    if(p<0||p>4||q<0||q>4)
        return t=0;
    else
        return t=1;
}


int ab(int n,int m);
int main(){
  int i,j,n,m,a[5][5];
  for(i=0;i<5;i++){
	  for(j=0;j<5;j++){
	    scanf("%d",&a[i][j]);
	  }
  }
  scanf("%d%d",&n,&m);
  if(ab(n,m)) {
	  for(j=0;j<5;j++){
	     int tmp;
		 tmp=a[n][j];
		 a[n][j]=a[m][j];
		 a[m][j]=tmp;
	  }
      for(i=0;i<5;i++){
	    for(j=0;j<5;j++){
	      printf("%d",a[i][j]);
		  if(j<4) printf(" ");
		  if(j==4) printf("\n");
		}
	  }
  }
  else printf("error");
  return 0;
}
int ab(int n,int m){
   if(n<5&&m<5) return 1;
   else return 0;
}


int exchange(int matrix[][5],int n,int m);
int main()
{
    int det[5][5];
    int m,n,i,j;

    for(i=0;i<5;i++){
       for(j=0;j<5;j++){
                        scanf("%d",&det[i][j]);
                        }
    }
    scanf("%d%d",&n,&m);
    if(exchange(det,n,m)== 1){

                                for(i=0;i<5;i++){
                                   for(j=0;j<5;j++){
                                      printf("%d",det[i][j]);
                                      if(j<4)
                                             printf(" ");
                                   }
                                   printf("\n");
                                }
    }else{
         printf("error\n");
    }

    return 0;
}

int exchange(int matrix[5][5],int nf,int mf)
{

    int temp,i;
    if(mf>=0 && mf<5 && nf>=0 && nf<5){
             for(i=0;i<5;i++){
                              temp=matrix[nf][i];
                              matrix[nf][i]=matrix[mf][i];
                              matrix[mf][i]=temp;
                                }
            return 1;

    }else
            return 0;
}


void main()
{
	int inrange(int x,int y);
	int matrix[5][5],m,n,i,j,temp;

	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
			scanf("%d",&matrix[i][j]);
	}
	scanf("%d %d",&m,&n);

	if(inrange(m,n))
	{
		for(i=0;i<5;i++)
		{
			temp=matrix[m][i];
			matrix[m][i]=matrix[n][i];
			matrix[n][i]=temp;
		}

		for(i=0;i<5;i++)
		{
			for(j=0;j<5;j++)
			{
				if(j<4)
					printf("%d ",matrix[i][j]);
				else printf("%d\n",matrix[i][j]);
			}
		}
	}
	else printf("error\n");
}

int inrange(int x,int y)
{
	if((x>=0 && x<=4)&&(y>=0 && y<=4))
		return(1);
	else
		return(0);
}


int sz[5][5];
void exchange(int a,int b);
int main()
{

	int a,b,i,j;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
			scanf("%d",&sz[i][j]);
	}
	scanf("%d %d",&a,&b);
	exchange(a,b);

	return 0;
}
void exchange(int m,int n)
{
	if(m>4||m<0||n>4||n<0)
		printf("error");
	else
	{
		int a[5];
		int k,t;
		for(k=0;k<5;k++)
		{
			a[k]=sz[m][k];
			sz[m][k]=sz[n][k];
			sz[n][k]=a[k];
		}
		for(k=0;k<5;k++)
		{
			for(t=0;t<4;t++)
				printf("%d ",sz[k][t]);
			printf("%d\n",sz[k][4]);
		}
	}
}


int f(int n,int m);
int main(){
	int i,j,n,m;
	int shuzu[5][5]={0};
	int t[5]={0};
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&shuzu[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
	if(f(n,m)==0){
		printf("error");
	}else{
		for(j=0;j<5;j++){
		   t[j]=shuzu[n][j];
		   shuzu[n][j]=shuzu[m][j];
		   shuzu[m][j]=t[j];
		}
		for(i=0;i<5;i++){
			for(j=0;j<4;j++){
				printf("%d ",shuzu[i][j]);
			}printf("%d\n",shuzu[i][j]);
		}
	}
	return 0;
}
int f(int n,int m){
	if(n>=5||m>=5){return 0;}
	return 1;
}


int p[5][5];
int n,m;
int main()
{
    int exchange();
    for(int i=0;i<5;i++)
        for(int j=0;j<5;j++)
            scanf("%d",&p[i][j]);
    scanf("%d %d",&n,&m);
    if(exchange())
       for(int i=0;i<5;i++)
           {
           printf("%d",p[i][0]);
            for(int j=1;j<5;j++)
                printf(" %d",p[i][j]);
           printf("\n");
           }
    else
        printf("error");

}
int exchange()
{
    if(n<5&&n>=0&&m<5&&m>=0)
       {
       for(int i=0;i<5;i++)
           {
           int temp=p[n][i];
           p[n][i]=p[m][i];
           p[m][i]=temp;
           }
       return 1;
       }
    else
        return 0;
}


int ismatrix(int m, int n)
{
    if(m>=5||n>=5||n<0||m<0){
    return 0;
    }
    return 1;
}

int main()
{
    int i, j;
    int m, n;
    int a[5][5];
    for(i=0; i<5; i++)
    for(j=0; j<5; j++)
    scanf("%d", &a[i][j]);
    scanf("%d%d", &m, &n);
    if(ismatrix(m, n)){
        int tmp, first=1;
        for(i=0; i<5; i++){
            tmp=a[m][i];
            a[m][i]=a[n][i];
            a[n][i]=tmp;
        }
        for(i=0; i<5; i++)
        for(j=0; j<5; j++){
            if(j!=4)
            printf("%d ", a[i][j]);
            if(j==4)
            printf("%d\n",a[i][j]);
        }
    }
    else
    printf("error\n");
    return 0;
}


int panduan(int a[5][5],int n,int m)
{
	if(n>=0&&n<=4&&m>=0&&m<=4)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
void diaohuan(int a[5][5],int n,int m)
{
	int i,j,temp;
	if(panduan(a,n,m)==1)
	{
		for(i=0;i<5;i++)
		{
			temp=a[n][i];
			a[n][i]=a[m][i];
			a[m][i]=temp;
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<5;j++)
			{
				if(j==4)
				{
					printf("%d\n",a[i][j]);
				}
				else
				{
					printf("%d ",a[i][j]);
				}
			}
		}
	}
}
int main()
{
	int juzhen[5][5],n,m,i,j;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&juzhen[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	if(panduan(juzhen,n,m)==0)
	{
		printf("error\n");
	}
	else if(panduan(juzhen,n,m)==1)
	{
		diaohuan(juzhen,n,m);
	}
	return 0;
}


void main()
{
 int zhh(int n,int m);
 int a[5][5],i,j,m,n,c;
 for(i=0;i<=4;i++)
 {
  for(j=0;j<=4;j++)
   scanf("%d",&a[i][j]);
 }
 scanf("%d %d",&n,&m);
 if(zhh(n,m)==0)
  printf("error");
 else
 {	 for(i=0;i<=4;i++)
 {
   if(i==m)i=n;
  else if(i==n)i=m;
  for(j=0;j<=4;j++)
  {
	  if(j<4)
  printf ("%d ",a[i][j]);
	  else printf("%d",a[i][j]);
  if(j==4)printf("\n");
  }
  if(i==n)i=m;
  else if(i==m)i=n;
 }
}
}

int zhh(int n,int m)
{
 if(n>4||m>4)
  return(0);
 else
  return(1);
 }


int exch(int a[5][5],int rowa,int rowb){
	if(rowa<0||rowa>4||rowb<0||rowb>4)return 0;
	else{
		int col;
		for(col=0;col<5;col++){
			int temp;
			temp=a[rowa][col];
			a[rowa][col]=a[rowb][col];
			a[rowb][col]=temp;
		}
		return 1;
	}
}

int main()
{
	int a[5][5],rowa,rowb;
	int row,col;
	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
			scanf("%d",&a[row][col]);
		}
	}
	scanf("%d%d",&rowa,&rowb);
	switch(exch(a,rowa,rowb)){
		case 0: {
			printf("error");
			break;
		}
		case 1:{
			for(row=0;row<5;row++){
				printf("\n%d",a[row][0]);
				for(col=1;col<5;col++){
					printf(" %d",a[row][col]);
				}
			}
		}
	}
	return 0;
}


int n,m;
int jiaohuan(int str[5][5])
{
	int i,j,t;
  if(n<5&&m<5)
  {for(i=0;i<5;i++)
  {t=str[m][i];str[m][i]=str[n][i];str[n][i]=t;}
 return 1;}
  else return 0;
}

int main()
{
	int str[5][5],i,j;
	for(i=0;i<5;i++)
	{for(j=0;j<5;j++)
	{scanf("%d",&str[i][j]);}
	}
	scanf("%d %d",&n,&m);
    if(jiaohuan(str)==1)
	{for(i=0;i<5;i++)
	{for(j=0;j<5;j++)
	{if(j==0){printf("%d",str[i][j]);}
	else{printf(" %d",str[i][j]);}}
	printf("\n");}
	}
    if(jiaohuan(str)==0){printf("error");}
}


int panduan(int, int);

int main()
{
	int a[10][10], m, n;
	int t[10], i, j;

	for(i=0; i<5; i++)
		for(j=0; j<5; j++)
			scanf("%d", &a[i][j]);

	scanf("%d %d", &n, &m);

	if(panduan(n, m))
	{
		for(i=0; i<5; i++)
		{
			t[i]=a[m][i];
			a[m][i]=a[n][i];
			a[n][i]=t[i];
		}
		for(i=0; i<5; i++)
			for(j=0; j<5; j++)
			{
				printf("%d", a[i][j]);
				if(j==4)
					printf("\n");
				else
					printf(" ");
			}
	}
	else
		printf("error\n");

	return 0;
}

int panduan(int n, int m)
{
	if(m>4||n>4)
		return 0;
	else
		return 1;
}


int swi (int num[5][5],int a,int b)
{
	int f;
	int k;
    if(a>4||b>4)
		return 0;
	else
	{
		for(k=0;k<5;k++)
		{
			f=num[a][k];
			num[a][k]=num[b][k];
			num[b][k]=f;
		}
		return 1;
	}

}
int main ()
{
	int NU[5][5];
	int m,n;
	int i,j,c;
	int swi(int num[5][5],int a,int b);

	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			cin>>NU[i][j];
		}
	}
	cin>>m>>n;

	c=swi(NU,m,n);

    if(c==0)
		cout<<"error";
	if(c==1)
	{
		for(i=0;i<5;i++)
		{
			cout<<NU[i][0];
			for(j=1;j<5;j++)
			{
				cout<<" "<<NU[i][j];
			}
			if(j==5)
				cout<<endl;
		}
	}

	return 0;
}


void reverse(int a[5][5],int b,int c);
int main(int argc, char* argv[])
{
	int su[5][5];
	int hang1,hang2,panduan;
	int i,j;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
		scanf("%d",&su[i][j]);
		}
	}
	scanf("%d %d",&hang1,&hang2);
	reverse(su,hang1,hang2);
	return 0;
}
void reverse(int a[5][5],int b,int c){
	int panduan,k,l;
	int tihuan[5];
	if(((b>=0)&&(b<5))&&((c<5)&&(c>=0))){
		panduan=1;
		for(k=0;k<5;k++){
				if(b==c){break;}
				tihuan[k]=a[b][k];
				a[b][k]=a[c][k];
				a[c][k]=tihuan[k];
			}
	}else{panduan=0;}
	if(panduan){
		for(k=0;k<5;k++){
			for(l=0;l<4;l++){
				printf("%d ",a[k][l]);
			}
			printf("%d\n",a[k][4]);
		}
	}else{
		printf("error");
	}

}


int array[5][5];
int scan(int N,int M);
void main(){
	int n,m,i,j;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&array[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
	if(scan(n,m)==1){
		for(i=0;i<5;i++){
			for(j=0;j<5;j++){
				printf("%d",array[i][j]);
				if(j!=4){
					printf(" ");
				}
			}
			if(i!=4){
				printf("\n");
			}
		}
	}
	else if(scan(n,m)==0){
		printf("error\n");
	}
}

int scan(int N,int M){
	int i,temp[5];
	if((N>=0)&&(N<5)&&(M>=0)&&(M<5)){
		for(i=0;i<5;i++){
			temp[i]=array[N][i];
			array[N][i]=array[M][i];
			array[M][i]=temp[i];
		}
		return 1;
	}
	else {
		return 0;
	}
}


//#define N 5
void chan (int *p, int *q)
{
	int t=*p; *p=*q; *q=t;
}

int exch (int ar[5][5], int n, int m)
{
	if (n>=5||m>=5) return 0;
	else
	{
		int i;
		for (i=0; i<5; i++)
			chan (*(ar+n)+i, *(ar+m)+i);
		return 1;
	}
}

int main ()
{
	int ar[5][5], n, m, i, j, k;
	for (i=0; i<5; i++)
		for (j=0; j<5; j++)
			scanf ("%d", *(ar+i)+j);
	scanf ("%d%d", &n, &m);
	k=exch(ar, n, m);
	if (k==0)
		printf ("error");
	else
	{
		for (i=0; i<5; i++)
		for (j=0; j<5; j++)
		{
			if (j==4)
				printf ("%d\n", *(*(ar+i)+j));
			else printf ("%d ", *(*(ar+i)+j));
		}
	}
	return 0;
}


int panduan(int m,int n) {
	if (m<5&&n<5) {
		return 1;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int a[5][5];
	int m,n;
	int k,w,i;
	int t;
	for (k=0;k<5;k++)
	{
		for(w=0;w<5;w++)
			scanf("%d",&a[k][w]);
	}
	scanf("%d%d",&m,&n);
	if (panduan(m,n)==0)
		printf("error\n");
	else
	{
		for(i=0;i<5;i++)
		{
			t=a[m][i];
			a[m][i]=a[n][i];
			a[n][i]=t;
		}
		for (k=0;k<5;k++)
		{
			for (w=0;w<5;w++)
				if(w!=4)
				printf("%d ",a[k][w]);
				else
					printf("%d\n",a[k][w]);
		}
	}
	return 0;
}


void main()
{
int a[5][5],i,j,k,m,n;
  for(i=0;i<5;i++)
	  for(j=0;j<5;j++)
         scanf("%d",&a[i][j]);
scanf("%d%d",&m,&n);
int change(int m,int n);
   if(change(m,n))
	{ for(i=0;i<5;i++)
	 {
		 k=a[m][i];a[m][i]=a[n][i];a[n][i]=k;
	 }
	 for(i=0;i<5;i++)
	 {
		 for(j=0;j<4;j++)
         printf("%d ",a[i][j]);
		 printf("%d",a[i][4]);
		 printf("\n");
	 }
	}
   else
	   printf("error");
}

int change(int m,int n)
{
	if(m<5&&n<5)
		return(1);
	else
		return(0);
}


int juzhen(int hang)
{
    if (hang<5&&hang>=0)
    {
        return 1;
    }
    else return 0;

}

int main()
{
    int temp,a[5][5],i,j,n,m;

    for (i=0;i<5;i++)
    {
        for (j=0;j<5;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    scanf("%d %d",&n,&m);
    if (juzhen(n)&&juzhen(m))
    {

        for (j=0;j<5;j++)
        {
            temp=a[n][j];
            a[n][j]=a[m][j];
            a[m][j]=temp;
        }
    }
    else{printf("error\n"); return 0;}

    for (i=0;i<5;i++)
    {
        for (j=0;j<4;j++)
        {
            printf("%d ",a[i][j]);

        }
        printf("%d\n",a[i][4]);
    }

    return 0;
}


int main()
{
	int desk[5][5], n, m, temp;
	for( int i = 0; i < 5; i ++ )
		for( int j = 0; j < 5; j ++ )
			cin >> desk[i][j];
	cin >> n >> m;
	if( n >= 0 && n < 5 && m > 0 && m < 5 )
	{
		for( int i = 0; i < 5; i ++ )
		{
			temp = desk[n][i];
			desk[n][i] = desk[m][i];
			desk[m][i] = temp;
		}
		for( int i = 0; i < 5; i ++ )
		{
			for( int j = 0; j < 5; j ++ )
			{
				if( j ) cout << ' ';
				cout << desk[i][j];
			}
			cout << endl;
		}
	}
	else cout << "error" << endl;
	return 0;
}


int main()
{
	int exchange(int row[5][5],int n,int m);
	int jz[5][5];
	int i,j,n,m;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&jz[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
	if(exchange(jz,n,m)==0)
		printf("error\n");
	return 0;
}
int exchange(int row[5][5],int n,int m)
{
	if(n<0||n>4||m<0||m>4)
	{
		return 0;
	}
	else
	{
		int i,j;
		int between;
		for(i=0;i<5;i++)
		{
			between=row[n][i];
			row[n][i]=row[m][i];
			row[m][i]=between;
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<4;j++)
			{
			    printf("%d ",row[i][j]);
			}
			printf("%d\n",row[i][4]);
		}
        return (1);
	}
}


void swapInt(int *p,int *q)
{
	int t=*p;*p=*q;*q=t;
}

int inside(int n,int m)
{
	return n>=0 && m>=0 && n<N && m<N;
}

void read(int a[N][N],int *p,int *q)
{
	int i,j;
	for(i=0;i<N;i++)
		for(j=0;j<N;j++)
			scanf("%d",*(a+i)+j);
	scanf("%d%d",p,q);
}

int swapMatrixRow(int (*a)[5],int n,int m)
{
	int i;
	if(!inside(n,m)) return 0;
	for(i=0;i<N;i++)
		swapInt(*(a+n)+i,*(a+m)+i);
	return 1;
}

void out(int a[N][N])
{
	int i,j;
	for(i=0;i<N;i++)
		for(j=0;j<N;j++)
			printf("%d%s",*(*(a+i)+j),j==N-1?"\n":" ");
}

int main()
{
	int a[N][N],n,m;
	read(a,&n,&m);
	if(swapMatrixRow(a,n,m)) out(a);
	else printf("error");
	return 0;

}


struct num
{
	char juzhen[20];
	struct num * next;
};
int main()
{
	struct num number[5],* head,* p;
	int l,m,i;
	char change[10];
	for(i=0;i<5;i++)
		gets(number[i].juzhen);
	scanf("%d%d",&l,&m);
    strcpy(change,number[l].juzhen);
    strcpy(number[l].juzhen,number[m].juzhen);
	strcpy(number[m].juzhen,change);
    head=&number[0];
	p=head;
	number[4].next=NULL;
	if(l>=5||m>=5)
		printf("error");
	else
	{

    for(i=0;i<4;i++)
		number[i].next=&number[i+1];
	do
	{
		puts(p->juzhen);
		p=p->next;
	}while(p!=NULL);
	}
	return 0;
}


void main()
{int jiaohuan(int array[][5],int,int);
int i,j,m,n,a[5][5];
for(i=0;i<5;i++)
{for(j=0;j<5;j++)
scanf("%d",&a[i][j]);}
scanf("%d %d",&m,&n);
if(jiaohuan(a,m,n))
{for(i=0;i<5;i++)
{for(j=0;j<5;j++)
{printf("%d",a[i][j]);
if(j!=4)printf(" ");}
printf("\n");}}
else
printf("error");
printf("\n");}

int jiaohuan(int array[][5],int m,int n)
{int t,i;
if((m>4)||(n>4))
    return(0);
else
{for(i=0;i<5;i++)
{t=array[m][i];
array[m][i]=array[n][i];
array[n][i]=t;}
return(1);}}


int check(int (*arr)[5], int n, int m)
{
	int i,t;
	if (n<0||n>=5||m<0||m>=5) return 0;
	for (i=0; i<5; ++i)
	{
		t=arr[n][i]; arr[n][i]=arr[m][i]; arr[m][i]=t;
	}
	return 1;
}

int main() {
	int arr[5][5];
         int check(int (*arr)[5], int n, int m);
         int i,j;
	int n,m;
	for (i=0; i<5; ++i) for (j=0; j<5; ++j) scanf("%d", &arr[i][j]);
	scanf("%d %d", &n, &m);
	if (check(arr, n, m)==0)
	{
		printf("error\n");
		return;
	}
	for (i=0; i<5; ++i)
	{
		for (j=0; j<4; ++j) printf("%d ", arr[i][j]);
		printf("%d\n", arr[i][4]);
	}
	scanf("%d", &i);
}


int right(int m,int n)
{
	if(m>=0&&m<=4&&n>=0&&n<=4)
		return 1;
	else
		return 0;
}

void main()
{
	int m,n;
	int i,j;
	int array[5][5];
	int tempt[5];

	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&array[i][j]);
	scanf("%d%d",&m,&n);

	if(right(m,n))
	{
		for(i=0;i<5;i++)
		{
			tempt[i]=array[m][i];
		}
		for(i=0;i<5;i++)
		{
			array[m][i]=array[n][i];
		}
		for(i=0;i<5;i++)
		{
			array[n][i]=tempt[i];
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<4;j++)
				printf("%d ",array[i][j]);
			printf("%d\n",array[i][4]);
		}
	}
	else
		printf("error");
}


int array[5][5]={0};
int change(int m,int n)
{
	int i,t;
	if(n>=0&&n<5&&m>=0&&m<5)
	{
		for(i=0;i<5;i++)
		{
			t=array[n][i];
			array[n][i]=array[m][i];
			array[m][i]=t;
		}
		return 1;
	}
	else return 0;
}
int main()
{
	int i,j,n,m;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&array[i][j]);
		scanf("%d %d",&n,&m);
		if(change(n,m))
		{
			for(i=0;i<5;i++)
				for(j=0;j<5;j++)
				{
					printf("%d",array[i][j]);
					if(j!=4)printf(" ");
					else printf("\n");
				}
		}
		else printf("error");
				return 0;
}


int main()
{
	int check(int x,int y);
	char a[5][10];
	char *p[5];
	char *t;
	int n,m,i;

	for(i=0;i<5;i++)
	gets(a[i]);
	for(i=0;i<5;i++)
	p[i]=a[i];

	scanf("%d%d",&n,&m);
	if(check(n,m))
	{
      t=p[n];
	  p[n]=p[m];
	  p[m]=t;

	for(i=0;i<5;i++)
	{printf("%s\n",p[i]);}}
	else printf("error\n");
	return 0;
}

int check(int x,int y)
{
	if(x>-1&&x<5&&y>-1&&y<5)return 1;
	else return 0;
}


int SwapRow(int array[5][5],int row_n,int row_m)
{
	int col,a;
	if(row_n>=0&&row_n<5&&row_m>=0&&row_m<5){
		for(col=0;col<5;col++){
			a=array[row_n][col];
			array[row_n][col]=array[row_m][col];
			array[row_m][col]=a;
		}
		return 1;
	}
	else
		return 0;
}

int main(int argc, char* argv[])
{
	int array[5][5],n,m,row,col;
	for(row=0;row<5;row++){
		for(col=0;col<5;col++)
			scanf("%d",&array[row][col]);
	}
	scanf("%d %d",&n,&m);
	if(0 == SwapRow(array,n,m))
		printf("error");
	else{
		for(row=0;row<5;row++){
			for(col=0;col<5;col++){
				if(col==4)
					printf("%d\n", array[row][col]);
				else
					printf("%d ", array [row][col]);
			}
		}
	}
	return 0;
}


int matrix(int shuzu[5][5],int n,int m)
{
	int i;
	int temp=0;
	if (n>=0&&n<=4&& m>=0&&m<5)
	{
		for(i=0;i<5;i++)
		{
			temp=shuzu[n][i];
			shuzu[n][i]=shuzu[m][i];
			shuzu[m][i]=temp;
		}
	return 1;
	}
	else
	{
		return 0;
	}
}
int main()
{
	int shuzu[5][5];
	int n;
	int m;
	int i;
	int j;
	int k;
	int temp;
	for (i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&shuzu[i][j]);
		}
	}
	scanf("%d %d",&n,&m);
	if (matrix(shuzu,n,m)==0)
		printf("error");
	else if (matrix(shuzu,n,m)==1)
	{
		for(i=0;i<5;i++)
		{
			temp=shuzu[n][i];
			shuzu[n][i]=shuzu[m][i];
			shuzu[m][i]=temp;
		}
		for(k=0;k<5;k++)
		{
			for(j=0;j<5;j++)
			{
				printf("%d",shuzu[k][j]);
				if(j<4)
				{
					printf(" ");
				}
			}
			printf("\n");
		}
	}
	return 0;
}


int * p[5];

int exchange(int m,int n);
void output();

int main()
{
	int num[5][5];
	int i,j,m,n;
	for (i=0;i<5;i++)
	{
		for (j=0;j<5;j++)
		{
			scanf("%d",&num[i][j]);
		}
		p[i]=&num[i][0];
	}
	scanf("%d%d",&m,&n);
	if (exchange(m,n)==0)
	{
		printf("error\n");
	}
	else
	{
		output();
	}
	scanf("%d",&m);
	return 0;
}

int exchange(int m,int n)
{
	if (m<0 || n<0 || m>4 || n>4) return 0;
	int * pt;
	pt=p[m];
	p[m]=p[n];
	p[n]=pt;
	return 1;
}

void output()
{
	int i,j;
	for (i=0;i<5;i++)
	{
		printf("%d",*(p[i]));
		for (j=1;j<5;j++)
		{
			printf(" %d",*(p[i]+j));
		}
		printf("\n");
	}
}


int main(int argc, char* argv[])
{
	int juzhen[5][5];
	int i,j;
	int m,n;

	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&juzhen[i][j]);
		}
	}

	scanf("%d%d",&m,&n);

	if(n>=0&&n<5&&m>=0&&m<5)
	{
		int a[5],i;
		for(i=0;i<5;i++)
		{
			a[i]=juzhen[m][i];
			juzhen[m][i]=juzhen[n][i];
			juzhen[n][i]=a[i];
		}
		for(i=0;i<5;i++)
		{
			for(j=0;j<5;j++)
			{
				if(j==4)
					printf("%d",juzhen[i][j]);
				else
					printf("%d ",juzhen[i][j]);
			}
			printf("\n");
		}
	}
	else
		printf("error");

	return 0;
}


void swi (int num[5][5],int a,int b)
{
	int f;
	int k,i,j;
    if(a>4||b>4)
	    cout<<"error";
	else
	{
		for(k=0;k<5;k++)
		{
			f=num[a][k];
			num[a][k]=num[b][k];
			num[b][k]=f;
		}
		for(i=0;i<5;i++)
		{
			cout<<num[i][0];
			for(j=1;j<5;j++)
				cout<<" "<<num[i][j];
			if(j==5)
				cout<<endl;
		}
	}

}
int main ()
{
	int NU[5][5];
	int m,n;
	int i,j,c;
	void swi(int num[5][5],int a,int b);

	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			cin>>NU[i][j];
		}
	}
	cin>>m>>n;

	swi(NU,m,n);

	return 0;
}


int jzhh(int shuzu[5][5],int n,int m);
int main()
{
	int shuzu1[5][5],x,y,j,k;
	for(j=0;j<5;j++)
	{
		for(k=0;k<5;k++)
		{
			scanf("%d",&shuzu1[j][k]);
		}
	}
	scanf("%d %d",&x,&y);
	if(jzhh(shuzu1,x,y)==0)
	{
		printf("error");
	}else
	{
		for(j=0;j<5;j++)
		{
			for(k=0;k<5;k++)
			{
				if(k==4)
				{
					printf("%d\n",shuzu1[j][k]);
				}else
				{
					printf("%d ",shuzu1[j][k]);
				}
			}
		}
	}
	return 0;
}
int jzhh(int shuzu[5][5],int n,int m)
{
	int e,i;
	if((m<=4)&&(n<=4))
	{
		for(i=0;i<5;i++)
		{
			e=shuzu[m][i];
			shuzu[m][i]=shuzu[n][i];
			shuzu[n][i]=e;
		}
		return 1;
	}else
	{
		return 0;
	}
}


void main()
{
	int change(int n,int m);
	void changing(int a[5][5],int n,int m);
	int n,m,i,j,flag,a[5][5];
	for(j=0;j<5;j++)
		for(i=0;i<5;i++)
			scanf("%d",&a[j][i]);
	scanf("%d%d",&n,&m);
	flag=change(n,m);
	if(flag==0) printf("error\n");
	else
	{
		changing(a,n,m);
		for(j=0;j<5;j++)
		{
			printf("%d",a[j][0]);
			for(i=1;i<5;i++)
				printf(" %d",a[j][i]);
			printf("\n");
		}
	}
}
int change(int n,int m)
{
	int f;
	if((n>=0&&n<5)&&(m>=0&&m<5)) f=1;
	else f=0;
	return(f);
}
void changing(int a[5][5],int n,int m)
{
	int i,b[5];
	for(i=0;i<5;i++)
	{
		b[i]=a[n][i];
		a[n][i]=a[m][i];
		a[m][i]=b[i];
	}
}


int main()
{
 int jiaohuan(int *p,int ,int);
 int a[5][5],n,m,i,c;
 int *p;
 p=a[0];
 for (i=0;i<25;i++,p++)

  scanf("%d",&*p);
 scanf("%d%d",&n,&m);
 p=a[0];
 c=jiaohuan(p,n,m);

 if(c==0)printf("error");
 else if(c==1)
 {
  p=a[0];
  for (i=0;i<25;i++,p++)

  {
	  if(i%5==0)printf("\n");
	  else printf(" ");
  printf("%d",*p);
  }

 }

 return 0;
}
int jiaohuan(int *p,int n,int m)
{
 int t,i;
 if(m<5&&n<5)
 {
  for(i=0;i<5;i++)
  {
  t=*(p+n*5+i);
  *(p+n*5+i)=*(p+m*5+i);
  *(p+m*5+i)=t;
  }
  return 1;
 }
 else return 0;
}


int main()
{
	int MtxSwap(int [][5], int, int);
	int mtx[5][5], i, j;
	for(i=0; i<5; i++)
		for(j=0; j<5; j++)
			scanf("%d", &mtx[i][j]);
	int m, n;
	scanf("%d%d", &m, &n);
	if(MtxSwap(mtx,m,n))
		for(i=0; i<5; i++)
		{
			for(j=0; j<4; j++)
				printf("%d ", mtx[i][j]);
			printf("%d\n", mtx[i][j]);
		}
	else printf("error\n");
	return 0;
}
int MtxSwap(int mtx[][5], int m, int n)
{
	if(m<0 || m>4 || n<0 || n>4)
		return 0;
	int tmp[5];
	memcpy(tmp, mtx[m], sizeof(tmp));
	memcpy(mtx[m], mtx[n], sizeof(tmp));
	memcpy(mtx[n], tmp, sizeof(tmp));
	return 1;
}


int main()
{
    void swap(int data[5][5], int n, int m);

    int data[5][5];
    int n, m;

    int i, j;

    for(i = 0; i <= 4; i++)
          for(j = 0; j <= 4; j++)
                scanf("%d", &data[i][j]);

    scanf("%d %d", &n, &m);

    swap(data, n, m);

        return 0;
}

void swap(int data[5][5], int n, int m)
{
     int i, j;

     if(n < 0 || n > 4 || m < 0 || m > 4)
          printf("error");
     else
     {
         for(i = 0; i <= 4; i++)
         {
               for(j = 0; j <= 4; j++)
               {
                     if(i == m)
                          printf("%d", data[n][j]);
                     if(i == n)
                          printf("%d", data[m][j]);
                     if(i != m && i != n)
                          printf("%d", data[i][j]);
                     if(j != 4)
                          printf(" ");
               }
               printf("\n");
         }
     }
}


int check(int a[5][5],int n,int m);

int check(int a[5][5],int n,int m){
	int row,col,indin=0,indim=0,indi;
	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
			if((a[row][col])==n){
				indin=1;
			}
			if((a[row][col])==m){
				indim=1;
			}
		}
	}
	indi=indin*indim;
	return indi;
}

int main()
{
	int square[5][5],n,m;
	int row,col;
	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
			scanf("%d",&square[row][col]);
		}
	}
	scanf("%d%d",&n,&m);
	int result,temp;
	result=check(square,n,m);
	if(result==0||n>4||m>4)printf("error");
	else{
		for(col=0;col<5;col++){
			temp=square[n][col];
			square[n][col]=square[m][col];
			square[m][col]=temp;
		}
	for(row=0;row<5;row++){
		printf("\n%d",square[row][0]);
		for(col=1;col<5;col++)printf(" %d",square[row][col]);
	}
	}

	return 0;
}


int change(int sz[][5],int,int);

int main(){
	int n,m,i,j;
	int sz[5][5];

	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&(sz[i][j]));
		}
	}
	scanf("%d%d",&n,&m);
	if(change(sz,n,m)){
		for(i=0;i<5;i++){
			for(j=0;j<4;j++){
				printf("%d ",sz[i][j]);
				}
			printf("%d\n",sz[i][4]);
		}
	}else{
		printf("error");
	}
    return 0;
}

int change(int sz[][5],int n,int m){
	int temp,i;
	if((n>=0&&n<=4)&&(m>=0&&m<=4)){
		for (i=0;i<5;i++){
		temp=sz[n][i];
		sz[n][i]=sz[m][i];
		sz[m][i]=temp;}
		return 1;
	}else{
		return 0;
	}
}


int change(int sz[5][5],int n,int m);
int main(int argc, char* argv[])
{
	int sz[5][5],i,j,n,m;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	scanf("%d%d",&n,&m);
	if(change(sz,n,m)){
		for(i=0;i<5;i++){
			for(j=0;j<4;j++){
				printf("%d ",sz[i][j]);
			}
			if(j==4){
				printf("%d\n",sz[i][j]);
			}
		}
	}else{
		printf("error");
	}
	return 0;
}

int change(int sz[5][5],int n,int m){
	int i,e;
	if((n>=0&&n<=4)&&(m>=0&&m<=4)){
		for(i=0;i<5;i++){
			e=sz[n][i];
			sz[n][i]=sz[m][i];
			sz[m][i]=e;
		}
		return 1;
	}else{
		return 0;
	}
}


int hanshu(int m,int n);
int main()
{
	int a[5][5];
	int b[5];
	int i,j;
	for(i=0;i<5;i++)
	{
		for(j=0;j<5;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	int m,n;
	scanf("%d%d",&m,&n);
	if(hanshu(m,n)==1)
	{
		for(j=0;j<5;j++)
		{
			b[j]=a[m][j];
			a[m][j]=a[n][j];
			a[n][j]=b[j];
		}
		for(i=0;i<5;i++)
		{
		    for(j=0;j<4;j++)
			{
				printf("%d ",a[i][j]);
			}
			printf("%d\n",a[i][4]);
		}
	}
	else
	{
		printf("error");
	}
	return 0;
}
int hanshu(int m,int n)
{
	int result;
	if(m>=0&&m<=4&&n>=0&&n<=4)
	{
		result=1;
	}
	else
	{
		result=0;
	}
	return result;
}


int a[10][10];
int main()
{
	int process(int y,int z);
	int i,j,n,m;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&a[i][j]);
	scanf("%d%d",&m,&n);
	if(process(m,n))
	{
		for(i=0;i<5;i++)
		{
		for(j=0;j<5;j++)
		{
			printf("%d",a[i][j]);
			if(j!=4) printf(" ");
		}
		printf("\n");
		}
	}
	else printf("error\n");
	return 0;
}
int process(int y,int z)
{
	int k,temp;
	if((y>=0&&y<5)&&(z>=0&&z<5))
	{
		for(k=0;k<5;k++)
		{
			temp=a[y][k];
			a[y][k]=a[z][k];
			a[z][k]=temp;
		}
		return 1;
	}
	else return 0;
}


int exc(int x,int y);
int exc(int x,int y){
	int z,j,e,s[5][5];
	if(x>4||y>4){
		z=0;
	}else{
		z=1;
		for(j=0;j<5;j++){
			e=s[x][j];
			s[x][j]=s[y][j];
			s[y][j]=e;
		}
	}
	return z;
}

int main(){
	int sz[5][5],n,m,j,e;
	int row,col;

	for(row=0;row<5;row++){
		for(col=0;col<5;col++){
			scanf("%d",&sz[row][col]);
		}
	}
	scanf("%d%d",&n,&m);

	exc(n,m);
	if(exc(n,m)==0){
		printf("error");
	}else{
		for(j=0;j<5;j++){
			e=sz[n][j];
			sz[n][j]=sz[m][j];
			sz[m][j]=e;
		}
		for(row=0;row<5;row++){
	    	for(col=0;col<4;col++){
	    		printf("%d ",sz[row][col]);
			}
			printf("%d\n",sz[row][4]);
		}
	}

	return 0;

}


int exchange(int k[][5],int n,int m)
{int t,i;
	if(n<5&&m<5)
	{
		for(i=0;i<5;i++)
		{
			t=k[m][i];
			k[m][i]=k[n][i];
			k[n][i]=t;
		}
	return 1;
	}
else
	return 0;
}

int main(int argc, char* argv[])
{
int a[5][5],n,m,i,j,c;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
		scanf("%d",&a[i][j]);
		scanf("%d%d",&n,&m);
	c=exchange(a,n,m);
	if(c==1)
	{
		for(i=0;i<5;i++)
		{
			for(j=0;j<4;j++)
				printf("%d ",a[i][j]);
				printf("%d",a[i][4]);
				printf("\n");
		}
	}
	if(c==0)
			printf("error");
return 0;
}


// 5*5 ??
int FindAndExchange(int Matrix[5][5], int n, int m)
{
int i;
int *num_n;
int *num_m;
if (!(n>=0&&n<=4 && m>=0&&m<=4))
return 0;
num_n = &Matrix[n][0];
num_m = &Matrix[m][0];
for (i=0; i<5; i++){
*num_n ^= *num_m;
*num_m ^= *num_n;
*num_n ^= *num_m;
num_n++;
num_m++;
}
return 1;
}
int main()
{
int Matrix[5][5];
int i, j;
int n, m;
for (i=0; i<5; i++){
for (j=0; j<5; j++){
scanf("%d", &Matrix[i][j]);
}
}
scanf("%d %d", &n, &m);
if (FindAndExchange(Matrix, n, m)) {
for (i=0; i<5; i++){
if (i>0) printf("\n");
for (j=0; j<5; j++){
if (j>0) printf(" ");
printf("%d", Matrix[i][j]);
}
}
} else
printf("error");
return 0;
}


int main(){
    int z[5][5],x[5][5];
    int n,m,i=0;
    for(int row = 0; row  < 5; row++){
    		for(int col = 0; col < 5; col++){
					scanf("%d", &z[row][col]);
			}
	}
    for(int row = 0; row  < 5; row++){
        	for(int col = 0; col < 5; col++){
				x[row][col]=z[row][col];
			}
	}
    scanf("%d%d",&n,&m);
    if(n<=4&&n>=0&&m<=4&&m>=0){
        for(int i=0;i<5;i++){
            x[n][i]=z[m][i];
            x[m][i]=z[n][i];
        }
         for(int row = 0; row  < 5; row++){
            for(int col = 0; col <4; col++){
				printf("%d ",x[row][col]);
			}
            printf("%d",x[row][4]);
            printf("\n");
	}
    }
    else{
        printf("error");
    }
    return 0;
}


int exchange(int shz[5][5],int x,int y)
{
	int p,t;
	if((x>=0&&x<5)&&(y>=0&&y<5)){
	    for(p=0;p<5;p++){
		t=shz[x][p];
		shz[x][p]=shz[y][p];
		shz[y][p]=t;
	    }
	    return 1;
	}else{
	    return 0;
	}
}

void main()
{
	int n,m;
	int result;
	int i,j;
	int sz[5][5];
	for(i=0;i<5;i++){
	    for(j=0;j<5;j++){
		scanf("%d",&sz[i][j]);
	    }
	}
	scanf("%d%d",&n,&m);
	result=exchange(sz,n,m);
	if(result==0){
	    printf("error\n");
	}else{
	    for(i=0;i<5;i++){
		for(j=0;j<4;j++){
			printf("%d ",sz[i][j]);
			if(j==3){
			printf("%d\n",sz[i][4]);
			}
		}
	    }
	}
}


int reverse(int,int);
int main(int argc, char* argv[])
{
	int sz[5][5],n,m,i,j,e[5];

	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&sz[i][j]);
		}
	}
	scanf("%d%d",&m,&n);

	if(reverse(n,m)==0){
		printf("error\n");
	}else{
		for(j=0;j<5;j++){
		e[j]=sz[n][j];
		sz[n][j]=sz[m][j];
		sz[m][j]=e[j];
		}
		for(i=0;i<5;i++){
			for(j=0;j<4;j++){
				printf("%d ",sz[i][j]);
			}
			if(j==4){
				printf("%d",sz[i][j]);
			}
			printf("\n");
		}
	}

	return 0;
}

int reverse(int n,int m){

	if(n>=0&&n<5&&m>=0&&m<5){
		return 1;
	}else{
		return 0;
	}

}


void main()
{
	int b,n,m,a[5][5],i,j;
	int decide(int n,int m);
	void change(int n,int m,int a[5][5]);
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			scanf("%d",&a[i][j]);
		scanf("%d%d",&n,&m);
	b=decide(n,m);
	if(b==0)
		printf("error");
	if(b==1)
		change(n,m,a);
}
int decide(int n,int m)
{
	int a;
	if(n>=0&&n<5&&m>=0&&m<5)
		a=1;
	else a=0;
	return(a);
}
void change(int n,int m,int a[5][5])
{
	int b,i,j;
	for(j=0;j<5;j++)
	{
		b=a[n][j];
		a[n][j]=a[m][j];
		a[m][j]=b;
	}
	for(i=0;i<5;i++)
	{
		for(j=0;j<4;j++)
			printf("%d ",a[i][j]);
		printf("%d\n",a[i][4]);
	}
}


int a[5]={0,1,2,3,4};
int change(int m,int n)
{
	int t;
	if(m<5&&m>-1&&n<5&&n>-1)
	{
		t=a[m];
		a[m]=a[n];
		a[n]=t;
		return 1;
	}
	else	return 0;
}
int main()
{
	int num[5][5],m,n;
	for(m=0;m<5;m++)
		for(n=0;n<5;n++)	cin>>num[m][n];
	cin>>m>>n;
	if(change(m,n))
	{
		for(m=0;m<5;m++)
		{
			cout<<num[a[m]][0];
			for(n=1;n<5;n++)
			{
				cout<<" "<<num[a[m]][n];
			}
			cout<<endl<<endl;
		}
	}
	else cout<<"error"<<endl;
	return 0;
}


int main()
{
int array[5][5],i,j,n,m;
int exchange(int array[5][5],int n,int m);
for(i=0;i<5;i++){
   for(j=0;j<5;j++){
      scanf("%d",&array[i][j]);
      }
   }
scanf("%d %d",&n,&m);
if(exchange(array,n,m)){
             for(i=0;i<5;i++){
                for(j=0;j<4;j++){
                   printf("%d ",array[i][j]);
                   }
                   printf("%d",array[i][4]);
                printf("\n");
                }
             }else{
                   printf("error");
                   }
return 0;
}

int exchange(int array[5][5],int n,int m){
    int a[5],b[5],i;
    if((n<5&&n>=0)&&(m<5&&m>=0)){
      for(i=0;i<5;i++){
         a[i]=array[n][i];
         }
      for(i=0;i<5;i++){
         b[i]=array[m][i];
         }
      for(i=0;i<5;i++){
         array[m][i]=a[i];
         }
      for(i=0;i<5;i++){
         array[n][i]=b[i];
         }
      return 1;
      }else{
            return 0;
            }
}


int juzhen(int n,int m);
int a[5][5];
int main(){

	int i,j;
	for(i=0;i<5;i++){
		for(j=0;j<5;j++){
			scanf("%d",&a[i][j]);
		}
	}
	int n,m;
	scanf("%d%d",&n,&m);
	int b=juzhen(n,m);
	if(b==1){
		for(i=0;i<5;i++){
			for(j=0;j<4;j++){
				printf("%d ",a[i][j]);
			}
			printf("%d\n",a[i][4]);
		}
	}
	if(b==0){
		printf("error");
	}
	return 0;
}
int juzhen(int n,int m){
	int j;
	if(0<=n&&n<=4&&0<=m&&m<=4){
		for(j=0;j<5;j++){
			int temp;
			temp=a[n][j];
			a[n][j]=a[m][j];
			a[m][j]=temp;
		}
		return 1;
	}
	else return 0;
}


int main()
{
    int n,a,b,count,i,count_max;
    scanf("%d",&n);
    count=0;
    count_max=0;
    for(i=1;i<=n;i=i+1)
    {
       scanf("%d %d",&a,&b);
       if(a>=90 && a<=140 && b>=60 && b<=90)
           count=count+1;
       else
          {
               if(count_max<count)
                     count_max=count;
               count=0;
           }
       if(count>count_max)
           count_max=count;
     }
          printf("%d",count_max);
     return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	int xueya[100][2];
	int shijian[100];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%d%d",&xueya[i][0],&xueya[i][1]);
		if(xueya[i][0]>=90&&xueya[i][0]<=140&&xueya[i][1]>=60&&xueya[i][1]<=90)
		{
			shijian[i]=1;
		}
		else
		{
			shijian[i]=0;
		}
	}
	int duan[100];
	for(i=0;i<n;i++)
	{
		duan[i]=0;
	}

	int j=0;
	for(i=0;i<n;i++)
	{
		if(shijian[i]==1)
		{
			duan[j]++;
		}
		else if(shijian[i]==0)
		{
			j++;
		}
	}
	int max=0;
	for(i=0;i<n;i++)
	{
		if(duan[i]>max)
		{
			max=duan[i];
		}
	}
	printf("%d",max);

	return 0;
}


int main()
{
    int n,i,t=0,a[100],k=0,m=1,min,max,result=0;
    cin>>n;
    for(i=0;i<n;i++)
	{
		m=1;
		cin>>max>>min;
		if(max<90)
			m=0;
		else
		{
			if(max>140)
				m=0;
		}
		if(min>90)
			m=0;
		else
		{
			if(min<60)
				m=0;
		}
		if(m==1)
			t++;
		else
		{
			a[k]=t;
			k++;
			t=0;
		}
	}
	a[k]=t;
	k++;
	for(i=0;i<k;i++)
		if(result<a[i])
			result=a[i];
	cout<<result<<endl;
	return 0;
}


int main() {
	int N;
	cin >>N;
	const int n=N;
	int high[n];
	int low[n];
	for (int i=0;i<=n-1;i++)
	{
		cin >>high[i]>>low[i];
	}
	int contin[n];
	for (int i=0;i<=n-1;i++)
	{
		contin[i]=0;
	}
	for (int k=0;k<=n-1;k++)
	{
		for (int i=k;i<=n-1;i++)
		{
			if ((high[i]>=90)&&(high[i]<=140)&&(low[i]>=60)&&(low[i]<=90))
			{
				contin[k]=contin[k]+1;
			}
			else
				break;
		}
	}
	int max=contin[0];
	for (int i=0;i<=n-1;i++)
	{
		if (contin[i]>max)
			max=contin[i];
	}
	cout <<max<< endl;
	return 0;
}


int main(){
	int n,shou,shu,h,max,i;
	scanf("%d\n",&n);
	max=0;
	h=0;
	for(i=1;i<=n;i++){
		scanf("%d%d",&shou,&shu);
		if(shou>=90&&shou<=140&&shu>=60&&shu<=90){
			h++;
		}else{
			if(max<h){
				max=h;
			}
			h=0;
		}
	}
if(max<h){
				max=h;
			}
	printf("%d\n",max);
	return 0;
}


/*
  Name: ??(5-5) ????
  Author: 120012757(chenminhuan)
  Date: 15/10/12 18:28
*/

int n,ans,cnt,a,b;
int main()
{

    cin>>n;                                             //read in times
    ans = 0;                                            // answer
    cnt = 0;
    while (n--){
          cin>>a>>b;
          if(a>=90 && a<=140 && b>=60 && b<=90) cnt++;
          else
          {
              if(cnt>ans) ans = cnt;
              cnt = 0;
          }
    }
    if (cnt>ans) ans = cnt;
    cout<<ans<<endl;
    return 0;
}


int main(){
	int n,x,y;
	int i=1;
	int max=0;
	int time=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d %d\n",&x,&y);
		if(x>=90 && x<=140 && y>=60 && y<=90){
			time+=1;
			if(time>=max){
				max=time;
			}
		}else{
			time=0;
		}
	}
	printf("%d",max);
	return 0;
}


int main()
{
	int n;
	int k = 0;
	int max = 0;
	int a;
	int b;
    scanf("%d",&n);
	while(n != 0)
	{
		scanf("%d",&a);
		scanf("%d",&b);
		if (90 <= a && a <= 140 && 60 <= b && b<= 90)
			k++;
		else
			k = 0;

		if(max < k)
			max = k;

	   n--;
	}
	printf("%d",max);

   return 0;
}


int main()
{
 int n;
 cin>>n;
 int max=0;
 int t=0;
 int a,b;
 for(int i=1;i<=n;i++)
 {
  cin>>a>>b;
  if(a>=90&&a<=140&&b>=60&&b<=90)
   t++;
  else if(t!=0)
   {max=t>max?t:max;t=0;}
  max=t>max?t:max;
 }
 cout<<max;
 return 0;
}


int main()
{
	int t = 0, i, n, shou, shu, health;
	int max = 0;
	int bp[100 + 10] = {0};
	cin >> n;
	for (i = 0; i < n; i ++)
	{
		cin >> shou >> shu;
		if (90 <= shou && shou <= 140 && 60 <= shu && shu <= 90)
			bp[i] = 1;
	}
	cout << endl;
	for (i = 0; i < n; i ++)
	{
		if (bp[i] == 0)
		{max = max > t ? max : t; t = 0;}
		else t ++;
	}

	max = max > t ? max : t;
	cout << max << endl;
}


/*
 * pressure.cpp
 *
 *  Created on: 2012-10-17
 *      Author: Justin
 */
int main(){
	int p1,p2,hour,hourmax,n;
	hour=0;
	hourmax=0;
	cin>>n;
	while(n>0){
		cin>>p1>>p2;
		if(p1<=140 && p1>=90 && p2<=90 && p2>=60)
			{hour=hour+1;
			n=n-1;
			}
		else
		{hourmax=max(hour,hourmax);
		hour=0;
		n=n-1;
		}
	}
	cout<<max(hour,hourmax);
	return 0;
}


int main(int argc, char* argv[])
{
	int n;
	int a,b;
	int sum=0;
	int x=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d",&a,&b);
		if(90<=a&&a<=140&&60<=b&&b<=90)
		{
			sum++;
		}
		else
		{
			sum=0;
		}
		if(sum>=x)
		{
			x=sum;
		}
	}
	printf("%d",x);
	return 0;
}


int main()
{
	int n,sp,dp,dur,h=0,max=0;//sp=systolic pressure,dp=diabolic pressure,dur=duration
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&sp,&dp);
		if(sp>=90&&sp<=140&&dp>=60&&dp<=90){
			h++;
			dur=h;
		}
		else
			dur=h=0;
		if(max>=dur)
			continue;
		else
			max=dur;
	}
	printf("%d\n",max);
}


int main()
{
	int n, high, low, k = 0, g = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> high >> low;
		if (high <= 140 && high >= 90 && low <= 90 && low >= 60)
			k++;
		else
		{
			if (k > g)
				g = k;
			k = 0;
		}
	}
	if (k > g)
		g = k;
	cout << g << endl;
	return 0;
}


int main()
{
	int bloodpressuremax[101];
	int bloodpressuremin[101];
	int lastingtime[101];
	lastingtime[1] = 0;
	int n , a = 1 ;

	cin >> n;

	for (int i=1 ; i <=n ; i++)
	{
		cin >> bloodpressuremax[i];
		cin >> bloodpressuremin[i];
		if (bloodpressuremax[i] <= 140 && bloodpressuremax[i] >= 90 && bloodpressuremin[i] <= 90 && bloodpressuremin[i] >= 60)
		{
			lastingtime[a] = lastingtime[a] + 1;
		}
		else
		{
			a = a + 1;
			lastingtime[a] = 0;
		}
	}

	int maxtime = 0;
	for (int j = 1; j <= a; j++)
		if (maxtime <= lastingtime[j])
			maxtime = lastingtime[j];

	cout << maxtime << endl;
	return 0;
}


int ss[10000],sz[10000],xiaoshi[10000];
int main(){
int i,n,hour=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %d\n",&ss[i],&sz[i]);
}
for(i=0;i<n;i++){
if((ss[i])>=90&&(ss[i])<=140&&(sz[i])>=60&&(sz[i])<=90){
    hour++;
    xiaoshi[i]=hour;
    }
    else{
       hour=0;
    }
}
    int e;
    for(int k=1;k<=n;k++){
       for(int i=0;i<n-k;i++){
       if(xiaoshi[i+1]<xiaoshi[i]){
       e=xiaoshi[i+1];
       xiaoshi[i+1]=xiaoshi[i];
       xiaoshi[i]=e;               }
                              }
                          }
    printf("%d",xiaoshi[n-1]);
    return 0;
}


int main()
{
	int n,shousuo[100],shuzhang[100],zanshi[100];
	int i,j,e;
	j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&shousuo[i],&shuzhang[i]);
	}
	for(i=0;i<n;i++){
		if(shousuo[i]>=90&&shousuo[i]<=140&&shuzhang[i]>=60&&shuzhang[i]<=90&&i<n-1){
			j=j+1;
			zanshi[i]=0;
		}else if(shousuo[i]>=90&&shousuo[i]<=140&&shuzhang[i]>=60&&shuzhang[i]<=90&&i==n-1){
			j=j+1;;
			zanshi[i]=j;
		}
		else if(shousuo[i]<90||shousuo[i]>140||shuzhang[i]<60||shuzhang[i]>90){
			zanshi[i]=j;
			j=0;
		}
	}
	for(i=0;i<n-1;i++){
		if(zanshi[i]>zanshi[i+1]){
			e=zanshi[i];
			zanshi[i]=zanshi[i+1];
			zanshi[i+1]=e;
		}
	}
	printf("%d",zanshi[n-1]);
	return 0;
}


    struct patient
    {int x;
    int y;
           }p[100];
int main()
{
    int max=0;
    int n;
    cin>>n;
    int k=0;
    int i;
    for(i=1;i<=n;i++)
    scanf("%d %d",&p[i].x,&p[i].y);
    for(i=1;i<=n;i++)
   {
    if(p[i].x>=90&&p[i].x<=140&&p[i].y<=90&&p[i].y>=60)
    k++;
    else k=0;

    if(max<=k)
    max=k;
    }
cout<<max;

return 0;

}


int main()
{
	int n;
	int m=0;
	int k=0;
	int i=0;
	int maxk=0;
	scanf("%d",&n);
	int szsmall[n],szlarge[n],sz[n];
	for(i=0;i<n;i++)
	{
		scanf("%d",&szlarge[i]);
		scanf("%d",&szsmall[i]);
	}
	for(i=0;i<n;i++)
	{
		if(szsmall[i]<=90 && szsmall[i]>=60 && szlarge[i]<=140 && szlarge[i]>=90)
		{
			sz[i]=1;
		}
		else
		{
			sz[i]=0;
		}
	}
	while(1)
	{
		k=0;
		for(i=m;i<n;i++)
		{
			if(sz[i]==1)
			{
				k=k+1;
				m=i+1;
				if(k>maxk)
				{
					maxk=k;
				}
				if(m==n)
				{
					break;
				}
				if(sz[m]==0)
				{
					break;
				}
			}
			else
			{
				continue;
			}
		}
		if(m==n||i==n)
		{
			break;
		}
	}
	printf("%d",maxk);
	return 0;
}


int main()
{
	int n;
	cin>>n;
	int high[101], low[101], time = 0, continuous[101], max = 0;
	for(int i = 1; i <= n; i ++)
	{
		cin>>high[i]>>low[i];
	}
	for(int j = 1; j <= n; j++)
	{
		if(high[j] >= 90 && high[j] <= 140 && low[j] >= 60 && low[j] <= 90)
		{
			time ++;
			continuous[j] = time;
		}
		else
			continuous[j] = time = 0;
	}
	max = continuous[1];
	for (int k = 1; k <= n; k++)
	{
		if(max < continuous[k])
			max = continuous[k];
	}
	cout<<max<<endl;
	return 0;
}


int Ok(int a,int b);
int max(int a[],int n);
int n,high[100],low[100],length[100];
int main()
{
    int i,t=0;
	scanf("%d",&n);
	for(i=0;i<100;i++)
		length[i]=0;
	for(i=0;i<n;i++)
		scanf("%d%d",&high[i],&low[i]);
	for(i=0;i<n;i++)
		if (Ok(high[i],low[i])==1)
			switch (Ok(high[i+1],low[i+1])){
			case 1:length[t]+=1;break;
			case 0:length[t++]+=1;
		}
	printf("%d",max(length,t));
	return 0;
}
int Ok(int a,int b)
	{
		return a>=90&&a<=140&&b>=60&&b<=90;
	}
int max(int a[],int n)
{
	int i,MAX;
	MAX=*a;
	for (i=1;i<n;i++)
		if(MAX<*(a+i))
			MAX=*(a+i);
		return MAX;
}


int main()
{
    int n;

    scanf("%d", &n);

    int *normal = (int *) malloc(sizeof(int) * n);

    int hi, lo;

    int i;

    int max = 0;
    int len;
    int previous = -1;

    for(i = 0; i <= n - 1; i++)
    {
          scanf("%d %d", &hi, &lo);
          if( (lo >= 60) && (lo <= 90) && (hi >= 90) && (hi <= 140) )
          {}
          else
          {
              len = i - previous - 1;
              previous = i;
              if(len > max)
                     max = len;
          }
    }

    i = n;
    len = i - previous - 1;
    if(len > max)
                     max = len;

    printf("%d", max);

    return 0;
}


int main(){
	int x,y;
	int n;cin >> n;
	int m = 0,count = 0;
	while(n--){
		cin >> x >> y;
		if(x >= 90 && x <= 140 && y >= 60 && y <= 90){
			count ++;
			m = max(m,count);
		} else {
			count = 0;
		}
	}
	cout << m << endl;
	return 0;
}


int main()
{
    int n, ai, bi, sum=0, num[100];
    cin >> n;
    for (int j=0; j<n; j++)
    {
        cin >> ai >> bi;
        if(ai>=90 & ai<=140 & bi>=60 & bi<=90  )
            sum = sum + 1;

        else
            sum = 0;

        num[j] = sum;
    }

     if(n<=1)
          cout << sum << endl;
     else
       {  for (int j=1; j<n; j++)
        {
            if(num[j] < num[j-1])
                num[j]=num[j-1];
        }
          cout << num[n-1] << endl;
        }

    return 0;

}


//
//  main.cpp
//  10.15 homework
//   ????

//  Created by airjcy on 10/8/12.
//  Copyright (c) 2012 airjcy. All rights reserved.
//

int main(int argc, const char * argv[])
{
    int n;
    cin >> n;
    int i;
    int lowPressure,highPressure;
    int maxContinueNormalHours = 0;
    int continueNormalHours = 0;
    for (i = 0; i < n; i++) {
        cin >> highPressure >> lowPressure;
        if ((highPressure >= 90)&&(highPressure <= 140)&&(lowPressure >= 60)&&(lowPressure <= 90)) {
            continueNormalHours ++;
            if (continueNormalHours > maxContinueNormalHours) {
                maxContinueNormalHours = continueNormalHours;
            }
        }
        else
            continueNormalHours = 0;
    }
    cout << maxContinueNormalHours;
}


int main()
{
	int n, time = 0, i, max = 0;
	int hi, lo;

	scanf("%d", &n);

    for(i = 1; i <= n; i++)
	{
		scanf("%d %d", &hi, &lo);
		if( ( hi >= 90 ) * ( hi <= 140 ) * ( lo <= 90 ) * ( lo >= 60 ) == 1 )
		    time = time + 1;
        else
        {
             if( time > max )
                 max = time;
             time = 0;
        }

        if( i == n && time > max)
            max = time;

    }

    printf("%d", max);

    return 0;

 }


int main()
{
	int n,a,b,p,c;
         int d=0;
	int i=0;
	int max(int x,int y);
	scanf("%d",&n);//????n
	for(p=1;p<=n;p++)
	{
		scanf("%d %d ",&a,&b);//????
		if(90<=a&a<=140)
		{
			if(60<=b&b<=90)
			{
				i=i+1;
			}
			else
			{
				i=0;
			}
		}
		else
		{
			i=0;
		}
		c=i;
		d=max_int(d,c);
	}
	printf ("%d\n",d);
	return 0;
}
int max_int(int x,int y)
{
	int z;
	if(x>y)
	{
		z=x;
	}
	else
	{
		z=y;
	}
	return(z);
}


int main(){
	int n;scanf("%d",&n);
	int xueya[101][2],outcome[101];
	int i;
	for(i=0;i<n;i++){
		scanf("%d%d",&xueya[i][0],&xueya[i][1]);
		if(xueya[i][0]>=90 && xueya[i][0]<=140 && xueya[i][1]>=60 && xueya[i][1]<=90)
			outcome[i]=1;
		else
			outcome[i]=0;
	}

	int j=0,k=0,m;
	int count[101];
	for(m=0;m<n;m++){
		if(outcome[m]==1)	count[m]=1;
		else count[m]=0;
	}
	for(j=0;j<n;j++){
		if(outcome[j]==1){
			for(k=j+1;k<n && outcome[k]==1;k++){
				count[j]++;
			}
		}
	}

	int p,q,t;
	for(p=n-1;p>0;p--){
		for(q=0;q<p;q++){
			if(count[q]>=count[q+1]){
				t=count[q];
				count[q]=count[q+1];
				count[q+1]=t;
			}
		}
	}
	printf("%d\n",count[n-1]);
	return 0;
}


int main(){
	int nu;
	scanf("%d\n",&nu);
	struct aaa{
		int x,y;
	}time[100];
	int i;
	int h=0;
	int m=0;
	int s=0;
	for(i=0;i<nu;i++){
		scanf("%d%d",&(time[i].x),&(time[i].y));
	}
	for(i=0;i<nu;i++){
		if((time[i].x)<=140&&(time[i].x)>=90&&(time[i].y)<=90&&(time[i].y)>=60){
			h+=1;
			s=h;
		}else if(m<=h){
			m=h;
			h=0;
			continue;
		}else if(m>=h){
			h=0;
			continue;
		}
	}
	if(s>=m){
		printf("%d",s);
	}else{
        printf("%d\n",m);}
		return 0;
}


void bubble_sort(int a[],int n)
{
	int i,k,t;
	for (k=n-1;k>0;k--){
		for (i=0;i<k;i++){
			if (a[i]<a[i+1]){
				t=a[i];
				a[i]=a[i+1];
				a[i+1]=t;
			}
		}
	}
}

int main()
{
	int n;
	int shousuo,shuzhang;
	int i,j,k;
	int a[100];
	int b[100];
	scanf("%d",&n);
	j=0;
	for (i=0;i<100;i++){
		a[i]=0;
		b[i]=0;
	}
	for (i=0;i<n;i++){
		scanf("%d%d",&shousuo,&shuzhang);
		if (shousuo>=90&&shousuo<=140&&shuzhang>=60&&shuzhang<=90) a[i]=1;
			else a[i]=0;
	}
    for (i=0;i<n;i++){
		switch(a[i]){
		    case 1:
            b[j]++;
			break;
			default:
				j++;
		}
	}
    bubble_sort(b,99);
	printf("%d",b[0]);
	return 0;
}


int normal(int,int);
int main()
{
	int n,i,k=0;
	int shou,shu,max;
	int sz[1000]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d",&shou,&shu);
		if(normal(shou,shu))
		{
			sz[k]++;
		}
		else
		{
			k++;
		}
	}
	max=sz[0];
	for(i=0;i<=k;i++)
	{
		if(sz[i]>max)
		{
			max=sz[i];
		}
	}
	printf("%d",max);
	return 0;
}
int normal(int shou,int shu)
{
	if(shou<=140&&shou>=90&&shu<=90&&shu>=60)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}


int panduan(int a,int b)
{
   if(a>=90&&a<=140&&b>=60&&b<=90)return 1;
   else return 0;
}
int main()
{
    int n,res,temp,a,b;
    res=0;
    temp=0;
    cin>>n;
    while(n--)
    {
       cin>>a>>b;
       if(panduan(a,b))temp+=1;
       else
       {
          if(temp>res)res=temp;
          temp=0;
       }
     }
     if(temp>res)res=temp;
     cout<<res<<endl;
return 0;
}


int main(){
	int n;
	scanf("%d\n",&n);
	int i=1;
	int m=0;
	int max=0;
	while(i<=n){
		int s,z;
		scanf("%d%d",&s,&z);
		if(s>=90&&s<=140&&z<=90&&z>=60){
			m=m+1;
		}else{
			if(max>m){
				max=max;

			}else{
				max=m;
			}
			m=0;
		}
		i=i+1;}
	if(max>m){
				max=max;

			}else{
				max=m;
			}
	printf("%d",max);
return 0;}


int main()
{
	int n,i,hour,answer,k,p;
	int sys[100];
	int dia[100];
	int hours[100];
	//???????sys???????dia???????hours???????
	scanf("%d",&n);
	for(i=1,k=0,hour=0;i<=n;i++)
	{
		scanf("%d%d",&sys[i],&dia[i]);
		if(sys[i]<=140&&sys[i]>=90&&dia[i]<=90&&dia[i]>=60)
		{
			hour+=1;
			if(hour>k)
				k=hour;
			else
				k=k;
		}
		else
			hour=0;
		hours[i]=hour;
	}
	hours[0]=0;
	for(i=1,answer=0;i<=n;i++)
	{
		if(hours[i]>=hours[i-1])
			answer=hours[i];
		else
			answer=answer;
	}
	answer=k;
	printf("%d\n",answer);
	return 0;
}


int main()
{
	int n=0;
	int h=0,l=0;
	cin>>n;
	int time=0;
	int max=0;
	for(int i=0;i<n;i++)
	{
		cin>>h>>l;
		if(h>=90&&h<=140&&l>=60&&l<=90)
		{
			time++;
			if(time>max)
				max=time;
		}
		else
			time=0;
	}
	printf("%d\n",max);
	return 0;
}


int OK(int a,int b);
int max(int a[],int n);
int n,high[100],low[100],length[100];
int main(){
int i,t=0;
scanf("%d",&n);
for(i=0;i<100;i++)
length[i]=0;
for(i=0;i<n;i++)
scanf("%d%d",&high[i],&low[i]);
for(i=0;i<n;i++)
if (OK(high[i],low[i])==1)
switch(OK(high[i+1],low[i+1])){
case 1:length[t]+=1;break;
case 0:length[t++]+=1;
}
printf("%d",max(length,t));
return 0;
}
int OK(int a,int b)
{return a>=90&&a<=140&&b>=60&&b<=90;}
int max(int a[],int n)
{
int i,max;
max=a[0];
for(i=1;i<n;i++)
if(max<a[i])
max=a[i];
return max;}


int x[100],y[100];
int main()
{
	int n,i,j,hour,maxhour;
	hour=0;
	maxhour=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			scanf("%d %d\n",&x[i-1],&y[j-1]);
			if(x[i-1]>=90&&x[i-1]<=140&&y[j-1]>=60&&y[j-1]<=90)
			{
			hour++;
			}else{
				if(maxhour<hour)
				{maxhour=hour;
			}hour=0;
			}
		}
	}
	if(maxhour<hour)
	{maxhour=hour;
	}
	printf("%d",maxhour);
return 0;
}


int main()
{
	int n,n1,n2,i,h,hmax;
	cin>>n;
	h=0;
	hmax=h;
    for(i=1;i<=n;i=i+1)
	{
		cin>>n1>>n2;
			if(n1>=90&&n1<=140&&n2>=60&&n2<=90)
			{
				h=h+1;
			}
			else
			{
				if(h>hmax)
				{
					hmax=h;
				    h=0;
				}
			else
			{
				hmax=hmax;
			    h=0;
			}
			} continue;
	}
	if(h>hmax)
	{
		hmax=h;
	}
	else
	{
		hmax=hmax;
	}
	cout<<hmax<<endl;
	return 0;
}


int main()
{
	int n,sp[101],dp[101],d[101],h=0,max=0;//ps=systolic pressure,pd=diabolic pressure
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&sp[i],&dp[i]);
		if(sp[i]>=90&&sp[i]<=140&&dp[i]>=60&&dp[i]<=90){
			h++;
			d[i]=h;
		}
		else
			d[i]=h=0;
	}

//now for the maximum of duration//

	for(j=1;j<=n;j++){
		if(max>=d[j])
			continue;
		else
			max=d[j];
	}
	printf("%d\n",max);
}


int main()
{
	int n,i,j;
	int normalcnt=0;
	int normalstt=0;
	int tempcnt=0;

	scanf("%d", &n);
	while(n--)
	{
		int a,b;
		int curnml=0;
		scanf("%d%d", &a, &b);
		if (a>=90 && a<=140 && b>=60 && b<=90)
			curnml=1;
		else
			curnml=0;

		if (normalstt)
		{
			//????
			if (curnml)	//????
				tempcnt++;
			else //????
			{
				if(tempcnt>normalcnt)
					normalcnt=tempcnt;
				normalstt=0;
				tempcnt=0;
			}
		}
		else
		{
			//?????
			if(curnml)//???
			{
				normalstt=1;
				tempcnt++;
			}
		}
	}

	//????????
	if(normalstt&&tempcnt>normalcnt)
		normalcnt=tempcnt;

	printf("%d",normalcnt);

	return 0;
}


int main(int argc, char* argv[])
{
	int i,n,high,low,number,k;
	scanf("%d",&n);
	number=0;
	k=0;
	for(i=1;i<=n;i++){
		scanf("%d %d",&high,&low);
		if((high<=140)&&(high>=90)&&(low>=60)&&(low<=90)){
			number+=1;
		}else{
			if(k<number){
				k=number;
			};
			number=0;
			continue;
		}
		if(k<number){
			k=number;
		};
	}
	printf("%d",k);
	return 0;
}


int main(){
    int n;
    scanf("%d",&n);
    int shou[n];
    int zhang[n];
    for(int i=0;i<n;i++){
        scanf("%d %d",&(shou[i]),&(zhang[i]));
    }
    int a=0;
    int e=0;
     for(int i=0;i<n;i++){
       if(shou[i]>=90&&shou[i]<=140&&zhang[i]>=60&&zhang[i]<=90){
           a++;
           if(a>e){e=a;}
       }else{a=0;}
    }
    printf("%d",e);
    return 0;
}


int main()
{
    int i,n,shousuoya,shuzhangya,hour=0,c=0;
    cin >> n;

  for(i=1;i<=n;i++)
 {
   cin >> shousuoya >> shuzhangya;
   if(shousuoya>=90 && shousuoya<=140 && shuzhangya>=60 && shuzhangya<=90)
   {
    hour+=1;
   }
   else
   {
    if(hour>=c)
    {
      c=hour;
      hour=0;
    }
    else
   {
     hour=0;
    }
   }
 }
if(hour>=c)
 {
   c=hour;
 }
 cout << c << endl;
return 0;
}


int main()
{
	int n,i,time,max;
	time=0;
	max=0;
	scanf("%d",&n);
	int a,b;
	for(i=1;i<=n;i++)
	{
		scanf("%d %d",&a,&b);
		if(a>=90&&a<=140&&b>=60&&b<=90)
		{
		time++;
			if(time>max)
			{
		    max=time;
			}
			else
			{
			max=max;
			}

		}
		else
		{
			if(time>max)
			{
		    max=time;
			}
			else
			{
			max=max;
			time=0;
			}
		}
	}
	printf("%d",max);
	return 0;
}


int main()
{
	int hour[101] ={0}, high, low;
	int n;
	cin >> n;
	int num = 1;
	for(int i = 0; i < n; i++)
	{
		cin >> high >> low;
		if( high >= 90 && high <= 140 && low >= 60 && low <= 90 )
			hour[num] ++;
		else
			num ++;
	}
	int max = 0;
	for(int i = 1; i <= num; i++)
	{
		if( hour[i] > max )
			max = hour[i];
	}
	cout << max << endl;
	return 0;
}


int main(int argc, char* argv[])
{
	int n,plow,phigh,k,i,m;
	scanf("%d",&n);
	for(i=1,k=0,m=0;i<=n;i++){
	scanf("%d %d",&phigh,&plow);
	if((plow>=60)&&(plow<=90)&&(phigh>=90)&&(phigh<=140)){
	k++;}
	else{
		if(k>m){
	m=k;
	k=0;
	}
		else{
	k=0;}
	}}
	if(k>m){
		m=k;}
	printf("%d",m);
	return 0;
}


int main()

{
  int i,j,n,k,a[100],shousuo,shuzhang;
  scanf("%d\n",&n);
  j=0;
  k=0;
  for(i=0;i<n;i++) a[i]=0;
  for(i=1;i<=n;i++)
  {
		scanf("%d%d",&shousuo,&shuzhang);
		if(90<=shousuo&&shousuo<=140)
		{
		   if(60<=shuzhang&&shuzhang<=90)
				a[j]=a[j]+1;
		   else
		   	   j=j+1;

		}

		else
		j=j+1;

  }
  for(i=0;i<n;i++)
  {
    if(k<a[i]) k=a[i];
  }
  printf("%d\n",k);
}


int main(){
	int n;
	int shifou[100];
	int a,b;
	int shijian[100];
	int i,j=0;
	int k;
	for(i=0;i<100;i++){
		shijian[i]=0;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&a,&b);
		if(a>=90&&a<=140&&b>=60&&b<=90){
			shifou[i]=1;
		}
		else{
			shifou[i]=0;
		}
	}
	for(i=0;i<n;i++){
		if(shifou[i]==1){
			shijian[j]+=1;
		}else{
			j++;
		}
	}
	k=j+1;
	int e;
	for(j=1;j<k;j++){
		for(i=0;i<k-j;i++){
			if(shijian[i]<shijian[i+1]){
				e=shijian[i];
				shijian[i]=shijian[i+1];
				shijian[i+1]=e;
			}
		}
	}
	printf("%d",shijian[0]);
	return 0;
}


int main(){
	int n;
	cin>>n;
	int count,max=0,i=0;
	while(i<n){
		count=0;
		int h,l;
		for(int j=i;j<n;j++){
			cin>>h>>l;
			if((h>140||h<90)||(l>90||l<60)){
				i++;
				break;
			}
			else{
				count++;
				if(count>max) max=count;
				i++;
			}
		}
	}
	cout<<max;
	return 0;
}


int main(){
	int n;
	int a,b;
	int sum=0;
	int i;
	int c=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if(a>=90&&a<=140&&b>=60&&b<=90){
			sum++;
		}
		else{
			if(sum>c){
				c=sum;
			}
			sum=0;
		}
	}
	if(c>=sum){
	printf("%d",c);
	}
	if(c<sum){
		printf("%d",sum);
	}

	return 0;
}


int main()
{
    int i,n,shrink,diastole,normal=0,max=0;
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%d %d",&shrink,&diastole);
        if(shrink>=90&&shrink<=140&&diastole>=60&&diastole<=90)
		{
			if(i==n-1)
			{
				normal++;
				if(normal>max)
				max=normal;
			}
			else
				normal++;
		}
		else
		{
			if(normal>max)
				max=normal;
			normal=0;
		}
	}
	printf("%d\n",max);
}


/**
*@file 6.cpp
*@author ???
*@date 2013-10-24
*@description ????
*/

int main()
{
    int n, high, low, pre, hour;
    cin >> n;
    pre=0;
    hour=0;
    while(n--)
 {
    scanf("%d %d",&high,&low);
    if(high>=90&&high<=140&&low>=60&&low<=90)
    pre++;
    if(!(high>=90&&high<=140&&low>=60&&low<=90))
    pre=0;
    hour=pre>=hour?pre:hour;
 }

    cout << hour << endl;
    return 0;
}


int main()
{
	int n,i,shousuo[101],shuzhang[101],xiaoshi[101],k=0,t;
scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d%d",&shousuo[i],&shuzhang[i]);
		}
				for(i=0;i<n;i++){
xiaoshi[i]=0;
				}
		for(i=0;i<n;i++){
			if(shousuo[i]<=140&&shousuo[i]>=90&&shuzhang[i]<=90&&shuzhang[i]>=60){
xiaoshi[k]++;
			}else{
k++;
			}
		}
		for(i=0;i<n;i++){
			if(xiaoshi[i]>xiaoshi[0]){
t=xiaoshi[0];
xiaoshi[0]=xiaoshi[i];
xiaoshi[i]=t;
		}
		}
		printf("%d",xiaoshi[0]);
	return 0;
		}


int main()
{
    int i,n;
    scanf("%d",&n);
    int shousuo[101],shuzhang[101],count,Max,a[101];
    for(i=0;i<n;i++){
        scanf("%d %d",&shousuo[i],&shuzhang[i]);
        if(shousuo[i]>=90&&shousuo[i]<=140&&60<=shuzhang[i]&&90>=shuzhang[i]){
            a[i+1]=1;
        }else{a[i+1]=0;}
    }
    a[0]=0;
    Max=0;
    count=0;
    for(i=1;i<n+1;i++){
        if(a[i-1]==0&&a[i]==1){
            count=1;
        }else if(a[i-1]==1&&a[i]==1){
            count=count+1;
        }
            if(Max<count){
                Max=count;
            }

    }
    printf("%d",Max);
    return 0;
}


int main(){
	int n,i;
	scanf("%d",&n);
	struct press{
		int a,b;
	}press[100];
	for(i=0;i<n;i++){
		scanf("%d%d",&(press[i].a),&(press[i].b));
	}
	int normal=0,max=0;
	for(i=0;i<n;i++){
		if(press[i].a>=90&&press[i].a<=140&&press[i].b>=60&&press[i].b<=90){
			normal++;
		}else{
			if(normal>max){
				max=normal;
			}
			normal=0;
		}
	}
	if(normal>max){
		max=normal;
	}
	printf("%d",max);
	return 0;
}


void arrange(int *arrangearry,int nt,int kd_order)
{
	int flagi,flagj,temporary;
	if(kd_order==1)
	{
		for(flagi=nt-1;flagi>0;flagi--)
		{
			for(flagj=0;flagj<flagi;flagj++)
			{
				if(arrangearry[flagj]<arrangearry[flagj+1])
				{
					temporary=arrangearry[flagj];
					arrangearry[flagj]=arrangearry[flagj+1];
					arrangearry[flagj+1]=temporary;
				}
			}
		}
	}
}
int main()
{
	int n,ss[100],sz[100],i,j=0,h[100]={0};
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>ss[i]>>sz[i];
		if(ss[i]>=90&&ss[i]<=140&&sz[i]>=60&&sz[i]<=90) h[j]++;
		else j++;
	}
	arrange(h,100,1);
	cout<<h[0];
	return 0;
}


int main()
{
	int n,pressure[100][2],time[100],j=0,maxtime;
	cin>>n;
	for(int k=0;k<100;k++)
		time[k]=0;
	for(int i=0;i<n;i++)
		{
			cin>>pressure[i][0]>>pressure[i][1];
			    if((pressure[i][0]>=90)&&(pressure[i][0]<=140)&&(pressure[i][1]<=90)&&(pressure[i][1]>=60))
					time[j]++;
				else
					j++;
	    }
	maxtime=time[0];
	for(int m=0;m<100;m++)
	{
		if(maxtime<time[m])
			maxtime=time[m];
	}
	cout<<maxtime<<endl;
	return 0;
}


int main(){
	struct suoyou{
		int qian;
		int hou;
	}suoyous[100];
	int i,k;
	int n,m=0;
	int s=0,e=0;
	int hao[100];
	for(i=0;i<100;i++){
		hao[i]=0;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&suoyous[i].qian,&suoyous[i].hou);
	}
	for(i=0;i<n;i++){
		if(suoyous[i].qian>=90&&suoyous[i].qian<=140&&suoyous[i].hou>=60&&suoyous[i].hou<=90){
			s=i;
			e=i+1;
			while(suoyous[e].qian>=90&&suoyous[e].qian<=140&&suoyous[e].hou>=60&&suoyous[e].hou<=90){
				e+=1;
			}
		}
		hao[m]=e-s;
		m++;
	}
	for(i=1;i<=m;i++){
		for(k=0;k<m-i;k++){
			if(hao[k]<hao[k+1]){
				e=hao[k];
				hao[k]=hao[k+1];
				hao[k+1]=e;
			}
		}
	}
	printf("%d",hao[0]);
	return 0;
}


int main (){
 int max=0,sum=0;
int i,n;
int ss[100],sz[100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
	  scanf("%d %d",&ss[i],&sz[i]);

    }

  for(i=0;i<n;i++){

	  if(ss[i]>=90&&ss[i]<=140&&sz[i]>=60&&sz[i]<=90){

	   sum++;}
	  else{
		  max=max>=sum? max:sum;
		  sum=0;
		  continue;
	     }
  }
  max=max>=sum? max:sum;
printf("%d",max);
return 0;
}


int main()
{
  int n,k,sum=0,a,b,max=0;
  int i,result=0;
  scanf("%d",&n);
  for (i=1;i<=n;i++)
  {
      scanf("%d %d",&a,&b);
      if (a>=90 && a<=140 && b>=60 && b<=90)
                 sum++;
                 else {
                      if (sum>max) max=sum;
                      sum=0;
}
}
if (sum>max) max=sum;
 printf("%d",max);
  return 0;
}


int main()
{
	int n,a,b,i;
	int count=0,t=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d %d",&a,&b);
		if (a>=90 && a<=140 && b>=60 && b<=90)
			count++;
		else
			if (count>t)
			{
				t=count;
				count=0;
			}
			else
				count=0;
	}
	if (count>t)
	{
		printf("%d\n",count);
	}
	else
	{
		printf("%d\n",t);
	}
	return 0;
}


int main(){
	int n,ss,sz,i;
	int max=0,lj=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&ss,&sz);
		if(ss<=140&&ss>=90&&sz>=60&&sz<=90)
			lj++;
		else{
			if(lj>max)
				max=lj;
			lj=0;
		}
	}
	if(lj>max)
		max=lj;
	printf("%d",max);
	return 0;
}


int main()
{
	int hours;
	cin >> hours;
	int maxNormHours = 0;
	int normHours = 0;
	for (int i=1 ; i<= hours ; i++)
	{
		int max,min;
		cin >> max >> min;
		if ((max >= 90) && (max <= 140)&&
			(min <= 90) && (min >= 60) == 1)
			normHours ++;
		else
		{
			if (normHours > maxNormHours)
				maxNormHours = normHours;
			normHours = 0;
		}
	}
	if (normHours > maxNormHours)
	maxNormHours = normHours;
	cout << maxNormHours << endl;
	cin.get();
	cin.get();
	return 0;
}


int main()
{
    int a,b,n,hours1=0,hours2=0,max,i=1;
    scanf("%d",&n);
    for(i=1;i<=n;i=i+1)
	{
		scanf("%d %d",&a,&b);
        if(a>=90&&a<=140&&b>=60&&b<=90)
        hours1=hours1+1;
        else
			if(hours2<=hours1)
		{
				hours2=hours1;
                hours1=0;
		}
			else
				hours1=0;
	}
    if(hours1>hours2)
    max=hours1;
    else
    max=hours2;
    printf("%d",max);
    return 0;
}


int main(){
    int n,a,b,result=0,i=1,max=0;
    scanf("%d",&n);
    while(i<=n){
    scanf("%d%d",&a,&b);
    if(a>=90&&a<=140&&b>=60&&b<=90){
    result+=1;
    i++;
    }else{
    if(result>max){
    max=result;
    result=0;
    i++;}
    else{
    result=0;
    i++;}
    }
    }
    if(result>max){
       max=result;}
    printf("%d",max);
    return 0;
}


void main()
{
	int n,i,t;
	int xuefen[10],chengji[10];
	float xuefenjidian[10],jidian[10],sum1=0,sum2=0,zongping;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&xuefen[i]);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&chengji[i]);
	}
	for(i=0;i<n;i++)
	{
		if(chengji[i]>=90&&chengji[i]<=100)
	jidian[i]=4.0;
		else if(chengji[i]>=85&&chengji[i]<=89)
		jidian[i]=3.7;
		else if(chengji[i]>=82&&chengji[i]<=84)
		jidian[i]=3.3;
		else if(chengji[i]>=78&&chengji[i]<=81)
		jidian[i]=3.0;
		else if(chengji[i]>=75&&chengji[i]<=77)
		jidian[i]=2.7;
		else if(chengji[i]>=72&&chengji[i]<=74)
			jidian[i]=2.3;
		else if(chengji[i]>=68&&chengji[i]<=71)
			jidian[i]=2.0;
		else if(chengji[i]>=64&&chengji[i]<=67)
		jidian[i]=1.5;
		else if(chengji[i]>=60&&chengji[i]<=63)
		jidian[i]=1.0;
		else if(chengji[i]>=0&&chengji[i]<=59)
		jidian[i]=0;
		xuefenjidian[i]=xuefen[i]*jidian[i];
	}
	for(i=0;i<n;i++)
	{
		sum1=sum1+xuefenjidian[i];
		sum2=sum2+xuefen[i];
	}
	zongping=sum1/sum2;
	printf("%.2f",zongping);
}


float GradePoint(int marks)
{
	if(marks>=90&&marks<=100)
		return 4.0;
	else if(marks>=85&&marks<=89)
		return 3.7;
	else if(marks>=82&&marks<=84)
		return 3.3;
	else if(marks>=78&&marks<=81)
		return 3.0;
	else if(marks>=75&&marks<=77)
		return 2.7;
	else if(marks>=72&&marks<=74)
		return 2.3;
	else if(marks>=68&&marks<=71)
		return 2.0;
	else if(marks>=64&&marks<=67)
		return 1.5;
	else if(marks>=60&&marks<=63)
		return 1.0;
	else
		return 0;

}
void main()
{
	int n,i,count=0;
	int *XueFen,*Marks;
	float GPA=0;
	scanf("%d",&n);
	XueFen=(int*)malloc(sizeof(int)*n);
	Marks=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&XueFen[i]);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&Marks[i]);
	}

	for(i=0;i<n;i++)
	{
		GPA=GPA+XueFen[i]*GradePoint(Marks[i]);
		count+=XueFen[i];
	}
	printf("%3.2f",GPA/count);

}


int main()
{
    int n, c;
    float b, GPAN;
    int i;
    int xuefen[10], score[10];
    float GPA[10];
    float GPAbiao[] = {4.0, 3.7, 3.3, 3.0, 2.7, 2.3, 2.0, 1.5, 1.0, 0};
	b = 0;
	c = 0;
    scanf("%d", &n);
    for(i=0;i<n;i++)
        scanf("%d", &xuefen[i]);
    for(i=0;i<n;i++)
        scanf("%d", &score[i]);
    for(i=0;i<n;i++)
      {
          if(score[i]>=90) GPA[i] = GPAbiao[0] * xuefen[i];
          else if(score[i]>=85&&score[i]<90) GPA[i] = GPAbiao[1] * xuefen[i];
          else if(score[i]>=82&&score[i]<85) GPA[i] = GPAbiao[2] * xuefen[i];
          else if(score[i]>=78&&score[i]<82) GPA[i] = GPAbiao[3] * xuefen[i];
          else if(score[i]>=75&&score[i]<78) GPA[i] = GPAbiao[4] * xuefen[i];
          else if(score[i]>=72&&score[i]<75) GPA[i] = GPAbiao[5] * xuefen[i];
          else if(score[i]>=68&&score[i]<72) GPA[i] = GPAbiao[6] * xuefen[i];
          else if(score[i]>=64&&score[i]<68) GPA[i] = GPAbiao[7] * xuefen[i];
          else if(score[i]>=60&&score[i]<64) GPA[i] = GPAbiao[8] * xuefen[i];
          else GPA[i] = GPAbiao[9] * xuefen[i];
      }
    for(i=0;i<n;i++)
    {
        b = b + GPA[i];
        c = c + xuefen[i];
    }
    GPAN = b/c;
    printf("%.2f", GPAN);
    return 0;
}


void main()
{
	int credit[100],score[100];
	float point[100];
	int n,i;
	float sum=0,sum1=0,average;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&credit[i]);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",&score[i]);
	}
	for(i=0;i<n;i++)
	{
		if(score[i]<=100&&score[i]>=90)
			point[i]=4.0;
		else if(score[i]<=89&&score[i]>=85)
			point[i]=3.7;
		else if(score[i]<=84&&score[i]>=82)
			point[i]=3.3;
		else if(score[i]<=81&&score[i]>=78)
			point[i]=3.0;
		else if(score[i]<=77&&score[i]>=75)
			point[i]=2.7;
		else if(score[i]>=72&&score[i]<=74)
			point[i]=2.3;
		else if(score[i]>=68&&score[i]<=71)
			point[i]=2.0;
		else if(score[i]>=64&&score[i]<=67)
			point[i]=1.5;
		else if(score[i]>=60&&score[i]<=63)
			point[i]=1.0;
		else if(score[i]>=0&&score[i]<=59)
			point[i]=0;
		else
			printf("error");
	}
	for(i=0;i<n;i++)
	{
		sum=sum+credit[i]*point[i];
	}
	for(i=0;i<n;i++)
	{
		sum1=sum1+credit[i];
	}
	average=sum/sum1;
	printf("%.2f",average);
}


float jd(int x){
      if (x>=90&&x<=100) return 4;
      if (x>=85) return 3.7;
      if (x>=82) return 3.3;
      if (x>=78) return 3;
      if (x>=75) return 2.7;
      if (x>=72) return 2.3;
      if (x>=68) return 2.0;
      if (x>=64) return 1.5;
      if (x>=60) return 1.0;
      return 0;
}
int main(){
    int n,i;
	int xuefen[100];
	int xuefensum;
	float score,GPA,scoresum;
	scanf("%d",&n);
	xuefensum=0;
	scoresum=0;
	for(i=0;i<n;i++){
		scanf("%d ",&xuefen[i]);
	    xuefensum=xuefensum+xuefen[i];
	}
	for(i=0;i<n;i++){
		scanf("%f",&score);
		scoresum=scoresum+jd(score)*xuefen[i];
	}
	GPA=scoresum/xuefensum;
	printf("%.2f",GPA);
	return 0;
}


struct grade
{
	int classgrade;
	int finalgrade;
	double GPA;
}G[100];

int main()
{
	int n, i;
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{
		scanf("%d ", &G[i].classgrade);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d", &G[i].finalgrade);
	}
	for(i=0;i<n;i++)
	{
		if((G[i].finalgrade>=90)&&(G[i].finalgrade<=100))
			G[i].GPA=G[i].classgrade*4.0;
		if((G[i].finalgrade>=85)&&(G[i].finalgrade<=89))
			G[i].GPA=G[i].classgrade*3.7;
		if((G[i].finalgrade>=82)&&(G[i].finalgrade<84))
			G[i].GPA=G[i].classgrade*3.3;
		if((G[i].finalgrade>=78)&&(G[i].finalgrade<=81))
			G[i].GPA=G[i].classgrade*3.0;
		if((G[i].finalgrade>=75)&&(G[i].finalgrade<=77))
			G[i].GPA=G[i].classgrade*2.7;
		if((G[i].finalgrade>=72)&&(G[i].finalgrade<=74))
			G[i].GPA=G[i].classgrade*2.3;
		if((G[i].finalgrade>=68)&&(G[i].finalgrade<=71))
			G[i].GPA=G[i].classgrade*2.0;
		if((G[i].finalgrade>=64)&&(G[i].finalgrade<=67))
			G[i].GPA=G[i].classgrade*1.5;
		if((G[i].finalgrade>=60)&&(G[i].finalgrade<=63))
			G[i].GPA=G[i].classgrade*1.0;
		if(G[i].finalgrade<=60)
			G[i].GPA=0;
	}
	double allG=0;
	double allcG=0;
	for(i=0;i<n;i++)
	{
		allG=allG+G[i].GPA;
	}
	for(i=0;i<n;i++)
	{
		allcG=allcG+G[i].classgrade;
	}
	float g=allG/allcG;
	printf("%.2f", g);
	return 0;
}


void main()
{int n,i,d=0,a[10],b[10];float c=0;float f(int x);
	scanf("%d",&n);for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++)scanf("%d",&b[i]);
	for(i=0;i<n;i++){c=c+a[i]*f(b[i]);d=d+a[i];}
	printf("%.2f",c/d);
}
float f(int x)
{if(x>=90)return 4.0;else if(x>=85)return 3.7;
	else if(x>=82)return 3.3;else if(x>=78)return 3.0;else if(x>=75)return 2.7;
	else if(x>=72)return 2.3;else if(x>=68)return 2.0;else if(x>=64)return 1.5;
	else if(x>=60)return 1.0;else return 0;}


int main (){
	int n,i;
	double GPA=0;
	int sum=0;
	double score[10];
	int point[10];
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		scanf("%d",&(point[i]));}
    for(i=0;i<n;i++){
		scanf("%lf",&(score[i]));}
    for(i=0;i<n;i++){
		if(score[i]>=90&&score[i]<=100){
			score[i]=4.0;}
		else if(score[i]>=85&&score[i]<=89){
			score[i]=3.7;}
		else if(score[i]>=82&&score[i]<=84){
			score[i]=3.3;}
		else if(score[i]>=78&&score[i]<=81){
			score[i]=3.0;}
		else if(score[i]>=75&&score[i]<=77){
			score[i]=2.7;}
		else if(score[i]>=72&&score[i]<=74){
			score[i]=2.3;}
		else if(score[i]>=68&&score[i]<=71){
			score[i]=2.0;}
		else if(score[i]>=64&&score[i]<=67){
			score[i]=1.5;}
		else if(score[i]>=60&&score[i]<=63){
			score[i]=1.0;}
		else if(score[i]<60){
			score[i]=0.0;}
		GPA+=1.0*score[i]*point[i];
	}
    for(i=0;i<n;i++){
		sum+=point[i];}
	GPA/=sum;
	printf("%.2lf",GPA);
	return 0;
}


int main ()
{
 int xuefen[10],fenshu[10],n;
 float jidian[10],GPA;
 float jidianhe=0.0;
 int xuefenhe=0;
 int i;
 scanf ("%d",&n);
 for (i=0;i<n;i++)
 {
  scanf ("%d",&(xuefen[i]));
  xuefenhe+=xuefen[i];
 }
    for (i=0;i<n;i++)
 {
  scanf ("%d",&(fenshu[i]));
 }
 for (i=0;i<n;i++)
    {
  if (fenshu[i]<=100&&fenshu[i]>=90)
  {
   jidian[i]=4.0f;
  }
  else if (fenshu[i]<=89&&fenshu[i]>=85)
  {
   jidian[i]=3.7f;
  }
  else if (fenshu[i]<=84&&fenshu[i]>=82)
  {
   jidian[i]=3.3f;
  }
  else if (fenshu[i]<=81&&fenshu[i]>=78)
  {
   jidian[i]=3.0f;
  }
  else if (fenshu[i]<=77&&fenshu[i]>=75)
  {
   jidian[i]=2.7f;
  }
  else if (fenshu[i]<=74&&fenshu[i]>=72)
  {
   jidian[i]=2.3f;
  }
  else if (fenshu[i]<=71&&fenshu[i]>=68)
  {
   jidian[i]=2.0f;
  }
  else if (fenshu[i]<=67&&fenshu[i]>=64)
  {
   jidian[i]=1.5f;
  }
  else if (fenshu[i]<=63&&fenshu[i]>=60)
  {
   jidian[i]=1.0f;
  }
  else jidian[i]=0;

    jidianhe+=jidian[i]*((float )xuefen[i]);
 }

 GPA=jidianhe/(float )xuefenhe;
 printf("%.2f",GPA);
 return 0;
}


int main(){
	int xuefen[10],fenshu[10];
	int n;
	int a=0;
	float jidian[10],sum=0,m,GPA;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&xuefen[i]);
		a+=xuefen[i];
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",&fenshu[i]);
		if(fenshu[i]>=90&&fenshu[i]<=100)
		{jidian[i]=4.0;}
		if(fenshu[i]>=85&&fenshu[i]<=89)
		{jidian[i]=3.7;}
		if(fenshu[i]>=82&&fenshu[i]<=84)
		{jidian[i]=3.3;}
		if(fenshu[i]>=78&&fenshu[i]<=81)
		{jidian[i]=3.0;}
		if(fenshu[i]>=75&&fenshu[i]<=77)
		{jidian[i]=2.7;}
		if(fenshu[i]>=72&&fenshu[i]<=74)
		{jidian[i]=2.3;}
		if(fenshu[i]>=68&&fenshu[i]<=71)
		{jidian[i]=2.0;}
		if(fenshu[i]>=64&&fenshu[i]<=67)
		{jidian[i]=1.5;}
		if(fenshu[i]>=60&&fenshu[i]<=63)
		{jidian[i]=1.0;}
		if(fenshu[i]<=60)
		{jidian[i]=0;}
		m=xuefen[i]*jidian[i];
		sum+=m;
	}
	GPA=sum/a;
	printf("%.2f",GPA);
	return 0;
}


int Xuefen(int xuefen[], int n){
    int sumxuefen=0;
    for(int i=0;i<n;i++){
         sumxuefen=sumxuefen+xuefen[i];
    }
    return sumxuefen;
}
double Jidian(int defen[], int xuefen[], int n){
    double sumjidian=0;
    double jidian[1000];
    for(int i=0;i<n;i++){
        if(defen[i]>=90&&defen[i]<=100){
            jidian[i]=4.0*xuefen[i];
        }
        if(defen[i]>=85&&defen[i]<=89){
            jidian[i]=3.7*xuefen[i];
        }
        if(defen[i]>=82&&defen[i]<=84){
            jidian[i]=3.3*xuefen[i];
        }
        if(defen[i]>=78&&defen[i]<=81){
            jidian[i]=3.0*xuefen[i];
        }
        if(defen[i]>=75&&defen[i]<=77){
            jidian[i]=2.7*xuefen[i];
        }
        if(defen[i]>=72&&defen[i]<=74){
            jidian[i]=2.3*xuefen[i];
        }
        if(defen[i]>=68&&defen[i]<=71){
            jidian[i]=2.0*xuefen[i];
        }
        if(defen[i]>=64&&defen[i]<=67){
            jidian[i]=1.5*xuefen[i];
        }
        if(defen[i]>=60&&defen[i]<=63){
            jidian[i]=1.0*xuefen[i];
        }
        if(defen[i]<=60){
            jidian[i]=1.0*0*xuefen[i];
        }
    }
    for(int i=0;i<n;i++){
        sumjidian+=jidian[i];
    }
    return sumjidian;
}
int main(){
    int n;
    double p,q;
    double GPA;
    scanf("%d",&n);
    int xuefen[100];
    int defen[101];
    for(int i=0;i<n;i++){
        scanf("%d",&xuefen[i]);
    }
    for(int i=0;i<n;i++){
        scanf("%d",&defen[i]);
    }
    p=Jidian(defen,xuefen,n);
    q=1.0*Xuefen(xuefen,n);
    printf("%.2lf",p/q);
    return 0;
}


int main(){
int n;
scanf("%d",&n);
float sum=0;
int a;
double m=0;
int i=1;
int b;
double c;
double d;

int score[100];
while(i<=n)
{
	scanf("%d",&a);
	score[i]=a;
    m+=a;
	i++;
}
   int j=1;
while(j<=n)
{
	scanf("%d",&b);
	if(b>89){c=4.0;}
	else if(b>84){c=3.7;}
else if(b>81){c=3.3;}
else if(b>77){c=3.0;}
else if(b>74){c=2.7;}
else if(b>71){c=2.3;}
else if(b>67){c=2.0;}
else if(b>63){c=1.5;}
else if(b>59){c=1.0;}
else {c=0;}
sum+=c*score[j];
j++;
}
d=sum/m;
printf("%.2lf",d);
return 0;
}


int main()
{
    int n,score[10],i,grade[10],zongfen=0;
    double zong=0,jidian[10];
    scanf("%d\n",&n);
    for(i=0;i<n-1;i++)
    scanf("%d ",&grade[i]);
    scanf("%d\n",&grade[n-1]);
    for(i=0;i<n-1;i++)
    scanf("%d ",&score[i]);
    scanf("%d",&score[n-1]);
    for(i=0;i<n;i++)
    {
	if(90<=score[i]&&score[i]<=100)
	jidian[i]=4.0*grade[i];
	else if(85<=score[i]&&score[i]<=89)
         jidian[i]=3.7*grade[i];
	else if(82<=score[i]&&score[i]<=84)
	jidian[i]=3.3*grade[i];
	else if(78<=score[i]&&score[i]<=81)
	jidian[i]=3.0*grade[i];
	else if(75<=score[i]&&score[i]<=77)
	jidian[i]=2.7*grade[i];
	else if(72<=score[i]&&score[i]<=74)
	jidian[i]=2.3*grade[i];
	else if(68<=score[i]&&score[i]<=71)
	jidian[i]=2.0*grade[i];
	else if(64<=score[i]&&score[i]<=67)
	jidian[i]=1.5*grade[i];
	else if(60<=score[i]&&score[i]<=63)
	jidian[i]=1.0*grade[i];
	else if(score[i]<60)
	jidian[i]=0*grade[i];
	zong+=jidian[i];
	zongfen+=grade[i];
    }
         double GPA=zong/zongfen;
         printf("%.2lf\n",GPA);
         return 0;
}


int main(){
    int num_classes;
    cin>>num_classes;
    int pts[10];
    for(int i = 0; i < num_classes; i++){
        cin>>pts[i];
    }
    int total_score = 0;
    int total_credits = 0;
    int tmp;
    for(int i = 0; i < num_classes; i++){
        cin>>tmp;
        total_credits += pts[i];
        if(tmp >= 90)
            total_score += 40 * pts[i];
        else if(tmp >= 85)
            total_score += 37 * pts[i];
        else if(tmp >= 82)
            total_score += 33 * pts[i];
        else if(tmp >= 78)
            total_score += 30 * pts[i];
        else if(tmp >= 75)
            total_score += 27 * pts[i];
        else if(tmp >= 72)
            total_score += 23 * pts[i];
        else if(tmp >= 68)
            total_score += 20 * pts[i];
        else if(tmp >= 64)
            total_score += 15 * pts[i];
        else if(tmp >= 60)
            total_score += 10 * pts[i];
    }
    printf("%.2f",(float)total_score / (float)(total_credits * 10));
}


int main(){
int n,i;
scanf("%d",&n);
int score[10];
int grade[10];
int a=0;
int b=0;
double c=0;
double d=0;
for(i=0;i<n;i++){
	scanf("%d",&score[i]);
	a+=score[i];
}
for(i=0;i<n;i++){
	scanf("%d",&grade[i]);
if(90<=grade[i]){c+=score[i]*4.0;}
else if(85<=grade[i]){c+=score[i]*3.7;}
else if(82<=grade[i]){c+=score[i]*3.3;}
else if(78<=grade[i]){c+=score[i]*3.0;}
else if(75<=grade[i]){c+=score[i]*2.7;}
else if(72<=grade[i]){c+=score[i]*2.3;}
else if(68<=grade[i]){c+=score[i]*2.0;}
else if(64<=grade[i]){c+=score[i]*1.5;}
else if(60<=grade[i]){c+=score[i]*1.0;}
else{c+=score[i]*0;}
}

d=c/a;

printf("%.2lf",d);
return 0;
}


double judge(int a)
{
	if(a<=100&&a>=90)
		return 4.0;
	else if(a<=89&&a>=85)
		return 3.7;
	else if(a<=84&&a>=82)
		return 3.3;
	else if(a<=81&&a>=78)
		return 3.0;
	else if(a<=77&&a>=75)
		return 2.7;
	else if(a<=74&&a>=72)
		return 2.3;
	else if(a<=71&&a>=68)
		return 2.0;
	else if(a<=67&&a>=64)
		return 1.5;
	else if(a<=63&&a>=60)
		return 1.0;
	else
		return 0.0;
}
int main()
{
	int n,i,*pp[2],sumPOINT=0;
	double sumGPA=0.0;
	scanf("%d",&n);
	pp[0]=(int*)malloc(sizeof(int)*n);
	pp[1]=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	{
		scanf("%d",pp[0]+i);
		sumPOINT+=*(pp[0]+i);
	}
	for(i=0;i<n;i++)
	{
		scanf("%d",pp[1]+i);
		sumGPA+=judge(*(pp[1]+i))**(pp[0]+i);
	}
	free(pp[0]);
	free(pp[1]);
	printf("%.2f\n",sumGPA/sumPOINT);
	return 0;
}


int N,course[15][2],credit;
float GPA;
int main(){
    int i;
    scanf("%d",&N);
    credit = 0;
    for (i = 0; i < N; i++){
        scanf("%d",&course[i][0]);
        credit += course[i][0];
    }
    for (i = 0; i < N; i++) scanf("%d",&course[i][1]);

    for (i = 0; i < N; i++){
        float point;
        if (course[i][1] >= 90) point = 4;
        else if (course[i][1] >= 85) point = 3.7;
        else if (course[i][1] >= 82) point = 3.3;
        else if (course[i][1] >= 78) point = 3.0;
        else if (course[i][1] >= 75) point = 2.7;
        else if (course[i][1] >= 72) point = 2.3;
        else if (course[i][1] >= 68) point = 2.0;
        else if (course[i][1] >= 64) point = 1.5;
        else if (course[i][1] >= 60) point = 1.0;
        else point = 0;
        GPA += course[i][0]*point;
    }
    GPA /= credit;
    printf("%.2f\n",GPA);

    return 0;
}


float mgpa(int y)
{
	int gpa;
	if(y>=90 && y<=100) return 4.0;
	else if(y>=85 && y<=89) return 3.7;
	else if(y>=82 && y<=84) return 3.3;
	else if(y>=78 && y<=81) return 3.0;
	else if(y>=75 && y<=77) return 2.7;
	else if(y>=72 && y<=74) return 2.3;
	else if(y>=68 && y<=71) return 2.0;
	else if(y>=64 && y<=67) return 1.5;
	else if(y>=60 && y<=63) return 1.0;
	else return 0.0;
}
int main()
{
	int n, i, score[50], weight[50];
	float g[50], a=0.0, b=0.0;
	scanf("%d", &n);
	for(i=1; i<=n; i++)
	{
		scanf("%d", &weight[i]);
		b += weight[i];
	}
	for(i=1; i<=n; i++)
	{
		scanf("%d", &score[i]);
		g[i] = mgpa(score[i]) * weight[i];
		a += g[i];
	}
	printf("%.2f", a/b);
	return 0;
}


int main(){
	int n,i,defen[10],xuefen[10],xuefenhe;
	double jidian[10],GPA,jidianhe;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&xuefen[i]);
	}
	for(i=0;i<n;i++){
		scanf("%d",&defen[i]);
	}
	for(i=0;i<n;i++){
		if(defen[i]<60){
			jidian[i]=0;
		}else if(defen[i]<=63){
			jidian[i]=1.0;
		}else if(defen[i]<=67){
			jidian[i]=1.5;
		}else if(defen[i]<=71){
			jidian[i]=2.0;
		}else if(defen[i]<=74){
			jidian[i]=2.3;
		}else if(defen[i]<=77){
			jidian[i]=2.7;
		}else if(defen[i]<=81){
			jidian[i]=3.0;
		}else if(defen[i]<=84){
			jidian[i]=3.3;
		}else if(defen[i]<=89){
			jidian[i]=3.7;
		}else{jidian[i]=4.0;}
	}
	jidianhe=0;
	xuefenhe=0;
	for(i=0;i<n;i++){
		jidianhe=jidianhe+jidian[i]*xuefen[i];
		xuefenhe=xuefenhe+xuefen[i];
	}
	GPA=jidianhe/xuefenhe;
	printf("%.2lf",GPA);
	return 0;
}


void main()
{
	int n,xuefen[10],score[10],i;
	double gpa[10],sum=0,sumxf=0;
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%d",&xuefen[i]);
	for (i=0;i<n;i++)
    	scanf("%d",&score[i]);
	for (i=0;i<n;i++)
	{
		if (score[i]>=90) gpa[i]=4.0;
		else if (score[i]<=89&&score[i]>=85) gpa[i]=3.7;
		else if (score[i]<=84&&score[i]>=82) gpa[i]=3.3;
		else if (score[i]<=81&&score[i]>=78) gpa[i]=3.0;
		else if (score[i]<=77&&score[i]>=75) gpa[i]=2.7;
		else if (score[i]<=74&&score[i]>=72) gpa[i]=2.3;
		else if (score[i]<=71&&score[i]>=68) gpa[i]=2.0;
		else if (score[i]<=67&&score[i]>=64) gpa[i]=1.5;
		else if (score[i]<=63&&score[i]>=60) gpa[i]=1.0;
		else if (score[i]<60) gpa[i]=0;
		sum+=gpa[i]*xuefen[i];
		sumxf+=xuefen[i];
	}
	printf("%.2lf\n",sum/sumxf);
}