semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{ 
	 int n,i,j=0,m=0;

	 scanf("%d",&n);

	 char s1[100][10],s2[100][10],p1[100][10],p2[100][10],z1[100][10],z2[100][10],t[10];

	 for(i=0;i<n;i++)
	 {
		 scanf("%s",s1[i]);

		 scanf("%s",s2[i]);
	 }
	 for(i=0;i<n;i++)
	 {
	 if(s2[i][1]!='\0'&&strcmp(s2[i],"60")>=0)
	 {  
	  strcpy(p1[j],s1[i]);

	  strcpy(p2[j],s2[i]);

	  j++;
	 }
	 if(s2[i][2]>='0'&&s2[i][2]<='9'&&s2[i][3]=='\0')
	 {
	 strcpy(z1[m],s1[i]);

	  strcpy(z2[m],s2[i]);

	  m++;
	 }
	 }
	 int k=j;
	 for(i=k-1;i>=0;i--)
	 {
		 for(j=0;j<i;j++)
		 {
	 if(strcmp(p2[j],p2[j+1])<0)
	 {

		 strcpy(t,p2[j]);
 
	     strcpy(p2[j],p2[j+1]);

		  strcpy(p2[j+1],t);

		   strcpy(t,p1[j]);

		     strcpy(p1[j],p1[j+1]);

			   strcpy(p1[j+1],t);
	 }

		 }
	 }
 	 for(i=m-1;i>=0;i--)
	 {
		 for(j=0;j<i;j++)
		 {
	 if(strcmp(z2[j],z2[j+1])<0)
	 {

		 strcpy(t,z2[j]);
 
	     strcpy(z2[j],z2[j+1]);

		  strcpy(z2[j+1],t);

		   strcpy(t,z1[j]);

		     strcpy(z1[j],z1[j+1]);

			   strcpy(z1[j+1],t);
	 }

		 }
	 }
	 for(j=0;j<m;j++)
{
	printf("%s\n",z1[j]);
 }
 

 for(j=0;j<k;j++)
 {
	printf("%s\n",p1[j]);
 }
  for(i=0;i<n;i++)
  {
  if(!((s2[i][1]!='\0'&&strcmp(s2[i],"60")>=0)||(s2[i][2]>='0'&&s2[i][2]<='9'&&s2[i][3]=='\0')))
	  printf("%s\n",s1[i]);
  }
	 

	return 0;
}
struct bing
{
	char id[10];
	int age;
	int num;
}bing[100],temp;
int main ()
{
	int i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d",&bing[i].id,&bing[i].age);
		bing[i].num=i+1;
	}
	for(j=0;j<=n;j++)
	{
		for(i=0;i<n-1;i++)
		{
			if(bing[i+1].age>=60&&bing[i].age<bing[i+1].age)
			{
				temp=bing[i+1];
				bing[i+1]=bing[i];
				bing[i]=temp;
			}
		}
	}
	for(i=0;i<n;i++)
		printf("%s\n",bing[i].id);
	return 0;
}
struct Node;
typedef struct Node *pNode; 
struct Node
{
    int x;
	char id[20];
	pNode next;
};


pNode create()/*??head*/
{
	pNode p;
	p=(pNode)malloc(sizeof(struct Node));
	p->next=NULL;
	return p;
}

void sort(pNode head,int n)/*head???????n???*/
{
	pNode p=NULL,q=NULL,s=NULL;
    int i;
	for (i=1;i<=n;i++)
	{
	s=(pNode)malloc(sizeof(struct Node));
	s->next=NULL;
	scanf("%s %d",&s->id,&s->x);
    if (s->x<60)
	{
		p=head;
		while (p->next)
			p=p->next;
		p->next=s;
	}
    else
	{
		q=head;
	    p=head->next;
	    while (p)
		{
			if (p->x<s->x)
				break;
		    q=p;
		    p=p->next;
		}
	    q->next=s;
	    s->next=p;
	}
	}
}

