semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student
{
	char num[20];
	char name[21];
	char sex;
	int age;
    char score[20];
	char address[21];
	struct student *next;
};
int n;

struct student *create(void)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(length);
	scanf("%s",p1->num);
	head=null;
	while(strcmp(p1->num,"end")!=0)
	{
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
		n=n+1;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(length);
		scanf("%s",p1->num);
	}
	p2->next=null;
	return head;
}
void print(struct student *head)
{
	struct student *p,*q;
	p=head;
	if(head!=null)
	{
		do
		{
			printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
			q=p;
			p=p->next;
			free(q);
		}
		while(p!=null);

	}
}

struct student *converse(struct student *head)
{
	struct student *p1,*p2,*p3;
	p1=p2=head;

	if(head!=null)
	{
		while(p2->next!=null)
		{
			p3=p2->next;
			if(p2==head) p2->next=null;
			else p2->next=p1;
			p1=p2;
			p2=p3;
		}
		p2->next=p1;
		head=p2;
	}
	return head;
}

void main()
{
	
	struct student *p=create();
	p=converse(p);
	print(p);
}
struct stu
{
	char infor[1000];
	struct stu *next;
} *p1,*p2;
struct stu *creat(void)
{   struct stu *head=NULL;
	   p2=p1=(struct stu*)malloc(sizeof(struct stu));
   gets(p1->infor);
	while(strcmp(p1->infor,"end")) 
	{
		if(head==NULL) head=p1;
	else  p2->next=p1;p2=p1;	
	p1=(struct stu*)malloc(sizeof(struct stu));
	gets(p1->infor);
	}

p2->next=NULL;
return(head);
}
struct stu *back(struct stu *head)
{
	struct stu *newp,*newhead=NULL;
	do{ p2=NULL;p1=head;
	while(p1->next!=NULL) {p2=p1;p1=p1->next;}
		if(newhead==NULL) newhead=p1,newp=newhead->next=p2;
		newp=newp->next=p2;
		p2->next=NULL;	
	}while(head->next!=NULL);
return (newhead);
}
void main()
{struct stu *head;
head=creat();
  head=back(head);
 for(p1=head;p1!=NULL;p1=p1->next)
  printf("%s\n",p1->infor);
 

}
struct s
{
      char a[100];
      char b[100];
      char c;
      int d;
      char e[100];
      char f[100];
      struct s *t;
      }k[1000];
