semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    char string[200];
    int n,i,p,x[100],y[100],q,j,t,m;
    gets(string);
    n=strlen(string);
    char c1;
    char c2;
    c1=string[0];
    for(i=1;i<n;i++)
    {
                    if(string[i]!=c1)
                    {
                                       c2=string[i];
                                       break;
                    }
    }
   
    p=1;
    q=1;
    for(p=1;p<n;p=p+2)
    {
                    for(i=0;i<n;i++)
                    {
                    
                              if(string[i]==c1&&string[i+p]==c2)
                              {
                              
                              string[i]='a';
                              string[i+p]='a';
                              x[q]=i;
                              y[q]=i+p;
                              q++;
                              }
                    }   
    }
    
    
    
    
    for(q=1;q<=n/2;q++)
    {
                       for(j=1;j<=n/2-q;j++)
                       {
                                            if(y[j]>y[j+1])
                                            {
                                                           t=y[j];
                                                           y[j]=y[j+1];
                                                           y[j+1]=t;
                                                           m=x[j];
                                                           x[j]=x[j+1];
                                                           x[j+1]=m;
                                            }
                       }
    }
                                                           
    for(q=1;q<=n/2;q++)
    {
                       printf("%d %d\n", x[q], y[q]);
    }
    
    return 0;
}
char line[1000];
int search(int a)
{
    int i, j, flag=0;
    for (i=a-1;i>=0;i--)
    {
        if ((line[i]+line[a]==line[strlen(line)-1]+line[0])&&(flag==0))
        {
            for (j=a-1;j>=0;j--)
            {
                if (line[j]==line[strlen(line)-1])
                {
                    search (j);
                    break;
                }
            }
            if (j==0)
            return 0;
            cout << i << " " << a << endl;
            break;
        }
        if (line[i]+line[a]!=line[strlen(line)-1]+line[0])
        flag++; 
        if ((line[i]+line[a]==line[strlen(line)-1]+line[0])&&(flag!=0))
        flag--;
    }
}
int main()
{
    memset(line, 0, sizeof(line));
    cin >> line;
    search (strlen(line)-1);
    return 0;
}
char str[100];
char x,y;
void line(char a[])
{
	int i,j;
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]==y)
		{
			j=i;
			while (a[j]!=x)
			{
				j--;
			}	
			a[i]='0';
			a[j]='0';
			cout << j << " " << i << endl;
			break;
		}
	}
	if(i<strlen(a))
	{
		line(a);
	}
}
int main()
{
	cin >> str;
	x=str[0];
	y=str[strlen(str)-1];
	line(str);
	return 0;
}
char a[1000];

int xx (int k)
{
     int x,y;
     x=k;
     y=k+1;
     while (a[y]==a[x])
     y=xx(y);
     cout <<x<<" "<<y<<endl;
     return y+1;
}

int main ()
{
    cin.getline(a,999,'\n');
    xx(0);
    return 0;
}
void main()
{
	void pr(char *a,int n,char boy,char girl,int *k);
	char boy,girl,a[100];
	int i,b=0,g=0,k[100];
	for(i=0;;i++)
	{
		scanf("%c",&a[i]);
		if(a[i]==a[0])b++;
		else g++;
		if(b==g)break;
	}
	boy=a[0];girl=a[b*2-1];
	for(i=0;i<100;i++)k[i]=i;
	pr(a,2*b,boy,girl,k);
}

void pr(char *a,int n,char boy,char girl,int *k)
{
	int i;
	for(i=0;i<n;i++)
	{
		if(*(a+i)==girl)
		{
			printf("%d %d\n",*(k+i-1),*(k+i));
			i--;
			break;
		}
	}
	for(;i<n-2;i++)
	{
		*(a+i)=*(a+i+2);
		*(k+i)=*(k+i+2);
	}
	if(n>3)pr(a,n-2,boy,girl,k);
}
char row[100];
void pipei( int i, char boy, char girl )
{
	int j;
	if ( row[i] == girl )
	{
		for ( j = i - 1; j >= 0; j-- )
		{
			if ( row[j] == boy )
			{
				cout << j << " " << i << endl;
				row[j] = ' ';
				row[i] = ' ';
				break;

		    }
	    }
	}
	if ( row[i + 1] != '\0' )
		pipei( i + 1, boy, girl);

}