void outputdata(pNode p)/*??head*/
{
    p=p->next;
	while(p->next)
	{
      printf("%s\n",p->id);
	  p=p->next;
    }
	printf("%s\n",p->id);
}


int main()
{
	pNode head;
	int n;
    head=create();
	scanf("%d",&n);
	sort(head,n);
	outputdata(head);

	return 0;
}
int main()
{
struct student
{	char as[10];
	int ag;
};
struct student stu[100];
struct student st[100];
struct student temp;
int n,i,j,k;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %d",stu[i].as,&stu[i].ag);
j=0;
for(i=0;i<n;i++){
	if(stu[i].ag>59){
		st[j]=stu[i];
		stu[i].ag=0;
		j++;
	}
}
for(k=1;k<j;k++){
	for(i=0;i<j-k;i++){
		if(st[i].ag<st[i+1].ag){
			temp=st[i];
			st[i]=st[i+1];
			st[i+1]=temp;
		}
	}
}
for(i=0;i<j;i++)
printf("\n%s",st[i].as);
for(i=0;i<n;i++)
	if(stu[i].ag!=0)
	printf("\n%s",stu[i].as);
return 0;
}
struct person
{
	char c[10];
	int a;
	struct person *next;
};
int main()
{
	int i,n;
	struct person *head,*p1,*p2,*p,*p0,*p3;
	scanf("%d",&n);
	i=0;
	head=NULL;
	while(i<n)
	{
		p1=(struct person*)malloc(len);
	    scanf("%s %d",p1->c,&p1->a);
		if(i==0) { head=p1;p2=p1;}
		else
		{
			p2->next=p1;
			p2=p1;
		}
		i++;
	}
	p2->next=NULL;
	for(i=0;i<n;i++)
	{
		p=p0=head;
		while(p!=NULL)
		{
			if(p->a>p0->a) p0=p;
			p=p->next;
		}
		if(p0->a>=60)
		{
			printf("%s\n",p0->c);
			p=head;
			while(p->a!=p0->a)
			{
				p3=p;
				p=p->next;
			}
			if(p==head) head=p->next;
			else p3->next=p->next;
		}
		else
		{
			printf("%s\n",head->c);
			head=head->next;
		}
	}
}
struct bingren
{
	char id[20];
	int nian;
	struct bingren *next;
};
int main()
{
	int n,i;
	struct bingren *p1,*head;
	struct bingren temp;
	char a[20]={'\0'};
	int b=0;
	scanf("%d",&n);
	head=(struct bingren *)malloc(sizeof(struct bingren));
	head->next=NULL;
	scanf("%s%d",head->id,&head->nian);
	p1=head;
	for(i=1;i<n;i++)
	{
		p1->next=(struct bingren *)malloc(sizeof(struct bingren));
		scanf("%s%d",p1->next->id,&p1->next->nian);
		p1->next->next=NULL;
		p1=p1->next;
	}
	p1=head;
	for(i=1;i<n;i++)
	{
		for(;p1->next!=NULL;)
		{
			if(p1->next->nian >= 60 && p1->next->nian > p1->nian )
			{
				b=p1->nian;
				p1->nian=p1->next->nian;
				p1->next->nian=b;
				strcpy(a,p1->id);
				strcpy(p1->id,p1->next->id);
				strcpy(p1->next->id,a);
			}
			p1=p1->next;
		}
		p1=head;
	}
	p1=head;
	for(;p1!=NULL;)
	{
		printf("%s\n",p1->id);
		p1=p1->next;
	}
}
int main()
{
int n,i,j=0,k,l;
struct patient
{
	char num[10];
	int age;
}p[100],temp;
scanf("%d",&n);
for(i=0;i<n;i++)
{
	do{scanf("%c",&p[i].num[j]);j++;}
	while(p[i].num[j-1]!=' ');
	p[i].num[j-1]='\0';
	scanf("%d",&p[i].age);
	j=0;
}
	for(i=0;i<n;i++)
	{
		k=i;
		for(j=i+1;j<n;j++)
			if(p[j].age>p[k].age) k=j;
		if(k!=i&&p[k].age>=60)
		{
			temp=p[k];
			for(l=k;l>=i+1;l--)
			{	
				p[l]=p[l-1];	
			}
			p[i]=temp;
		}
	}
for(i=0;i<n;i++)
	{
	  printf("%s",p[i].num);if(i!=n-1) printf("\n");
	}
return 0;
}
int main()
{
    int n,h,i,j,k,s,t,p;
    scanf("%d",&n);
    int a[n-1],c[n-1];
    char string[n-1][10],b[n-1][10];
    for(h=0;h<=n-1;h++)
    {
        scanf("%s %d",string[h],&a[h]);
    }
    for(p=0,j=0;p<=n-1;p++)
    {
        if(a[p]>=60)
        {
            c[j]=a[p];
            strcpy(b[j],string[p]);
            j++;
        }
    }
    for(k=1;k<=j;k++)
    { 
        for(s=1;s<=j;s++)
        {   
            for(i=0,t=0;i<j;i++)
            {
                if(c[s-1]>=c[i])
                    t++;
            }
            if(t==j)
            {
                printf("%s\n",b[s-1]);
                c[s-1]=0;
                break;
            }                                                                 
        }
    }
    for(i=0;i<n;i++)  
    { 
        if(a[i]<60)
            printf("%s\n",string[i]);
    }
    getchar();
    getchar();
}
void main()
{
     struct patient
     {
            char ID[16];
            int age;
            int index;
     };
     int n,i,j,t,t1;
     char str[16];
     scanf("%d",&n);
     struct patient pat[n];
     for(i=0;i<n;i++)
       {scanf("%s %d",pat[i].ID,&pat[i].age);
       pat[i].index=i;}
     for(i=0;i<n;i++)
     {    for(j=i+1;j<n;j++)
          {    
               if(pat[j].age>=60&&pat[j].age>pat[i].age)      
               {strcpy(str,pat[i].ID);
               strcpy(pat[i].ID,pat[j].ID);
               strcpy(pat[j].ID,str);
               t=pat[i].age;
               pat[i].age=pat[j].age;
               pat[j].age=t;
               t1=pat[i].index;
               pat[i].index=pat[j].index;
               pat[j].index=t1;}
               if(pat[i].age>=60&&pat[i].age==pat[j].age)
               {
                        if(pat[i].index>pat[j].index)
                        {strcpy(str,pat[i].ID);
               strcpy(pat[i].ID,pat[j].ID);
               strcpy(pat[j].ID,str);
               t=pat[i].age;
               pat[i].age=pat[j].age;
               pat[j].age=t;
               t1=pat[i].index;
               pat[i].index=pat[j].index;
               pat[j].index=t1;}
               }
               
          }
     }
     for(i=0;i<n;i++)
     {
                     for(j=i+1;j<n;j++)
                       if(pat[i].age<60&&pat[i].index>pat[j].index)
                     {strcpy(str,pat[i].ID);
                       strcpy(pat[i].ID,pat[j].ID);
                          strcpy(pat[j].ID,str);
                        t=pat[i].age;
                          pat[i].age=pat[j].age;
                        pat[j].age=t;
                           t1=pat[i].index;
                           pat[i].index=pat[j].index;
                             pat[j].index=t1;}
     }
     for(i=0;i<n;i++)
     
                     
                  puts(pat[i].ID);
               
           
}
int main()
{
	int n,i,j,temp,m=0;
	int patage[100];
	struct patient
	{
		char num[20];
		int age;
	};
	struct patient pat[100];
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
		scanf("%s%d",pat[i].num,&pat[i].age);
	for(i=0,j=0;i<n;i++)
		if(pat[i].age>=60)
		{
			patage[j]=pat[i].age;
			j++;
			m++;
		}
	for(i=0;i<m;i++)
		for(j=0;j<m-i;j++)
		{
			if(patage[j]<patage[j+1])
			{
				temp=patage[j];
				patage[j]=patage[j+1];
				patage[j+1]=temp;
			}
		}
	for(i=0;i<m;i++)
		{
		if(patage[i]==patage[i-1])
			continue;
		for(j=0;j<n;j++)
		    if(pat[j].age==patage[i])
				printf("%s\n",pat[j].num);
		}
	for(i=0;i<n;i++)
	{
		if(pat[i].age>=60)
			continue;
		else
			printf("%s\n",pat[i].num);
	}
	return 0;
}
struct Patient 
{
	char num[10];
	int age;
	struct Patient *next;
};
int main()
{
	void paixu(int n,struct Patient *head);
	struct Patient *creat(int n);
	int n,i;
	struct Patient *head;
	scanf("%d",&n);
	head=creat(n);
	paixu(n,head);
	for(i=0;i<n;i++)
	{
		printf("%s\n",head->num);
		head=head->next;
	}
	
}
struct Patient *creat(int n)
{
	int i;
	struct Patient *head,*thispoint,*nextpoint;
	for(i=0;i<n;i++)
	{
		if(i==0)
		{
			nextpoint=(struct Patient *)malloc(sizeof(struct Patient));
			scanf("%s %d",nextpoint->num,&nextpoint->age);
			head=nextpoint;
			thispoint=head;
		}
		else
		{
			nextpoint=(struct Patient *)malloc(sizeof(struct Patient));
			scanf("%s %d",nextpoint->num,&nextpoint->age);
			thispoint->next=nextpoint;
			thispoint=nextpoint;
		}
	}
	thispoint->next=NULL;
	return head;
}
void paixu(int n,struct Patient *head)
{
	int i,j,k,count;
	struct Patient *p1,*p2,*p3,*p4;
	char tempnum[10],tempnum3[10],tempnum4[10];
	int tempage,tempage3,tempage4;
	p1=head;
	for(i=0;i<n-1;i++)
	{
		if(p1->age<60)
		{
			p2=p1->next;
			for(j=i+1;j<n;j++)
			{
				if(p2->age>59)
				{
					strcpy(tempnum,p2->num);tempage=p2->age;
					p3=p1;p4=p3->next;
					for(k=i;k<j;k++)
					{
						strcpy(tempnum4,p4->num);tempage4=p4->age;
						if(k==i){strcpy(p4->num,p3->num);p4->age=p3->age;}
						else {strcpy(p4->num,tempnum3);p4->age=tempage3;}
						strcpy(tempnum3,tempnum4);tempage3=tempage4;
						p3=p3->next;p4=p4->next;
					}
					strcpy(p1->num,tempnum);p1->age=tempage;
					break;
				}
				else p2=p2->next;
			}
		}
		p1=p1->next;
	}
	p1=head;
	for(i=0,count=0;i<n;i++)
	{
		if(p1->age>59){count++;}
		p1=p1->next;
	}
	p1=head;
	for(i=1;i<count;i++)
	{
		p2=p1;
		for(j=0;j<count-i;j++)
		{
			p3=p2->next;
			if(p2->age<p3->age)
			{
				strcpy(tempnum,p2->num);tempage=p2->age;
				strcpy(p2->num,p3->num);p2->age=p3->age;
				strcpy(p3->num,tempnum);p3->age=tempage;
			}
			p2=p2->next;
		}
	}
}
typedef struct Node
{
	char ID[11];
	int age;
	struct Node *next;
}node;
node *creat(int n)
{
	node *p1,*p2,*head;
	int i;
	p1=p2=(node *)malloc(sizeof(node));
	head=p1;
	for(i=0;i<n;i++)
	{
		p2=p1;
		scanf("%s%d",p1->ID,&p1->age);
		p1=(node *)malloc(sizeof(node));
		p2->next=p1;
	}
	p2->next=NULL;
	return(head);
}
void sort(int x,char *a,node *head)
{
	node *pre=head,*p=pre->next,*s;
	s=(node *)malloc(sizeof(node));
	s->age=x;
	strcpy(s->ID,a);
	s->next=NULL;
	while(p!=NULL&&x<=p->age)
	{
		pre=p;
		p=p->next;
	}
	pre->next=s;
	s->next=p;
}
void print(node *head)
{
	node *p;
	p=head;
	while(p!=NULL)
	{
		printf("%s\n",p->ID);
		p=p->next;
	}
}
void main()
{
	int n;
	node *head1,*head2,*p;
	scanf("%d",&n);
	head1=creat(n);
	head2=(node *)malloc(sizeof(node));
	strcpy(head2->ID," ");
	head2->next=NULL;
	p=head1;
	while(p!=NULL)
	{
		if(p->age>=60)
		    sort(p->age,p->ID,head2);
		p=p->next;
	}
	head2=head2->next;
	print(head2);
	p=head1;
	while(p!=NULL)
	{
		if(p->age<60)
			printf("%s\n",p->ID);
		p=p->next;
	}
}
struct student
{
	char num[10];
	int age;
}line[100];
void main()
{
	int n,i,j,k,temp=0,m,e;
	scanf("%d",&n);
	int a[100]={0},b[100]={0};
	char s[100][10],y[100][10];
	char exchange[10];
	for(i=0;i<n;i++)
	{
		scanf("%s%d",line[i].num,&line[i].age);
	}
	for(i=0;i<n;i++)
	{
		if(line[i].age>=60)
		{
			temp++;
		}
	}
	j=0;
	for(i=0;i<n;i++)
	{
			if(line[i].age>=60)
			{
				strcpy(s[j],line[i].num);
				b[j]=line[i].age;
				j++;
			}

	}
	for(j=0;j<temp;j++)
	{
		for(k=0;k<temp-j;k++)
		{
			if(b[k]<b[k+1])
			{
				e=b[k];
				b[k]=b[k+1];
				b[k+1]=e;
				strcpy(exchange,s[k]);
				strcpy(s[k],s[k+1]);
                strcpy(s[k+1],exchange);
			}
		}
	}
	for(j=0;j<temp;j++)
	{
		printf("%s\n",s[j]);
	}
	m=0;
	for(i=0;i<n;i++)
	{
			if(line[i].age<60)
			{
				strcpy(y[m],line[i].num);
				m++;
			}
	}
    for(j=0;j<n-temp;j++)
	{
	     printf("%s\n",y[j]);
	}
				
	
}
struct stu
{char num[20];
int score;
struct stu * next;
};
void sort(struct stu * head,struct stu * q)
{
	struct stu *pre=head,*p=pre->next,*s;
	s=(struct stu *)malloc(sizeof(struct stu));
	s->score=q->score;strcpy(s->num,q->num);
	s->next=NULL;
	if(s->score>=60){
	while((p!=NULL)&&(q->score<=p->score))
	{
		pre=p;
		p=p->next;
	}
	pre->next=s;
	s->next=p;}
	else
	{while((p!=NULL))
	{
		pre=p;
		p=p->next;
	}
	pre->next=s;
	s->next=p;}
}
void print(struct stu *head)
{
	struct stu *p;
	int i=0;
	p=head;
	while(p!=NULL)
	{
		
	
		printf("%s\n",p->num);
		p=p->next;
	}
	
}
main()
{
	int n,k,i;
	struct stu *head;
	struct stu *p;
	head=(struct stu *)malloc(sizeof(struct stu));
	head->next=NULL;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{	 
		 p=(struct stu *)malloc(sizeof(struct stu));
		 scanf("%s %d",p->num,&p->score);
         sort(head,p);
	}
	print(head->next);

}
int main()
{
	int i,n,f=0,m=0,j;
	
    
	struct 
	{
		char id[10];
		int age;
	} bingren[100],t[100],l[100],c;
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%s%d",&bingren[i].id,&bingren[i].age);
	}
	for(i=0;i<n;i++)
	{
		if(bingren[i].age>=60)
			t[f++]=bingren[i];
		else if(bingren[i].age<60)
		    l[m++]=bingren[i];
	}


	for(i=1;i<f;i++)
	{
		for(j=i;j>0;j--)
		{
		  if(t[j].age>t[j-1].age)
		  {
		  c=t[j];	  
		  t[j]=t[j-1];
		  t[j-1]=c;
		  }
		}
	}
	
	for(i=0;i<f;i++)
	{
		printf("%s\n",t[i].id);
	}

    for(i=0;i<m;i++)
	{
	    printf("%s\n",l[i].id);
	}
	return 0;
}
struct ID{
	char idnum[100];
	int old;
};
int main(){
struct ID ido[100];//???????
struct ID idy[100];//???????
struct ID id[100];//???????
struct ID e;
int n,i,a=0,b=0,j,l,k;
scanf("%d",&n);
for(i=0;i<n;i++){
                         scanf("%s %d",id[i].idnum,&(id[i].old));
                         if(id[i].old>=60){//????60 ????????????????
                                              strcpy(ido[a].idnum, id[i].idnum);
                                              ido[a].old=id[i].old;
                                              a++;
                          }else {//?????????????????
                                 strcpy(idy[b].idnum, id[i].idnum);
                                 idy[b].old=id[i].old;
                                 b++;
            }
}

for(k = 1 ; k <= a ; k++){//?????????
	for(i = 0; i < a - k; i++){
			if(ido[i].old < ido[i+1].old){
					e = ido[i+1];
					ido[i+1] = ido[i];
				    ido[i] = e;
			}
	}
}

for(j=0;j<a;j++){//????
	printf("%s\n",ido[j].idnum);
}
for(l=0;l<b;l++){
	printf("%s\n",idy[l].idnum);
}

return 0;
}
int main()
{
    int n,i,j,t,m,l;
    int b[100],d[100],g[100];
    char a[100][10],c[100][10],e[10],f[100][10];
    m=0;
    l=0;
    t=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s %d",a[i],&b[i]);
    }
    for(i=0;i<n;i++)
    {
        if(b[i]>=60)
        {
            strcpy(c[m],a[i]);
            d[m]=b[i];
            m=m+1;          
        } 
        else
        {
            strcpy(f[l],a[i]);
            g[l]=b[i];
            l=l+1;
            
        }   
    }
    for(i=0;i<m-1;i++)
    {
        for(j=0;j<m-i-1;j++)
         {
                          if(d[j]<d[j+1])
            {    
             t=d[j];
             d[j]=d[j+1];
             d[j+1]=t;
             strcpy(e,c[j]);
             strcpy(c[j],c[j+1]);
             strcpy(c[j+1],e);
            }
            }
    }
    for(i=0;i<m;i++)
    printf("%s\n",c[i]);
    for(i=0;i<l;i++)
    printf("%s\n",f[i]);
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    getchar();
    getchar();
}
int main()
{
	struct Patient
	{
		int flag;
		char id[10];
		int age;
	};
	struct Patient p[100],p2[100],temp;
	int n,i,t=0,k,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d",&p[i].id,&p[i].age);
		p[i].flag=0;
		if(p[i].age>=60)
		{
			t=t+1;
			p[i].flag=1;
		}
		p2[i]=p[i];
	}