int n;
int main(int argc, char *argv[])
{ int i;
    struct s *head,*p;
  for(i=0;;i++)
  {
     scanf("%s",k[i].a);
     if(strcmp(k[i].a,"end")==0)
     break;
     scanf(" %s %c %d %s %s",k[i].b,&k[i].c,&k[i].d,k[i].e,k[i].f);
     if(i>0)
     k[i].t=&k[i-1];
     if(i==0)
     k[i].t=NULL;
  }
  head=&k[i-1];
  p=head;
  do{
  printf("%s %s %c %d %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
  p=p->t;}
  while(p!=NULL);
  return 0;
}
char info[1000][1000];
int main() {
	int k=0;
	while(1) {
		cin.getline(info[k],999);
		if (info[k++][0]=='e') break;
	}
	k-=2;
	for (;k>=0;k--) {
		cout<<info[k]<<endl;
	}
	return 0;
}
struct student
{
	char str[100];
	struct student *next;
};

struct student *creat(void)
{struct student *head;
 struct student *p1,*p2,*p3;
 p1=p2=p3=(struct student *)malloc(LEN);
 gets(p1->str);
 while(strcmp(p1->str,"end")!=0)
 {
   p1=(struct student *)malloc(LEN);
   gets(p1->str);
   head=p1;
   p1->next=p2;
   p2=p1;
 }
 p3->next=0;
 return(head);
}

void print(struct student *head)
{
	struct student *p;
	p=head->next;
	do
	{
		puts(p->str);
		p=p->next;
	}while (p->next!=0);
		puts(p->str);
} 

main()
{
	struct student *head;
	head=creat();
	print(head);
}
struct student
{
	char id[100],name[100],sex[2];
	char sco[100];
	int age;
	char pos[100];
	struct student *pre;
};
int n;
struct student*creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s",&p1->id);
	if(strcmp(p1->id,"end")!=0)
	{
		scanf("%s%s%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->sco,&p1->pos);
	}
	head=NULL;
	while(strcmp(p2->id,"end")!=0)
	{
		n=n+1;
		if(n==1)
		{	
			head=p1;
			p1->pre=NULL;
		}
		else
			p2->pre=p1;
		p1=p2;
		p2=(struct student*)malloc(LEN);
		scanf("%s",&p2->id);
		if(strcmp(p2->id,"end")!=0)
		{
			scanf("%s%s%d%s%s",&p2->name,&p2->sex,&p2->age,&p2->sco,&p2->pos);
		}
	}
	return p1;
}
void print(struct student*head)
{
		struct student*p;
		p=head;
		if(head!=NULL&&strcmp(head->id,"end")!=0)
		{
			do
			{
				printf("%s %s %s %d %s %s\n",p->id,p->name,p->sex,p->age,p->sco,p->pos);
				p=p->pre;
			}while(p!=NULL);
		}
}
main()
{
	struct student*last;
	last=creat();
	print(last);
	return 0;
}
struct student
	{
	char info[100];
	struct student *next;
	};
int n;
struct student*creat(void)
{struct student *head,*p1,*p2;
 p1=p2=(struct student*)malloc(LEN);
 gets(p1->info);
 p1->next=null;
 while(strcmp("end",p1->info)!=0)
	{head=p1;
	p1=(struct student*)malloc(LEN);	  
	  p1->next=p2;
	  p2=p1;
	  
	  gets(p1->info);
	}
 return(head);
}
void print(struct student*head)
{struct student*p;
 p=head;
 while(p!=null)
	{printf("%s\n",p->info);
     p=p->next;
	}
}
main()
{struct student*head;
 head=creat();
 print(head);
}
void main()
{
	int n;
	struct student
	{
		char num[50];
		char name[100];
		char sex;
		int age;
		char score[20];
		char add[100];
		struct student *before;
	}*thisNode,*newNode;
	for(n=1;;n++)
	{
		newNode=(struct student *)malloc(sizeof(struct student));
		if(newNode==NULL)
		{
			printf("error!");
			exit(-1);
		}
		scanf("%s",newNode->num);
		if(n==1)
			newNode->before=NULL;
		else
			newNode->before=thisNode;
		if(newNode->num[0]=='e')
			break;
		scanf("%s %c %d %s %s",newNode->name,&newNode->sex,
			&newNode->age,newNode->score,newNode->add);
		thisNode=newNode;
	}
	for(;;)
	{
		printf("%s %s %c %d %s %s\n",thisNode->num,thisNode->name,thisNode->sex,
			thisNode->age,thisNode->score,thisNode->add);
		if(thisNode->before==NULL)
			break;
		thisNode=thisNode->before;
	}
}
struct stu
{
	char num[1000];
	struct stu*next;
};
struct stu*f()
{
	struct stu*head;
	struct stu*p,*q;
	p=q=0;
	p=(struct stu*)malloc(l);
	p->next=q;
	gets(p->num);
	q=p;
	while(1)
	{
		p=(struct stu*)malloc(l);
		p->next=q;
		q=p;
		gets(p->num);
		if(p->num[0]=='e') break;
	}
	head=p;
	return(head);
}
void y(struct stu*head)
{
	struct stu*p,*q;
	p=q=head;
	p=q->next;
	while(p!=0)
	{
		puts(p->num);
		q=p;
		p=q->next;
	}
}
main()	
{
	y(f());
	return 0;
}
struct node
{
	char str[100];
	struct node *next;
};

void main()
{
	struct node *head=NULL, *element;
	char str[100];
	gets(str);
	while(strcmp(str,"end"))
	{
		element=(struct node *)malloc(sizeof(struct node));
		strcpy(element->str,str);
		element->next=head;
		head=element;
		gets(str);
	}
	while(head!=NULL)
	{
		puts(head->str);
		head=head->next;
	}
}
struct stu
{char num[50];
char name[50];
char gentle;
int age;
int score;
char add[50];
struct stu *next;
};
int n;
struct stu *creat(void)
{
	struct stu *head,*p1,*p2;
	n=0;
	p1=p2=(struct stu *)malloc(sizeof(struct stu));
         gets(p1->num);
	head=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
	n++;
	if(n==1) p1->next=NULL;
	else {p1->next=p2;}
	p2=p1;
	head=p2;
	p1=(struct stu *)malloc(sizeof(struct stu));
	gets(p1->num);
	}
	return head;
}
void print(struct stu *head)
{
	struct stu *p;
	p=head;
	while(p!=NULL)
	{
		printf("%s\n",p->num);
		p=p->next;
	}
}
void main()
{
	struct stu *head;
	head=creat();
	print(head);
}
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char adress[20];
	struct student *next;
};
int n;
struct student *input(void)
{
	struct student *p,*q,*head;
	int n=0;
	p=q=(struct student *)malloc(sizeof(struct student));
	scanf("%s %s %c %d %s %s\n",p->num,p->name,&p->sex,&p->age,p->score,p->adress);
	head=null;
	while(strcmp(p->num,"end")!=0)
	{
		n=n+1;
		if(n==1)
		{
			head=p;
		}
		else
		{
			q->next=p;
		}
		q=p;
		p=(struct student*)malloc(sizeof(struct student));
		scanf("%s %s %c %d %s %s\n",p->num,p->name,&p->sex,&p->age,p->score,p->adress);
	}
	q->next=null;
	return(head);
}
void output(struct student *head)
{
	struct student *p;
	p=head;
	if(head!=null)
		do
		{
			printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adress);
			p=p->next;
		}
		while(p!=null);
}
struct student *exchange(struct student * head)
{
	struct student *p,*q,* n,* nhead=null;
	do{
		q=null;
		p=head;
		while(p->next!=null)
		{
			q=p;
			p=p->next;
		}
		if(nhead==null)
		{
			nhead=p;
			n=nhead->next=q;
		}
		n=n->next=q;
		q->next=null;
	}while(head->next!=null);
	return(nhead);
}
int main()
{
	struct student *input(void);
	struct student *exchange(struct student *);
	void output(struct student *);
	struct student *a,*b;
	a=input();//??input???????a
	b=exchange(a);
	output(b);
	return 0;
}
struct STUDENT
{
	struct STUDENT *former;
	char num[20];
	char name[20];
	char sex;
	int age;
	float score;
	char address[20];
	struct STUDENT *next;
};
struct STUDENT stu;