int main()
{
	char girl, boy;
	cin.getline( row, 100 );
	boy = row[0];
	int i;
	for ( i = 0; row[i] != '\0'; i++ )
	{
		if ( row[i] != boy )
		{
			girl = row[i];
			break;
		}
	}
	pipei( 1, boy, girl );
	return 0;
}
/*************************************************************************************************************
* @file .cpp
* @author ????
* @date 
* @description
*		????        
*/


char b[100];
int a[100], i, j;
void peidui( int l)
{
	int flag = 0;
	if(l == 0)
		return;
	for(i = 0; i < l - 1; i++)
	{
		if((b[i] == b[0]) && (b[i + 1] != b[0]))
		{
			cout << a[i] << " " << a[i + 1] << endl;
			flag = 1;
			break;
		}
	}
	if(flag)
	{
	for(j = i; j < l - 2; j++)
	{
		a[j] = a[j + 2];
		b[j] = b[j + 2];
	}
	}
	peidui(l - 2);
}
int main()
{
	int l;
	cin >> b;
	l = strlen(b);
	for (i = 0; i < l; i++)
		a[i] = i;
	peidui(l);
	return 0;
}
int main(){
	char boy,girl,s[520];
	int n,i,m,total,j;
	struct f{
		char c;
		int judge; 
	}child[520];
	scanf("%s",s);
	boy=s[0];
	for (i=1;s[i]!='\0';i++){
		if (s[i]!=boy){
			girl=s[i];
			break;
		}
	}
	for (i=0;s[i]!='\0';i++){
		child[i].c=s[i];
		child[i].judge=1;
	}
	m=i;
	total=i;
	for (n=1;m!=0;n++){
		for (i=0;i<total-2;i++){
			if (child[i].c==boy&&child[i].judge==1){
				for (j=i+1;j<=total-1;j++){
					if (child[j].judge==1&&child[j].c==boy)
						j=m+100;
					else if (child[j].judge==1&&child[j].c==girl){
						printf("%d %d\n",i,j);
						child[i].judge=0;
						child[j].judge=0;
						j=m+100;
						i=total+100;
						m=m-2;
					}
				}
			}
		}
	}
	return 0;
}
int a[60]={0},b[60]={0};
char c[120]={'\0'},ch;
int n=0,m=0;
int search1(int p)//???????????????????
{
	int i=p+1,j;
	while (c[i]=='('||(c[i]=='{')||(c[i]=='[')||c[i]=='<')
	{
		j=search1(i);//??
		i=j+1;
	}
	a[m]=p; b[m]=i; 
	m++;
	return i;
}
int main()
{
	int i=0;
	cin.get(ch);
	while (ch!='\n')
	{
		c[n]=ch;
		n++;
		cin.get(ch);
	}
	while (i<n)
		i=search1(i)+1;
	for (i=0; i<m; i++)
		cout<<a[i]<<' '<<b[i]<<endl;
	return 0;
}
int main()
{int cur=0,stack[100],sum=0;
 char x,sign;
 sign=cin.peek();
 do
 {
  cin>>x;
  if(x==sign)
   stack[cur++]=sum++;
  else 
   cout<<stack[--cur]<<' '<<sum++<<endl;
 }while(cur>0);
 return 0;
}
int sum(int line2[],int a,int b)
{
	int i,c=0;
	for(i=a;i<=b;i++)
		c+=line2[i];
	return(c);
}