/*
	for(i=0;i<n-1;i++)
	{
		k=i;
		for(j=i+1;j<n;j++)
		{
			if(p[j].age>p[k].age) k=j;
		}
		if(k!=i)
		{
			temp=p[i];
			p[i]=p[k];
			p[k]=temp;
		}
	}
*/
	  for(i=0;i<n-1;i++)
	  {
		  for(j=0;j<n-1-i;j++)
			  if(p[j].age<p[j+1].age)
			  {   
				  temp=p[j];
				  p[j]=p[j+1];
				  p[j+1]=temp;
			  }
	  }
	for(i=0;i<t;i++)
	{
		printf("%s\n",p[i].id);
	}
	for(i=0;i<n;i++)
	{
		if(p2[i].flag==0) printf("%s\n",p2[i].id);
	}
	return 0;
}

/*
int main()
{
	struct patient
	{
		char ID[10];
		int age;
	}patient1[100];
	struct patient patient2[100];
	struct patient temp;
	int n,i,s=0,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d",&patient1[i].ID,&patient1[i].age);
	}
	for(i=0;i<n;i++)
	{
		if(patient1[i].age>=60)
		{
			patient2[s]=patient1[i];
			s++;
		}
	}
    for(j=0;j<s-1;j++)
	{
		for(i=0;i<s-1-j;i++)
		{
			if(patient2[i].age<patient2[i+1].age)
			{
				temp=patient2[i];
				patient2[i]=patient2[i+1];
				patient2[i+1]=temp;
			}
		}
	}
	for(i=0;i<s;i++)
	{
		printf("%s\n",patient2[i].ID);
	}
	for(i=0;i<n;i++)
	{
		if(patient1[i].age<60)
		{
			printf("%s\n",patient1[i].ID);
		}
	}
	return 0;
}
*/
struct patient
{
	char num[10];
	int age;
}a[100];
void main()
{
      int max(int b[],int m);
		int n,i,j=0,c[100],g;
     scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%s%d",&a[i].num,&a[i].age);
	for(i=0;i<n;i++)
		c[i]=a[i].age;
 g=max(c,n);
    while (g>=60)
	{         
		     for(i=0;i<n;i++)
			 {if (c[i]==g)
			 {
		     printf("%s\n",a[i].num);
			 c[i]=0;
			 }
			 }
		   g=max(c,n);
			 
	 }
		 for(i=0;i<n;i++)
		 {

			 if (a[i].age<60)
				 printf("%s\n",a[i].num);
		 }
}
int max(int b[],int m)
{
	int t,s;
  s=b[0];
  for(t=0;t<m;t++)
  {
  if (s<b[t])
	  s=b[t];
  }
  return(s);
}
struct student{
char num[20];
int age;
struct student *next;
};
int n,i;
struct student *create()
{
	struct student *head;
	struct student *p1,*p2;
	head=NULL;
	scanf("%d",&i);
	n=0;
	p1=p2=(struct student *)malloc(len);
	scanf("%s %d",p1->num,&p1->age);
	while(n!=i-1)
	{
		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(len);
		scanf("%s %d",p1->num,&p1->age);
	}
	p2->next=p1;
	p1->next=NULL;
	return(head);
}
void paixu(struct student *p){
	struct student *p1,*p2;
  char temp[20];
	int temp2; 
	for(n=1;n<i;n++){
		p2=p;
	p1=p->next;
	while(p1!=NULL){
			if(p1->age>=60&&p2->age<60){
				
	strcpy(temp,p1->num);
				strcpy(p1->num,p2->num);
				strcpy(p2->num,temp);	
	temp2=p1->	age;
		p1->age=p2->	age;
	p2->age=temp2;
}
			else if(p1->age>p2->age&&p2->age>=60){
				strcpy(temp,p1->num);
				strcpy(p1->num,p2->num);
				strcpy(p2->num,temp);	
	temp2=p1->	age;
		p1->age=p2->	age;
	p2->age=temp2;

	}
			p2=p1;
			p1=p1->next;
		}
	}
}
void print(struct student *p)
{
	while(p!=NULL)
	{
		printf("%s",p->num);
		p=p->next;
		if(p!=NULL)
			printf("\n");
	}
}
void main()
{
	struct student *p;
	p=create();
	paixu(p);
	print(p);
}
struct patient{
		char ID[10];
		int age;
};