void main()
{
	struct STUDENT *head,*p1,*p2,*p3;
	head=p1=p2=&stu;
	p3=NULL;
	for (;;)
	{
		scanf ("%s",p1->num);
		if (p1->num[0]=='e')
		{
			p2=p1->next;
			p2=NULL;
			p1=p3;
			break;
		}
		scanf ("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		p2=p1->next;
		p2=(struct STUDENT *)malloc(LEN);
		p1->former=p3;
		p3=p1;
		p1=p2;
	}
	for (;;)
	{
		printf ("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p2=p1->former;
		p1=p2;
		if (p2==NULL)
			break;
	}
}
struct student
{
	char a[200];
	
	struct student *next;
};

struct student *creat ()
{
	struct student *p1,*p2,*head;
	int n=0;
	p1=(struct student*)malloc(sizeof (struct student));
	gets(p1->a);
	p2=p1;
	head=NULL;
	
	while(strcmp(p1->a,"end")!=0)
	{
		n=n+1;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(sizeof (struct student));
		gets(p1->a);
		
	}
	p2->next=NULL;
	
	return(head);
}
void main()
{
	struct student *p,*head,*q;
	head=creat();
	p=head;
	while(1)
	{
		if(p->next!=NULL){q=p;p=p->next;}
	
	if(p->next==NULL&&q!=head)
			{
				printf("%s\n",p->a);
				q->next=NULL;p=head;
			}
			if(p->next==NULL&&q==head)
			{
				printf("%s\n",p->a);
				printf("%s",q->a);break;
			}
	}
	
}
struct student
{
	char NO[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct student *prev;
};
void main()
{
	struct student *END;
	struct student *p1,*p2;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s %s %c %d %s %s",&p1->NO,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
	p1->prev=0;
	p1=(struct student*)malloc(LEN);
	for(;;)
	{
		scanf("%s",&p1->NO);
		if(strcmp(p1->NO,"end")==0)
		{
			END=p2;
			break;
		}
		scanf(" %s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->add);
		p1->prev=p2;
		p2=p1;
		p1=(struct student*)malloc(LEN);
	}
	for(p1=END;p1!=0;)
	{
		printf("%s %s %c %d %s %s\n",p1->NO,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->prev;
	}
}
struct student
{
	char infor[100];
	struct student *next;
}*p1,*p2;
struct student *creat(void)
{
	struct student *head;
	head=0;
	p1=0;
	p2=0;
	while(1)
	{
		p1=(struct student *)malloc(LEN);
		gets(p1->infor);
		if(strcmp(p1->infor,"end")==0)
			break;
		if(head==0)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
	}
	p2->next=0;
	return(head);
}
struct student *turnback(struct student *head)
{
	struct student *newhead=0,*p,*q,*r;
	do
	{	
		p=head;
		q=0;
		while(p->next!=0)
		{
			q=p;
			p=p->next;
		}
		if(newhead==0)
		{
			newhead=p;
			newhead->next=q;
		}
		else
		{
			r=p;
			r->next=q;
		}
		q->next=0;
	}while(head->next!=0);
	return(newhead);
}

void output(struct student *head)
{
	struct student *p;
	for(p=head;p->next!=0;p=p->next)
		printf("%s\n",p->infor);
	printf("%s\n",p->infor);
}
void main()
{
	struct student *head;
	head=creat();
	head=turnback(head);
	output(head);
}
struct student
{
	 char num[20];
	 char name[20];
	 char sex;
	 int age;
	 char score[10];
	 char add[30];
	 struct student *next;
}*p1,*p2;

struct student *input(void)
{
	char temp[100]={0};
	struct student *head=NULL;

	while(gets(temp))
	 {
		if(strcmp(temp,"end")==0)break;
	    p1=(struct student *)malloc(sizeof(struct student));
	    sscanf(temp,"%s%s %c %d %s%s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
  
	    if(head==NULL)
		{
			head=p1,p2=p1;
		}
	    else
		{ 
			p2->next=p1;
			p2=p1;
			p2->next=NULL;
		}
	 }
	 return(head);
} 

struct student *sort(struct student *head)
{
 struct student *n,*newhead=NULL;
	 do
	 {
		  p2=NULL;
		  p1=head;
		  while(p1->next!=NULL) p2=p1,p1=p1->next;
		  if(newhead==NULL)
		   newhead=p1,n=newhead->next=p2; 
		  n=n->next=p2;
		  p2->next=NULL;
	 }while(head->next!=NULL);
	
	 return(newhead);
}

void output(struct student *outhead)
{
	for(p1=outhead;p1!=NULL;p1=p1->next)
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}

int main()
{
	 struct student *head;
	 head=input();
	 head=sort(head);
	 output(head);
	 printf("\n");
	 return 0;
}
struct student//?????
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[30];
	struct student *next;
};

struct student *creat(void)//????????CREAT?????
{

	struct student *p1,*p2;
	p1=p2=(struct student *)malloc(LEN);//????????
	p2->next=NULL;
	scanf("%s",p1->num);//??num
    while(strcmp(p1->num,"end")!=0)//?NUM????????
	{
		scanf("%s %c%d%s%s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);//????????
		p1=(struct student *)malloc(LEN);//???????
		p1->next=p2;//????
		p2=p1;
        scanf("%s",p1->num);//????????
	}
	return(p2);
}


void print(struct student *head)//??????
{
	struct student *p;
	p=head->next;
	if(p!=NULL)
		do
		{printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
		}while(p!=NULL);
}

void main()//?????
{   
    struct student*head;
	struct student *creat(void);//????
	void print(struct student *);//????
    head=creat();//??????
    print(head);//??????
}
struct stu
{ char no[20],sx,nm[30],rm[20],mk[10];
  int age;
  struct stu* next;
};
main()
{  struct stu *p1,*p2,*head;
   int i;
   void output(struct stu *p,struct stu* p2);
   for(i=0;;i++)
   {  p1=(struct stu*)malloc(L);

      if(i==0)head=p1;
      scanf("%s",p1->no);
      if(strcmp(p1->no,"end")==0)break;
      else
      { if(i==0)head=p1;
	 scanf("%s %c%d%s%s",p1->nm,&p1->sx,&p1->age,p1->mk,p1->rm);
	if(i==0){head->next=NULL;p2=head;}
	else {
	p2->next=p1;
	p2=p1;
	p2->next=NULL;}
      }
   }
   output(head,head);
}
void output(struct stu* p,struct stu* p2)
{
  if(p->next!=NULL)output(p->next,p2);
  printf("%s %s %c %d %s %s",p->no,p->nm,p->sx,p->age,p->mk,p->rm);
  if(p!=p2)printf("\n");

}
/*
  ?????
           ??????????????????????????
           ????????????????????????
           ?????????????????????????????????????????????????????
*/



//???struct Student???????????????

typedef struct Stu{
	char stu_id[20];           //??
	char name[20];             //??
	char gender;               //??
	int age;                   //??
	char score[20];                 //??
	char address[50];          //??
	struct Student* next;      //???
	struct Student* prev;      //???
}Student;


int main()
{
	char start[50];
	
	Student* head = NULL; //??????????
	Student* tail = NULL; //??????????


        //?????????????
	while(scanf("%s",start)) //?????????????
	{
		if(strcmp(start,"end") != 0) //?????????end, ?????????????????????????????????
		{
			Student *stu = (Student*)malloc(sizeof(Student));               //??????????????
			strcpy(stu->stu_id,start); //?????
			if(scanf(" %s %c %d %s %s",stu->name,&stu->gender,&stu->age,stu->score,stu->address)) //??????
			{
                                //?????????????????
				stu->next = NULL; 
				stu->prev = NULL;
 
				if(head == NULL)  //?????????????????head????tail???
				{
					head = stu;
					tail = stu;
				}
				else //????????????????????tail?next??????????????tail, ????tail???
				{
					tail->next = stu;
					stu->prev = tail;
					tail = tail->next;
				}
			}
		}
		else    // ???????????end, ?????
			break;
	}


        //??????????????????????
	while(tail != NULL)
	{
		printf("%s %s %c %d %s %s\n",tail->stu_id,tail->name,tail->gender,tail->age,tail->score,tail->address); //??????
		head = tail;
		tail = tail->prev; //???????????
		free(head);
	}

	return 0;
}
struct stdnt
{
char num[20];
char name[20];
char gndr;
int age;
double score;
char adrs[30];
struct stdnt* next;
};

int n;

struct stdnt *creat()
{
struct stdnt *p1,*p2=0;
p1=(struct stdnt*)malloc(LEN);
for (n=0;;n++)
    {
    if (n==0) p1->next=0;
    scanf("%s",p1->num);
    if (strcmp(p1->num,"end")==0) 
       break;
    else p2=p1;
    scanf("%s %c%d%lf %s",p1->name,&p1->gndr,&p1->age,&p1->score,p1->adrs);
    p1=(struct stdnt*)malloc(LEN);
    p1->next=p2;
    }
return p1->next;
}

void output(struct stdnt* p)
{
while (p!=0)
      {
      printf("%s %s %c %d %g %s\n",p->num,p->name,p->gndr,p->age,p->score,p->adrs);
      p=p->next;
      }
}

int main()
{
struct stdnt *p;
p=creat();
output(p);

}
struct student
{char num[20];
 char name[20];
 char sex;
 int age;
 char grade[20];
 char address[20];
 struct student *next;
};
int n;

struct student *create(void)
{
	struct student *head;
	struct student *p1,*p2;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address);
	for(n=0;p1->sex=='f' || p1->sex=='m' ;n++)
	{
		if(n==0) p1->next=NULL;
		else p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s %s %c %d %s %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->grade,&p1->address);
	}
	head=p2;
	return(head);
}

void print(struct student *head)
{
	struct student *p;
	if (head!=NULL)
		for (p=head;p!=NULL;p=p->next)
			printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
}


void main()
{
	struct student *head;
	head=create();
	print(head);

}
/*?? ?? ?? ?? ?? ??*/
struct student
{
	struct student *pre;
	char num[100];
	char name[20];
	char sex[2];
	char age[10];
	char score[10];
	char ad[100];
	struct student *next;
};
void main()
{
	int n=0;
	struct student *end,*p1,*p2,*p;
	p1=(struct student *)malloc(LEN);
	scanf("%s",p1->num);
	while(strcmp(p1->num,"end")!=0)
	{
		scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->ad);
		n=n+1;
		if(n==1) 
		{
			p1->pre=NULL;
			p2=p1;
		}
		else
			p1->pre=p2;
			p2=p1;
			p1=(struct student *)malloc(LEN);
			scanf("%s",p1->num);
	}
	end=p2;
	p=end;
	do
	{
		printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad);
		p=p->pre;
	}while(p!=NULL);

}
struct student
{
	char num[10];
	char name[20];
	char sex[5];
	int age;
	char score[20];
	char addr[20];
	struct student *next;
};
struct student *head;
struct student *input()
{
	struct student *p1,*p2;
		p1=p2=(struct student *)malloc(sizeof(struct student));
		scanf("%s",p1->num);
		p2->next=NULL;
		while(strcmp(p1->num,"end")!=0)
		{
			scanf("%s",p1->name);
			scanf("%s",p1->sex);
			scanf("%d",&p1->age);
			scanf("%s",p1->score);
			scanf("%s",p1->addr);
			p1=(struct student *)malloc(sizeof(struct student));
			scanf("%s",p1->num);
			p1->next=p2;
			p2=p1;
		}
			head=p1;
			return(head);
}
void print(struct student *head)
{
	struct student *p;
	p=head->next;
	if(head!=NULL)
		do
		{
			printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->addr);
			p=p->next;
		}
		while(p!=NULL);
}
main()
{
	input();
	print(head);
	return 0;
}
struct stu
{
	char xuehao[20];
	char xingming[30];
	char xingbie;
	int nianling;
	char defen[10];
	char dizhi[20];
	struct stu *last;
};
main()
{
struct  stu  a[10000],*p;
int i=0;
a[0].last=NULL;
for(;;i++)
{
scanf("%s",a[i].xuehao);
if(a[i].xuehao[0]=='e')
break;
scanf("%s %c %d %s %s",a[i].xingming,&a[i].xingbie,&a[i].nianling,a[i].defen,a[i].dizhi);
if(i>0)
{
a[i].last=a+i-1;
}
p=(a+i);
}

while(p!=NULL)
{
printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->nianling,p->defen,p->dizhi);
p=p->last;
}
}
struct student
{char num[10];
char name[20];
char sex;
int age;
char score[10];
char adr[30];
struct student *previous;
};
void main()
{struct student *end,*head;
struct student *p1,*p2, *p;
/*p1=(struct student *)malloc(LEN);*/
p2=head=NULL;
while(1)
{p1=(struct student*)malloc(LEN);
scanf("%s",&p1->num);
if (strcmp(p1->num,"end")==0){/*delete p1;*/break;}
scanf(" %s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
if(head==NULL)head=p1;
else p1->previous=p2;
p2=p1;
}
/*p1->previous=p2;*/
end=p2;
p=end;
if(end!=NULL)
do
{printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
p=p->previous;
}while(p!=NULL);
}
struct s{
	char xuehao[20];
	char xingming[20];
	char xingbie;
	int age;
	char score[20];
	char add[20];
	struct s *next;
};
int main(){
	struct s *A(void);
	struct s *head,*p;
	head=A();
	p=head;
	if(head!=NULL){
		while(p->next!=NULL){
			printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add);
			p=p->next;
		}
		printf("%s %s %c %d %s %s\n",p->xuehao,p->xingming,p->xingbie,p->age,p->score,p->add);
	}
	return 0;
} 