int main()
{
	char line[100];
	int line1[100],i,j,k,line3[50][2]={0};
	scanf("%s",line);
	k=strlen(line)/2-1;
	for(i=0;i<strlen(line);i++)
	{
		if(line[i]==line[0])
			line1[i]=1;
		if(line[i]==line[strlen(line)-1])
			line1[i]=-1;
	}
	for(i=strlen(line)-1;i>=0;i--)
	{
		if(line1[i]==-1)
			for(j=i-1;j>=0;j--)
				if(sum(line1,j,i)==0)
				{
					line3[k][0]=j;
					line3[k][1]=i;
					k--;
					break;
				}
	}
	for(i=0;i<strlen(line)/2;i++)
		printf("%d %d\n",line3[i][0],line3[i][1]);
	return 0;
}
int x = 0;
int a[50];
char str[100];
char b, g;
int l;
int main()
{
	cin.getline(str, 100, '\n');
	l = strlen(str);
	b = str[0];
	g = str[l - 1];
	game(0, 0, 1);
	return 0;
}
void game(int k, int i, int j)
{
	if (j == l - 1)
	{
		cout << "0 " << l - 1;
	}
	else
	{
		if (str[j] == g)
		{
			cout << i << " " << j << endl;
			x = x - 1;
			game(a[x], i - k, j + 1);
		}
		else
		{
			a[x] = k;
			x = x + 1;
			game(j - i, j, j + 1);
		}
	}
}
int main(){
          int a[4],i,j,t;
          char b[4]={'z','q','s','l'},k;
          for(a[0]=10;a[0]<=50;a[0]=a[0]+10)
          {
        	  for(a[1]=10;a[1]<=50;a[1]=a[1]+10)
        	  {
        		  for(a[2]=10;a[2]<=50;a[2]=a[2]+10)
        		  {
        			  for(a[3]=10;a[3]<=50;a[3]=a[3]+10)
        			  {
        				  if(a[0]+a[1]==a[2]+a[3]&&a[0]+a[3]>a[1]+a[2]&&a[0]+a[2]<a[1])
        				  {
        					  for(i=0;i<3;i++)
        					  {
        						  for(j=1;j<4-i;j++)
        						  {
        							  if(a[i]<a[i+j])
        						      {
        							       t=a[i+j];
        							       a[i+j]=a[i];
        							       a[i]=t;
        							       k=b[i+j];
        							       b[i+j]=b[i];
        							       b[i]=k;
        						      }
        						  }
        					  }
        				  for(i=0;i<4;i++)  cout<<b[i]<<" "<<a[i]<<endl;
        				  }
        			  }
        		  }
        	  }
          }
	      return 0;
}
/*
 * chengtizhong.cpp
 *
 *  Created on: 2012-1-10
 *      Author: Administrator
 */