void paixu(struct patient pat[],int n)
{
	
	struct patient t;
	int i;
	int k;

	for(k=1;k<n;k++){
		for(i=0;i<n-k;i++){
			if(pat[i].age<pat[i+1].age){
				t=pat[i];
				pat[i]=pat[i+1];
				pat[i+1]=t;
			}
		}
	}
}

int main()
{
	struct patient pat;
	struct patient oldpat[100];
	struct patient youngpat[100];	

	int n;
	int i;
	int m=0;
	int k=0;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d",pat.ID,&pat.age);
		if(pat.age>=60){
			oldpat[m]=pat;
			m++;
		}else{
			youngpat[k]=pat;
			k++;
		}
	}

	paixu(oldpat,m);

	for(i=0;i<m;i++){
		printf("%s\n",oldpat[i].ID);
	}
	for(i=0;i<k;i++){
		printf("%s\n",youngpat[i].ID);
	}

	return 0;
}
struct patient
{
       char ID[10];
       int age;
       struct patient *next;
};

struct patient *creat(void)
{
       struct patient *head;
       struct patient *p1,*p2;
       int num;
       scanf("%d",&num);
       p2=NULL;
       p1=(struct patient *)malloc(LEN);
       head=p1;
       while(num>0)
       {
                   p2=p1;
                   scanf("%s %d",&p1->ID,&p1->age);
                   p1=(struct patient *)malloc(LEN);
                   p2->next=p1;
                   num--;
       }
       p2->next=NULL;
       return(head);
}  
    