struct s *A(void){
	struct s *head,*p1,*p2;
	head=(struct s*)malloc(sizeof(struct s));
	scanf("%s %s %c %d %s %s",head->xuehao,head->xingming,&head->xingbie,&head->age,head->score,head->add);
	head->next=NULL;
	p1=head;
	for(;;){
		p2=(struct s*)malloc(sizeof(struct s));
		scanf("%s",p2->xuehao);
		if(strcmp(p2->xuehao,"end"))
			scanf(" %s %c %d %s %s",p2->xingming,&p2->xingbie,&p2->age,p2->score,p2->add);
		else 
			break;
		p2->next=p1;
		p1=p2;
	}
	p2->next=p1;
	return (p1);
}
struct student 
{char num[10];
char name[20];
char fm;
int age;
int score;
char add[50];
struct student *next;
       };
int n;
struct student *creat(void)
{struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
gets(p1->num);
head=NULL;
while(strcmp(p1->num,"end")!=0)
{n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;p2=p1;head=p2;
p1=(struct student*)malloc(LEN);
gets(p1->num);
                 }

return head;
}

int main()
{struct student *head;
struct student *p1,*p2;
struct student *creat(void);
head=creat();
void print (struct student *head);
print(head);
    }
    
void print (struct student *head)
{struct student *p;
p=head;
if(head!=NULL)
do  {printf("%s\n",p->num);
p=p->next;}while (p!=NULL);
     }