int main()
{
	int z,q,s,l;
	int number[4];
	char name[4]={'z','q','s','l'};
	for(z=1;z<=5;z++)
	{
		for(q=1;q<=5;q++)
		{
			for(s=1;s<=5;s++)
			{
				for(l=1;l<=5;l++)
				{
					if((z+q)==(s+l))
					{
						if((z+l)>(s+q))
						{
							if((z+s)<q)
							{
								number[0]=z;
								number[1]=q;
								number[2]=s;
								number[3]=l;
							}
						}
					}
				}
			}
		}
	}
	int i,j,temp;
	char temp1;
	for(i=0;i<4;i++)
	{
		for(j=0;j<3-i;j++)
		{
			if(number[j]<number[j+1])
			{
				temp=number[j+1];temp1=name[j+1];
				number[j+1]=number[j];name[j+1]=name[j];
				number[j]=temp;name[j]=temp1;
			}
		}
	}
	for(i=0;i<4;i++)
	{
		cout<<name[i]<<" "<<number[i]*10<<endl;
	}
	return 0;
}
int main()                       //?????
{
   int z,q,s,l;                  //??????zqsl??4???
   int a[6];
   char b[6];
   int i;
   for(i=0;i<6;i++)
   {a[i]=0;}
                                 
   for(z=1;z<=5;z++)             //?????????????(?12345??10?????)
   {
      for(q=1;q<=5;q++)
	  { if(z==q) continue;       //??????????????????????
	    
	      for(s=1;s<=5;s++)
		  { if(q==s||z==s) continue;
		    for(l=1;l<=5;l++)
			{ if(l==z||l==q||l==s) continue;
			   
			  if(z+q==l+s&&z+l>s+q&&z+s<q)        //??????????????
			    {
				 for(i=1;i<6;i++)
				 {
					 if(i==z){a[i]=z*10;b[i]='z';}               //???????????a???????b
                     else if(i==q){a[i]=q*10;b[i]='q';}
					 else if(i==s){a[i]=s*10;b[i]='s';}
					 else if(i==l){a[i]=l*10;b[i]='l';}
				 
				 
			     }

			    for(i=5;i>=0;i--)
				{
					if(a[i]!=0)
				    {cout<<b[i]<<" "<<a[i]<<endl;}           //???????????? 
			    } 
			  }
			
			}
		    
		  
		  } 
	  
	    
	  
	  
	  }
   
   
   }



return 0;
}                                                //?????
int main(void)
{
	int zhao, qian, sun, li;
	for(zhao = 1; zhao <= 5; zhao++)
		for(qian = 0; qian <= 5; qian++)
			for(sun = 1; sun <= 5; sun++)
			{
				li = zhao + qian - sun;
				if(li <= 5 && li > 0) 
				if((zhao + li > sun + qian) && (zhao + sun < qian))
				if(zhao != qian && zhao != sun && zhao != li)
				if(qian != sun && qian != li)
				if(sun != li)
				for(int i = 5; i >= 1; i--)
				{
					if(zhao == i) cout << "z " << zhao * 10 << endl;
					if(qian == i) cout << "q " << qian * 10<< endl;
					if(sun == i) cout << "s " << sun * 10<< endl;
					if(li == i) cout << "l " << li * 10<< endl;
				}
			}
	return 0;
}
int main()
{
	int z , q , s , l;

	for (q = 30 ; q <= 50 ; q +=10)
	{
		for (z = 10 ; z <= 30 ; z +=10)
		{
			for (s = 10 ; s <= 30 ; s +=10)
			{
				for (l = 10 ; l <= 50 ; l +=10)
				{
					if ((z + q == s + l) && (z + l > s + q) && (z + s < q))
					{
						if (l >= q )
						{
							cout << "l " << l << endl << "q " << q << endl;
							if (z >= s)
								cout << "z " << z << endl << "s " << s << endl;
							else 
								cout << "s " << s << endl << "z " << z << endl;
						}
						else 
						{
							cout << "q " << q << endl;
							if ((z >= s) && (z >= l))
							{
								cout << "z " << z << endl;
								if (s >= l)
									cout << "s " << s << endl << "l " << l << endl;
								else cout << "l " << l << endl << "s " << s << endl;
							}
							else 
							{
								if (s >= l)
								{
									cout << "s " << s << endl;
									if (z >= l)
										cout << "z " << z << endl << "l " << l << endl;
									else
										cout << "l " << l << endl << "z " << z << endl;
								}
								else 
								{
									cout << "l " << l << endl;
									if (z >= s)
										cout << "z " << z << endl << "s " << s << endl;
									else
										cout << "s " << s << endl << "z " << z << endl;
								}
							}
						}
					}
				}
			}
		}
	}
										

	return 0;
}
int main()
{	
	int z=0,q=0,s=0,l=0;
	for(z=1;z<=5;z++)
		for(q=1;q<=5;q++)
			for(s=1;s<=5;s++)
				for(l=1;l<=5;l++)
				{if ((z+q==s+l)&&(z+l>s+q)&&(z+s<q)==1)
				{cout<<"l "<<(10*l)<<endl;
				cout<<"q "<<(10*q)<<endl;
				cout<<"z "<<(10*z)<<endl;
				cout<<"s "<<(10*s)<<endl;break;}
				}
	return 0;
}
int main()
{
	int z,q,s,l;
	int i,j,k,r;
	for(i=1;i<=5;i++)
	{
		for(j=1;j<=5;j++)
		{
			if(j==i)
				continue;
			else
			{
				for(k=1;k<=5;k++)
				{
					if(k==j||k==i)
						continue;
					else
					{
						for(r=1;r<=5;r++)
							if(r==k||r==j||r==i)
								continue;
							else
							{
								z=10*i;
								q=10*j;
								s=10*k;
								l=10*r;
								if(z+q==s+l&&z+l>s+q&&z+s<q)
								{
									if(i==5)
										printf("z 50\n");
									if(j==5)
										printf("q 50\n");
									if(k==5)
										printf("s 50\n");
									if(r==5)
										printf("l 50\n");
									if(i==4)
										printf("z 40\n");
									if(j==4)
										printf("q 40\n");
									if(k==4)
										printf("s 40\n");
									if(r==4)
										printf("l 40\n");	
									if(i==3)
										printf("z 30\n");
									if(j==3)
										printf("q 30\n");
									if(k==3)
										printf("s 30\n");
									if(r==3)
										printf("l 30\n");
									if(i==2)
										printf("z 20\n");
									if(j==2)
										printf("q 20\n");
									if(k==2)
										printf("s 20\n");
									if(r==2)
										printf("l 20\n");
									if(i==1)
										printf("z 10\n");
									if(j==1)
										printf("q 10\n");
									if(k==1)
										printf("s 10\n");
									if(r==1)
										printf("l 10\n");
								}
							}
					}
				}
			}
		}
	}
	return 0;
}
int main()
{
	int z, q, s, l;
	int C1, C2, C3;
	l = 50;
	q = 40;
	for(z = 10; z <= 30; z += 10)
		for(s = 10; s <= 30; s += 10)
		{
			C1 = (z + q) == (s + l);
			C2 = (z + l) > (s + q);
			C3 = (z + s) < q;
			if(C1&&C2&&C3&&(z != s))
				cout << "l " << l << endl << "q " << q << endl << "z " << z << endl << "s " << s << endl; 
		}
	return 0;
}
int main()