struct patient *sort(struct patient *head)
{
	struct patient *first; 
    struct patient *tail; 
	struct patient *p_max; 
	struct patient *max; 
	struct patient *p; 
	first = NULL;
	while (head != NULL) 
	{
		for(p=head,max=head; p->next!=NULL; p=p->next)
		{   
			if (p->next->age>max->age&&p->next->age>=60)
			{
				p_max = p;
				max = p->next;
			} 
		}
		if (first == NULL)
		{
			first = max;
			tail = max;
		}
		else
		{
			tail->next = max;
			tail = max;
		}
		if (max == head)
		{
			head = head->next;
		}
		else
		{
			p_max->next = max->next;
		}
	}
	if (first != NULL)
	{
		tail->next = NULL;
	}
	head = first;
	return head;
}
        
void print(struct patient *head)
{
     struct patient *p;
     p=head;
     while(p!=NULL)
     {
                   printf("%s\n",p->ID);
                   p=p->next;
     }               
}          
int main()
{
    struct patient *head;
    int n,i,j;
    head=creat();
    head=sort(head);
    print(head);
   }

/*?????????????????????????????????????a?b,??b??>a????b>=60????????
???????????????????????60+???60-?????????????????......*/
main()
{
    struct p
    {char num[100];
     int age;
    } p[101];
    int n,i,j,k,m=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++) scanf("%s %d",&p[i].num,&p[i].age);
    struct q
    {char num[100];
     int age;
    } q[101];
    for(i=1,j=1;i<=n;i++) {if(p[i].age>=60) {strcpy(q[j].num,p[i].num);q[j].age=p[i].age;j++;m=m+1;}}
    for(j=1;j<=m;j++)
    {
                     for(i=1;i<=m-1;i++)
                     {
                                        if(q[i].age<q[i+1].age)
                                        {
                                                               q[101]=q[i];
                                                               q[i]=q[i+1];
                                                               q[i+1]=q[101];
                                        }
                     }
    }
    printf("%s",q[1].num);
    for(i=2;i<=m;i++) printf("\n%s",q[i].num);
    for(i=1;i<=n;i++) if(p[i].age<60) printf("\n%s",p[i].num);
}
struct pat
{
      char num[10];
      int age;
}pat[100],str[100],t;
int main()
{

	int n,i,j,a=-1,temp;
	int ch[100];
	char c[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d",pat[i].num,&pat[i].age);
		if(pat[i].age>=60)
		{	
		     a++;
             strcpy(str[a].num,pat[i].num);
			 str[a].age=pat[i].age;
		}
	}
	for(i=a;i>=1;i--)
	{
		for(j=0;j<i;j++)
		{
			if(str[j].age<str[j+1].age)
			{
				t=str[j];
				str[j]=str[j+1];
				str[j+1]=t;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(pat[i].age<60)
		{
			a++;
            str[a]=pat[i];
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%s\n",str[i].num);
	}
}