struct student
{
	char c[60];
	struct student *next;
};
struct student *creat(void)
{
	struct student *head,*p1;
	p1=(struct student *) malloc(LEN);
	head=p1;
	head->next=NULL;
	gets(p1->c);
	while(strcmp(p1->c,"end"))
	{
	p1=(struct student *) malloc(LEN);
		gets(p1->c);
	p1->next=head;
	head=p1;
	}
	return(head);
}
void print(struct student *head)
{
	struct student *p=head->next;
	do{puts(p->c);p=p->next;}while(p->next!=NULL);
	puts(p->c);
}
void main()
{
	struct student *p=creat();
	print(p);
}
struct stu
{
	char xh[20],mz[20],xb,dz[20],df[20];
	int nl;
};
int main()
{
	struct stu a[10000];
	int n=0,i;
	char str[4]="end",c;
	scanf("%s",a[0].xh);
	while(strcmp(a[n].xh,str)!=0)
	{
		scanf("%s",a[n].mz);
		c=getchar();
		scanf("%c",&a[n].xb);
		scanf("%d",&a[n].nl);
		scanf("%s",&a[n].df);
		c=getchar();
		scanf("%s",a[n].dz);
		c=getchar();
		n++;
		scanf("%s",a[n].xh);
		c=getchar();
	}
	for(i=n-1;i>=0;i--)
	printf("%s %s %c %d %s %s\n",a[i].xh,a[i].mz,a[i].xb,a[i].nl,a[i].df,a[i].dz);
	return 0;
}
struct student
{
	char num[20];
	char name[20];
	char sex[5];
	char age[5];
	char score[10];
	char address[20];
	struct student *next;
};
int main()
{
	struct student *head,*p1,*p2,*end;
	char c;
	int i1,n1;
	p1=p2=(struct student*)malloc(sizeof(struct student));
	scanf("%s%s%s%s%s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score);
	i1=0;
	while((c=getchar())!='\n')
	{
		p1->address[i1]=c;
		i1++;
	}
	for(;i1<=19;i1++)
		p1->address[i1]='\0';
	head=p1;
	n1=0;
	while(p1->num[0]!='e')
	{
		n1=n1+1;
		p2=p1;
		p1=(struct student*)malloc(sizeof(struct student));
		scanf("%s",&p1->num);
		if(p1->num[0]=='e') break;
		scanf("%s%s%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->score);
		i1=0;
		while((c=getchar())!='\n')
		{
			p1->address[i1]=c;
			i1++;
		}
		for(;i1<=19;i1++)
			p1->address[i1]='\0';
		if(n1==1) p1->next=head;
		else p1->next=p2;
	}
	end=p2;//input

	p1=end;
	i1=0;
	while(p1!=head)
	{
		printf("%s %s %s %s %s%s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p1=p1->next;
	}
	printf("%s %s %s %s %s%s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);

}