{
    int z, q, s, l, x1, x2, x3, x4;
    for(z = 10; z <= 50; z = z + 10)
    {
        for(q = 10; q <= 50; q = q + 10)
        {
             for(s = 10; s <= 50; s = s + 10)
             {
                  for(l = 10; l <= 50; l = l + 10)
                  {
                       if(((z+q)==(s+l))&&((z+l)>(s+q))&&((z+s)<q))
                       {
                       cout << "l " << l << endl;
                       cout << "q " << q << endl;
                       cout << "z " << z << endl;
                       cout << "s " << s << endl;
                       }
                  }
             }
        }
    }
    return 0;
}
/*
 * 2.cpp
 *
 *  Created on: 2010-11-20
 *      Author: jsgl
 */
int main(){
	int z,q,s,l;
	for(z=1;z<=5;z++)
		for(q=1;q<=5;q++)
			for(s=1;s<=5;s++)
				for(l=1;l<=5;l++){
					if(((z+q)==(s+l))&&((z+l)>(s+q))&&((z+s)<q)&&q!=z&&s!=z&&s!=q&&l!=z&&l!=q&&l!=s){//?????????????
						char a[4];int b[4]={z,q,s,l};
						a[0]='z';
						a[1]='q';
						a[2]='s';
						a[3]='l';
					for(int j=3;j>0;j--)
						for(int i=0;i<j;i++){
							if(b[i]<b[i+1]){
								int t=b[i];b[i]=b[i+1];b[i+1]=t;
								char s=a[i];a[i]=a[i+1];a[i+1]=s;
							}//????
						}
					for(int k=0;k<4;k++)
						cout<<a[k]<<" "<<b[k]*10<<endl;//??

				}}
	return 0;
}
/*
 * ????weight.cpp
 * ??????
 * ????: 2012-11-5
 * ??:?????????????????
 */

int main()
{
	int z,q,s,l;             //??????????????10??????10???
	for (z=1;z<=5;z++){
		for(q=1;q<=5;q++){
			for(s=1;s<=5;s++){
				for(l=1;l<=5;l++){
                if ((z+q)==(s+l) && (z+l)>(q+s) && (z+s)<q){          //????????
                	int a[5],i,j,temp;                 //????????
                	a[0]=z;
                	a[1]=q;
                	a[2]=s;
                	a[3]=l;
                	for(i=0;i<=3;i++)
                	{
                		for(j=0;j<=3-i;j++)
                		{
                		    temp=a[j];
                		    if(a[j]>a[j+1])
                		    {
                			    a[j]=a[j+1];
                			    a[j+1]=temp;
                		    }
                		}
                	}
                    for (i=3;0<=i;i--){                        //???????????????????????
                    	if(z==a[i]) cout << "z " << a[i]*10 << endl;
                    	if(q==a[i]) cout << "q " << a[i]*10 << endl;
                    	if(s==a[i]) cout << "s " << a[i]*10 << endl;
                    	if(l==a[i]) cout << "l " << a[i]*10 << endl;
                    }

                }
				}
			}
		}
	}
	return 0;
}
int main()
{
	int z,q,s,l,i;
	for(z=1;z<=5;z++)
	{
		for(q=1; (q<=5)  ;q++)
		{
			if(q==z)
			{
				continue;
			}
			for(s=1; (s<=5) ;s++)
			{
				if( (s==z) || (s==q) )
				{
					continue;
				}
				for(l=1; (l<=5) ;l++)
				{
					if( (l==z) || (l==q) || (l==s) )
					{
						continue;
					}
					if( (z+q==s+l) && (z+l>s+q) && (z+s<q) )
					{
						for(i=5;i>0;i--)
						{
						    if(z==i)
							    cout<<"z"<<' '<<10*z<<endl;
							if(q==i)
								cout<<"q"<<' '<<10*q<<endl;
							if(s==i)
							    cout<<"s"<<' '<<10*s<<endl;
							if(l==i)
								cout<<"l"<<' '<<10*l<<endl;
						}
					}
				}
			}
		}
	}
}
int main()
{
	int z, q, s, l, a[5], i;	//z, q, s, l ???????????????a[5] ??????????i ????
	for (z = 10; z <= 50; z = z + 10)
	{
		for (q = 10; q <= 50; q = q + 10)
		{
			if (q == z)
				continue;
			for (s = 10; s <= 50; s = s + 10)
			{
				if ((s == z) || (s == q))
					continue;
				for (l = 10; l <= 50; l = l + 10)
				{
					if ((l == z) || (l == q) || (l == s))
						continue;
					if (((z + q) == (s + l)) && ((z + l) > (s + q)) && ((z + s) < q))
					{
						for (i = 50; i >= 10; i = i - 10)
						{
							if (z == i)
								cout << "z " << z << endl;
							if (q == i)
								cout << "q " << q << endl;
							if (s == i)
								cout << "s " << s << endl;
							if (l == i)
								cout << "l " << l << endl;
						}
					}
				}
			}
		}
	}
	return 0;
}
int max(int a,int b,int c,int d)
{
	int n=0;
	if(a>n)
		n=a;
	if(b>n)
		n=b;
	if(c>n)
		n=c;
	if(d>n)
		n=d;
	return n;
}
int sec(int a,int b,int c,int d)
{
	int n=0;
	int m=max(a,b,c,d);
	if(a>n&&a!=m)
		n=a;
	if(b>n&&b!=m)
		n=b;
	if(c>n&&c!=m)
		n=c;
	if(d>n&&d!=m)
		n=d;
	return n;
}
int min(int a,int b,int c,int d)
{
	int n=100;
	if(a<n)
		n=a;
	if(b<n)
		n=b;
	if(c<n)
		n=c;
	if(d<n)
		n=d;
	return n;
}
int thi(int a,int b,int c,int d)
{
	int n=100;
	int m=min(a,b,c,d);
	if(a<n&&a!=m)
		n=a;
	if(b<n&&b!=m)
		n=b;
	if(c<n&&c!=m)
		n=c;
	if(d<n&&d!=m)
		n=d;
	return n;
}
int main()
{
	for(int z=1;z<=5;z+=1)
	{
		for(int q=1;q<=5;q+=1)
		{
			if(q!=z)
			{
				for(int s=1;s<=5;s+=1)
				{
					if(s!=z&&s!=q)
					{
						for(int l=1;l<=5;l+=1)
						{
							if(l!=z&&l!=q&&l!=s)
							{
								if((z+q)==(s+l))                     //????????????????????????
								{
									if((z+l)>(s+q))                  //??????????????????????
									{
										if(z+s<q)                    //???????????????????
										{
											char m[6];
											m[z]='z';
											m[q]='q';
											m[s]='s';
											m[l]='l';
											cout<<m[max(z,q,s,l)]<<' '<<10*max(z,q,s,l)<<endl;
											cout<<m[sec(z,q,s,l)]<<' '<<10*sec(z,q,s,l)<<endl;
											cout<<m[thi(z,q,s,l)]<<' '<<10*thi(z,q,s,l)<<endl;
											cout<<m[min(z,q,s,l)]<<' '<<10*min(z,q,s,l)<<endl;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	return 0;
}
//============================================================================
// Name        : POJtest.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

void shuchu(int ,int , int , int );
int main(void) {
	int z, q, s, l;//zqsl??????
	for (z = 10; z <= 50; z += 10)
		for (q = 10; q <= 50; q += 10)
			for (s = 10; s <= 50; s += 10)
				for (l = 10; l <= 50; l += 10) {//??????????
					if (z == q || z == s || z == l || q == s || q == l || s
							== l)//????,???????????????????????????if???????
						continue;
					if (z + q != s + l)//???????????????
						continue;
					if (z + l <= s + q)//???????????????
						continue;
					if (z + s >= q)//????????????
						continue;
					shuchu(z,q,s,l);//????????????????????????????

				}
return 0;
}
void shuchu(int z,int q,int s,int l)
{
	for(int i=50;i>=10;i-=10)//?????????????????????????
	{
		if(i==z)//i???????????????
			cout << "z "<<z<<endl;
		else if(i==q)
			cout << "q "<<q<<endl;
		else if(i==s)
			cout << "s "<<s<<endl;
		else if(i==l)
			cout << "l "<<l<<endl;
	}
}
/*
 * ctz.cpp
 *
 *  Created on: 2011-11-4
 *      Author: sony
 */

int main()
{
	int z,q,s,l,wz,wq,ws,wl;
	int s1,s2,s3;
	for(z=1;z<=5;z++){
		for(q=1;q<=5;q++){
			if(q==z) continue;
			for(s=1;s<=5;s++){
				if(s==z||s==q) continue;
				for(l=1;l<=5;l++){
					if(l==z||l==q||l==s) continue;
					s1=(z+q==s+l);
					s2=(z+l>s+q);
					s3=(z+s<q);
					if(s1+s2+s3==3)
						{wz=z;
						wq=q;
						ws=s;
						wl=l;}
				}
			}
		}
	}
	char output[6]={'a','a','a','a','a','a'};
	output[wz]='z';
	output[wq]='q';
	output[ws]='s';
	output[wl]='l';
	int I;
	for(int i=5;i>=1;i--){
		if(output[i]!='a'){
			I=i*10;
			cout<<output[i]<<" "<<I<<endl;
		}
	}
	return 0;
}
int main()
{
	int z,q,s,l;
	for(z=1;z<=5;z++)
		for(q=1;q<=5;q++)
			for(s=1;s<=5;s++)
				for(l=1;l<=5;l++)
							if(z+q==s+l&&z+l>s+q&&z+s<q)
							{
	int a[4];
	int b[4];
	a[1]=z*10;
	b[1]='z';
	a[2]=q*10;
	b[2]='q';
	a[3]=s*10;
	b[3]='s';
	a[4]=l*10;
	b[4]='l';
	int m=0;
	int c[4]={0,0,0,0};
	int d[4];
	for(int i=1;i<=4;i++)
	{
		if(a[i]>m)
			{
			m=a[i];
			c[4]=c[3];
			c[3]=c[2];
			c[2]=c[1];
			c[1]=m;
			d[4]=d[3];
			d[3]=d[2];
			d[2]=d[1];
			d[1]=b[i];
			}
		else
		{
			c[i]=a[i];
			d[i]=b[i];
		}
	}
	char x1,x2,x3,x4;
	x1=d[1];
	x2=d[2];
	x3=d[3];
	x4=d[4];
	cout<<x1<<" "<<c[1]<<endl<<x2<<" "<<c[2]<<endl<<x3<<" "<<c[3]<<endl<<x4<<" "<<c[4];
}
	return 0;
}
int main()
{
	int q,z,s,l,s1,s2,s3;
	char weight[6];
	memset(weight,0,sizeof(weight));
	for(q=1;q<6;q++)
		for(z=1;z<6;z++)
		{
			if(z==q)continue;
			for(s=1;s<6;s++)
			{
				if(s==z||s==q)continue;
				for(l=1;l<6;l++)
				{
					if(l==s||l==z||l==q)continue;
					s1=(z+q)==(s+l);
					s2=(z+l)>(s+q);
					s3=(z+s)<q;
					if(s1+s2+s3==3)
					{
						weight[q]='q';
						weight[z]='z';
						weight[s]='s';
						weight[l]='l';
						for(int i=5;i>0;i--)
							if(weight[i]!='\0')
								cout<<weight[i]<<' '<<i*10<<endl;
					}
				}
			}
		}
	return 0;
}
int main()
{
	int z,q,s,l;
	for(z=1;z<=5;z++)
	{
		for(q=4;q<=5;q++)
		{
			if(q==z) continue;
			for(s=1;s<=5;s++)
			{
				if(s==z||s==q) continue;
				for(l=1;l<=5;l++)
				{
					if(l==z||l==q||l==s) continue;
					if(z+q==s+l&&z+l>s+q&&z+s<q)
						cout<<"l "<<l*10<<endl<<"q "<<q*10<<endl<<"z "<<z*10<<endl<<"s "<<s*10<<endl;
				}
			}
		}
	}
	return 0;
}
int main()
{
	int z,q,s,l,weight[4],i,j,temp1;
	char name[4],temp2;
	for ( z=10;z<=50;z+=10 )
	{
		for ( q=10;q<=50;q+=10 )
		{
			if ( q == z )
			{
				continue;
			}
			for ( s=10;s<=50;s+=10 )
			{
				if ( ( s == q ) || ( s == z ) )
				{
					continue; 
				}
				l=z+q-s;
				if ( ( l<=50 ) && ( l != z ) && ( l != q ) && ( l != s ) && ( z+l>s+q ) && ( z+s<q ) )
				{
					name[0]='z';
					weight[0]=z;
					name[1]='q';
					weight[1]=q;
					name[2]='s';
					weight[2]=s;
					name[3]='l';
					weight[3]=l;
					for ( i=3;i>0;i-- )
					{
						for ( j=0;j<i;j++ )
						{
							if ( weight[i]>weight[j] )
							{
								temp1=weight[i];
								weight[i]=weight[j];
								weight[j]=temp1;
								temp2=name[i];
								name[i]=name[j];
								name[j]=temp2;
							}
						}
					}
					for ( i=0;i<4;i++ )
					{
						cout<<name[i]<<" "<<weight[i]<<endl;
					}
				}
			}
		}
	}
	return 0;
}