semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student 
{
	char ID[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char address[20];
	struct student *next;
};
struct student *create()
{
	struct student *head,*p1,*p2;
	p1=(struct student*)malloc(LEN);
	scanf("%s",p1->ID);
	if(strcmp(p1->ID,"end")==0){free(p1);head=NULL;}
	else
	{
		head=p1;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
		p1->next=NULL;
		p2=p1;
	do
	{
		p1=(struct student*)malloc(LEN);
		p1->next=NULL;
		scanf("%s",p1->ID);
		if(strcmp(p1->ID,"end")==0){p2->next=NULL;free(p1);break;}
		else
		{
			scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
			p2->next=p1;
			p1->next=NULL;
			p2=p1;
		}
	}while(1);
	}
	return(head);	
}
struct student *fanxu(struct student *head)
{
	struct student *prep,*nowp,*nextp;
	prep=NULL;
	nowp=head;
	while(nowp)
	{
		nextp=nowp->next;
		nowp->next=prep;
		prep=nowp;
		nowp=nextp;
	}
	return prep;
}
void print(struct student *head)
{
	struct student *p;
	p=head;
	while(p)
	{
		printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}


int main()
{
	
	struct student *head;
	head=create();
	head=fanxu(head);
	print(head);
}
void main()
{
	char s[1000][100];
	int i=0,k;
	gets(s[0]);
	while(s[i][0]!='e')
	{
		i=i+1;
		gets(s[i]);
	}
	for(k=i-1;k>=0;k--)
	{
		puts(s[k]);
	}
}
struct student
{
	char num[20],name[20],dizhi[20],xb;
	int year;
	float score;
	struct student *next,*pre;  
};

struct student *create()
{
	struct student *head,*p1,*p2;
	p1=(struct student*)malloc(LEN);
	scanf(TYPE,p1->num,p1->name,&p1->xb,&p1->year,&p1->score,p1->dizhi);
	head=p1;
	p1->pre=NULL;
	p2=p1;
	while(1)
	{
		p1=(struct student*)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0)
		{
			free(p1);
			break;
		}
		scanf("%s %c %d %f %s",p1->name,&p1->xb,&p1->year,&p1->score,p1->dizhi);
		p2->next=p1;
		p1->pre=p2;
		p2=p1;
	}
	p2->next=NULL;
	return p2;
}

int main()
{
	struct student *head,*p;
	head=create();
	p=head;
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s",p->num,p->name,p->xb,p->year,p->score,p->dizhi);
		printf("\n");
		p=p->pre;
	}
	return 0;
}

/*????????????????????*/
struct stu
{
	char id[500];
	struct stu *next;
	struct stu *pre;
};
void main()
{
    int n;
	struct stu *p1,*p2,*head,*tail,*p;
	n=0;
	p1=p2=(struct stu*)malloc(sizeof(struct stu));
	gets(p1->id);
	while(strcmp(p1->id,"end")!=0)
	{
		n=n+1;
		if(n==1)
		{	
			head=p1;
			p1->pre=NULL;
		}
		else
		{
			p2->next=p1;
			p1->pre=p2;
		}
		p2=p1;
		p1=(struct stu*)malloc(sizeof(struct stu));
		gets(p1->id);
	}
	p2->next=NULL;
	tail=p2;
	p=tail;
	do
	{
		printf("%s\n",p->id);
		p=p->pre;
	}while(p!=NULL);
}
/*
 * 78.cpp
 * ??????
 *  Created on: 2011-12-11
 * ??????????????????????????????????????????
 */

int main()
{
	int i,j;
	struct
	{
		char number[40];
		char name[40];
		char sex;
		int old;
		double point;
		char address[40];
	}student[1000];
	for(i=0;i<1000;i++)
	{
		cin>>student[i].number;
		if((student[i].number[0]=='e')&&(student[i].number[1]=='n')&&(student[i].number[2]=='d')&&(student[i].number[3]=='\0')) break;
		cin>>student[i].name>>student[i].sex>>student[i].old>>student[i].point>>student[i].address;
	}
    for(j=i-1;j>=0;j--)
    {
    	cout<<student[j].number<<" "<<student[j].name<<" "<<student[j].sex<<" "<<student[j].old<<" "<<student[j].point<<" "<<student[j].address<<endl;
    }
	return 0;
}
struct student
{
	char a[80];
	struct student *pro;
};

struct student *creat()
{
	struct student *end,*p1,*p2;
	p2=(struct student *)malloc(sizeof(struct student));
	gets(p2->a);
	p2->pro=NULL;
	p1=p2;
	do
	{
		p2=(struct student *)malloc(sizeof(struct student));
		gets(p2->a);
		if (strcmp(p2->a,"end")==0) 
		{
			free(p2);
			break;
		}
		else
		{
			p2->pro=p1;
			p1=p2;
			end=p2;
		}		
	}
	while(1);
	return(end);
}

void main()
{
	struct student *creat();
	void destroy(struct student *end);
	struct student *end,*p;
	end=creat();
	p=end;
	do
	{
		puts(p->a);
		p=p->pro;
	}
	while (p);
	
}
struct student
{
    char num[20];
    char name[20];
    char gender;
    int age;
    char score[20];
    char add[200];
    struct student *prev;
    struct student *next;//????????????
}*head=0,*tail=0;
void add_node(char*a,char*b,char c,int d,char* e,char* f)
{
    if(head==0)
	{
        head=tail=(struct student*)malloc(sizeof(struct student));//???????
        tail->next=tail->prev=0;
    }

    else
	{
        struct student *tmp=tail;
        tail=tail->next=(struct student*)malloc(sizeof(struct student));
        tail->prev=tmp;
        tail->next=0;
    }

    strcpy(tail->num,a);
    strcpy(tail->name,b);
	strcpy(tail->add,f);
    strcpy(tail->score,e);
    tail->gender=c;
    tail->age=d;
}

void print()//????????
{
    while(tail)
	{
        printf("%s %s %c %d %s %s\n",tail->num,tail->name,tail->gender,tail->age,tail->score,tail->add);
        tail=tail->prev;
    }
}

int main()
{
    char a[20];
    char b[20];
    char c;
    int d;
    char e[20];
    char f[200];
	scanf("%s",a);
	while(strcmp(a,"end"))
	{
        scanf("%s %c %d %s %s",b,&c,&d,e,f);
        add_node(a,b,c,d,e,f);
        scanf("%s",a);
    }
	print();
	return 0;
}
struct student
	{
		char num[10],name[50],addr[50],score[10],sex;
		int age;
		struct student *before;
	};
void main()
{
	struct student *p1=0,*p2;
	p2=(struct student *)malloc(len);
	while(scanf("%s %s %c %d %s %s",p2->num,p2->name,&(p2->sex),&(p2->age),p2->score,p2->addr)!=EOF)
	{
		if(p2->num[0]=='e')
			break;
		p2->before=p1;
		p1=p2;
		//printf("%s %s %c %d %d %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr);
		p2=(struct student *)malloc(len);
	}
	p2=p1;
	while(p2!=0)
	{
		printf("%s %s %c %d %s %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->addr);
		p2=p2->before;
	}
	getchar();
	getchar();
}
int main()
{
	struct student
	{
		char a[100];
		struct student *back;
	};

	int n;
	struct student *p1,*p2,*end;
	p1=p2=(struct student *)malloc(sizeof(struct student));
	gets(p1->a);
	p1->back=0;
	for (n=1;;n++)
	{
		p1=(struct student * )malloc(sizeof(struct student));
		p1->back=p2;
		p2=p1;
		gets(p1->a);
		if (p1->a[0]=='e')
		{
			end=p1->back;
			break;
		}

	}
	struct student *p;
	p=end;
	for (n=1;;n++)
	{
		printf("%s\n",p->a);
		p=p->back;
		if (p==0)break;
	}
	return 0;
}
struct student
{
	char a[60];
	struct student*next; 
};
void main()
{
	struct student *creat(void);
	struct student *p;
	p=creat();
	for(;p!=NULL;)
	{
		puts(p->a);
		p=p->next;
	}
}
struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	int n=0;
	p1=p2=(struct student *)malloc(LEN);
	gets(p1->a);
	for(;;)
	{
		n=n+1;
		if(n==1)p2->next=NULL;
		else p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		gets(p1->a);
		if(p1->a[0]=='e')
		{head=p2;
	return (head);}
	}

}
struct stu
{
	char infor[50];
	struct stu*previous;
};

void main()
{
	struct stu*p,*q,*head;
	p=(struct stu*)malloc(sizeof(struct stu));
	p->previous=NULL;
	gets(p->infor);
	while(strcmp(p->infor,"end")!=0)
	{
		q=(struct stu*)malloc(sizeof(struct stu));
		q->previous=p;
		p=q;
        gets(p->infor);
	}
	head=p->previous;
	for(p=head;p!=NULL;p=p->previous)
		puts(p->infor);
}
struct stu
{
       char num[40];
       char name[40];
       char sex[10];
       char year[10];
       char score[40];
       char add[40];
       struct stu *fw;
       struct stu *bw;
};
int n;
struct stu *tail;
struct stu *create(void)
{
      int i;
      struct stu *head,*p1,*p2;
      head=(struct stu *)malloc(sizeof(struct stu));
      head->fw=NULL;
      head->bw=NULL;  
      p2=head;      
      while(1)
      {
             p1=(struct stu *)malloc(sizeof(struct stu));
             scanf("%s",p1->num);
             if(strcmp(p1->num,"end")==0)
             {
                  p1->fw=NULL;
                  p2->fw=p1;
                  p1->bw=p2;
                  tail=p1;
                  break;
             }
             else
             {
                  scanf("%s %s %s %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
                  p1->fw=NULL;
                  p2->fw=p1;
                  p1->bw=p2;
                  p2=p1;            
             }
      } 
      return head;     
}
void bwprint(struct stu *ptail)
{
     struct stu *p;
     p=ptail->bw;     
     while(p->bw!=NULL)
       {
            
            printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
            p=p->bw;      
       }
       
}
main()
{
     int k=0;
     stu *p1;
     struct stu *pheader;
     pheader=create();
     bwprint(tail);
     
}
struct student
{
	char num[20];
	char name[20];
	char sex[5];
	int age;
	char score[10];
	char address[30];
	struct student *next;
};
int n;
int main()
{
	struct student *p1,*p2,*p;
	n=0;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s",p1->num);
	while(p1->num[0]!='e')
	{
		n++;
		if(n==1)p1->next=NULL;
		scanf("%s%s%d%s%s\n",p1->name,p1->sex,&p1->age,p1->score,p1->address);
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		p1->next=p2;
		p2=p1;
	}

	p=p1->next;
	while(p!=0)
	{
		printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
	return 0;
}
struct student
{
	char inf[100];
	struct student*next;
};
int n;
struct student*creat(void)
{
	struct student*head;
	struct student*p1,*end;
	n=0;
	p1=(struct student*) malloc(LEN);
	gets(p1->inf);
	head=end=NULL;
	while(strcmp(p1->inf,"end")!=0)
	{
		
		n=n+1;
		if(n==1)
		{
		  p1->next=head;
		  end=p1;

		}
		else {p1->next=end;
		       end=p1;}
		p1=(struct student*) malloc(LEN);
		gets(p1->inf);
	
	}
	return end;
}
void print(struct student*end)
{
	struct student *p1;
	p1=end;
while(p1!=NULL)
{
		printf("%s\n",p1->inf);
		p1=p1->next;
	}

}
void main()
{
	struct student *end;
	end=creat();
	print(end);
}
int main()
{
struct joyan
	{
		char num[10];
		char name[20];
		char sex[1];
		int age;
		float score;
		char add[20];
		struct joyan * next;
	};
	struct joyan *head,*p1,*p2;
    p1=p2=head=(struct joyan *)malloc(LEN);
	scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->sex,&p1->age,&p1->score,p1->add);
	p1->next = NULL;
	int n=1,i;
	while(p1->num[0]>='0'&&p1->num[0]<='9')
	{
		p1=(struct joyan *)malloc(LEN);
		scanf("%s",p1->num);
		if (p1->num[0]!='e')
		{
			scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
            p2->next=p1;
			p2=p1;
			n++;
		}
		else
		{ 
			p2->next=NULL;
		    break;
		}

	}
    struct joyan *p,*q,*temp;
	p=head;
	if(p->next!=NULL)
	{
		q=p->next;
		if(q->next==NULL)
		{
			p->next=NULL;
			q->next=p;
		}
		else
		{
			p->next=NULL;
			temp=p;
			p=q;
			q=q->next;
			while(q->next!=NULL)
			{
				p->next=temp;
				temp=p;
				p=q;
				q=q->next;
			}
			p->next=temp;
			q->next=p;
		}
		head=q;
	}

	p1=head;
	for(i=0;i<n;i++)
	{
		printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	return 0;
}
//
//  main.c
//  Track 82,????????????
//
//  Created by Charles.thRay.Lee on 2/1/13.
//  Copyright (c) 2013 Peking University. All rights reserved.
/*
 ??
 ???????????????????????????????????????
 ????
 ?????????????????????
 00630018 zhouyan m 20 10.0 28#460
 
 ??????"end"??
 ????
 ??????????
 ?????????
 
 ?? ?? ?? ?? ?? ??
 
 ?????
 ????
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
00630018 zhouyan m 20 10 28#4600
0063001 zhouyn f 21 100 28#460000
0063008 zhoyan f 20 1000 28#460000
0063018 zhouan m 21 10000 28#4600000
00613018 zhuyan m 20 100 28#4600
00160018 zouyan f 21 100 28#4600
01030018 houyan m 20 10 28#4600
0630018 zuyan m 21 100 28#4600
10630018 zouan m 20 10 28#46000
end
 
 ????
 10630018 zouan m 20 10 28#46000
 
 0630018 zuyan m 21 100 28#4600
 
 01030018 houyan m 20 10 28#4600
 
 00160018 zouyan f 21 100 28#4600
 
 00613018 zhuyan m 20 100 28#4600
 
 0063018 zhouan m 21 10000 28#4600000
 
 0063008 zhoyan f 20 1000 28#460000
 
 0063001 zhouyn f 21 100 28#460000
 
 00630018 zhouyan m 20 10 28#4600
*/


struct Student
{
    char num[20];
    char name[20];
    char gender;
    int age;
    char score[10];
    char address[20];
    struct Student*next;
    struct Student*upper;
};

int n;
struct Student*creat(void)
{
    struct Student*head,*end;
    struct Student*p1,*p2;
    n=0;
    p1=p2=(struct Student*)malloc(LEN);
    scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->gender,&p1->age,p1->score,p1->address);
    head=NULL;
    
    while (p1->num[0]!='e') {
        n=n+1;
        if (n==1)
        {
            head=p1;
            p1->upper=NULL;
        }
        else
        {
            p2->next=p1;
            p1->upper=p2;
        }
        p2=p1;
        p1=(struct Student*)malloc(LEN);
        scanf("%s",p1->num);
        if (p1->num[0]=='e') {
            end=p2;
            break;
        }
        scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->address);
    }
    p2->next=NULL;
    return (end);
}

int main()
{
    struct Student *pt;
    pt=creat();
        do {
            printf("%s %s %c %d %s %s\n",pt->num,pt->name,pt->gender,pt->age,pt->score,pt->address);
            pt=pt->upper;
        } while (pt!=NULL);
    return 0;
}
struct student
{
	char id[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char addr[20];
	struct student *next;
	struct student *before;
};
int n;
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s",p1->id);
	head=NULL;
	while(strcmp(p1->id,"end")!=0)
	{
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		p1->before=p2;
		scanf("%s",p1->id);
	}
	p2->next=NULL;
	return(p2);
}
void main()
{
    struct student *p;
    int i;
	p=creat();
	printf("%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
	for(i=1;i<n;i++)
	{
	    p=p->before;
		printf("\n%s %s %c %d %s %s",&p->id,&p->name,p->sex,p->age,&p->score,&p->addr);
	}
}
/*?? ?? ?? ?? ?? ??*/
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);
	}
	p=p2;
	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[1000];
	struct student *next;
};

int main()
{
	struct student s[1000],*p,*pheader;
	int i=0;
	int n;
	char ch;
	for (i=0;;i++)
	{
		gets(s[i].num);
		if (strcmp(s[i].num,"end")==0)
			break;
	}
	n=i;
	pheader=&s[n-1];
	for (i=n-1;i>=1;i--)
	{
		s[i].next=&s[i-1];
	}
	s[0].next=NULL;
    p=pheader;
	while (p!=NULL)
	{
		puts(p->num);
		p=p->next;
	}

	return 0;
}
struct Student
{
	char id[200];
	char name[200];
	char sex[1];
	int age;
	float mark;
	char address[200];
	struct Student *next;
};
int main()
{
	struct Student *p, *head, *tail;
	head = tail = NULL;
	while(1)
	{
		p = (struct Student *) malloc(LEN);
		scanf("%s", p->id);
		if(p->id[0] == 'e')
			break;
		scanf("%s", p->name);
		scanf("%s", p->sex);
		scanf("%d%f%s", &p->age, &p->mark, p->address);
		p->next = NULL;
		if(head == NULL)
			head = tail = p;
		else
		{
			p->next = head;
			head = p;
		}
	}
	p = head;
	while(p != NULL)
	{
		printf("%s ", p->id);
		printf("%s ", p->name);
		printf("%s ", p->sex);
		printf("%d %g ", p->age, p->mark);
		printf("%s\n", p->address);
		p = p->next;
	}
	return 0;
}
int main()
{
	int i;
	struct student
	{
		char num[100];
		char name[100];
		char sex;
		int age;
		char score[100];
		char address[100];
		struct student *next;
	}a[10000],*head,*p;
	int n;
	for(i=0;i<10000;i++)
	{
		scanf("%s",a[i].num);
		if(a[i].num[0]=='e')
		{break;}
		scanf("%s %c %d %s %s",a[i].name,&a[i].sex,&a[i].age,a[i].score,a[i].address);
	}
	i=i-1;
	head=&a[i];
	for(n=i;n>0;n--)
	{
		a[n].next=&a[n-1];
	}
	a[0].next=NULL;
	p=head;
	do
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}while(p!=NULL);
	return 0;
}
struct student 
{ char s[100];
  struct student *next;
};

 struct student *creat()
 {
	 struct student *head,*p1,*p2;
	 p1=(struct student *)malloc(len);
	 gets(p1->s);
	 p1->next=null;
	 do
	 {
		p2=(struct student *)malloc(len);
		gets(p2->s);
		p2->next=p1;
		p1=p2;
	 } while(strcmp(p2->s,"end"));
		 head=p2;
		 return(head);
 }
 void main()
 {
	 struct student *p,*head;
	 head=creat();
	 p=head;
	 while(p->next){
		 p=p->next;
		 printf("%s\n",p->s);
	 }
 }
struct stu{
	char num[20];
	char name[20];
	char gen;
	int age;
	float mark;
	char add[20];
	struct stu *next;
};
char end[4]="end";
int main()
{
	struct stu *p1,*p2,t;
	p1=p2=NULL;
	while(scanf("%s",t.num),strcmp(t.num,end)!=0)
	{
		scanf("%s %c %d %g %s\n",t.name,&t.gen,&t.age,&t.mark,t.add);
		p1=(struct stu *)malloc(LEN);
		*p1=t;
		p1->next=p2;
		p2=p1;
		}
	while(p1!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->gen,p1->age,p1->mark,p1->add);
		p1=p1->next;
		}
}
struct student
{
    char input[500];
	struct student *next;
};


void main()
{
	char c[500];
	struct student *head;
	struct student *p1,*p;
	head=NULL;
	while(strcmp(gets(c),"end")!=0)
	{
		p1=(struct student *)malloc(LEN);
		strcpy(p1->input,c);
		p1->next=head;
		head=p1;
	}
	p=head;
		do
		{
			puts(p->input);
			p=p->next;
			putchar('\n');
		}while(p!=NULL);
}
struct stu
{
 char id[10];
 char name[20];
 char sex;
 int age;
 char score[10];
 char addr[20];
 struct stu *next;
};

int main()
{
    struct stu *creat(void);
    void output(struct stu*head);
     
    struct stu *head,*p;
    
    head=NULL;
    head=creat();
                  p=head;
                    
    output(head);
    
    
}


struct stu *creat(void)
{
       int i;
       struct stu*p1,*p2,*p3,*head;
       head=NULL;
       
       p1=(struct stu*)malloc(LEN);
       if(head==NULL) head=p2=p3=p1;p1->next=NULL;
       
       
       scanf("%s",p1->id);
       
       while(p1->id[0]!='e')
       {
        p3=p2;
        
        

        scanf(" %s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
        
        p1=(struct stu*)malloc(LEN);
        p1->next=p2;
        p2=p1;
        
        scanf("%s",p1->id);
                           
      
       }
       head=p3;
       
       
       
       return head;
}

void output(struct stu*head)
{
     struct stu*p1,*p2;
     p1=head;
                           
     
     while(p1!=NULL)
      {
      printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->addr);
      p1=p1->next;
      }
}
struct stud
{	char no[50];
	char name[50];
	char sex;
	int	y;
	char sc[30];
	char addr[50];
	struct stud *pre;	
};
struct stud *creat()
{	struct stud *p1,*p2;
	char *g="end";
	p1=p2=(struct stud *) malloc(LEN);
	p1->pre=NULL;
	scanf("%s",p1->no);
	while(strcmp(p1->no,g))
	{	scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->y,p1->sc,p1->addr);
		p2=p1;
		p1=(struct stud *) malloc(LEN);if(p1==NULL)	return NULL;
		p1->pre=p2;
		scanf("%s",p1->no);
	}
	return (p1->pre);
}

void main()
{
	struct stud *pt;
	pt=creat();
	while(pt!=NULL)
	{	
		printf("%s %s %c %d %s %s\n",pt->no,pt->name,pt->sex,pt->y,pt->sc,pt->addr);
		pt=pt->pre;
	}
}
struct student                             /*??student?????????????????????????*/
{
	char num[40];
	int age;
	char score[20];
	char name[40];
	char gender;
	char addr[40];
	struct student *next;
}*p1,*p2;                                  /*???p1,p2?????????????*/
int n;
struct student *creat(void);               /*?????????*/
struct student *backward(struct student*);  /*???????*/
void output(struct student*);                /*???????*/
void free(struct student);                   /*?????????*/
int main()
{
	struct student * head;
	head=creat();                           /*?????????*/
	head=backward(head);                    /*???????*/
          output (head);                          /*??????*/
	free(head);                           /*??????????*/
	return 0;
}
struct student *creat(void)                 /*?????????????????????????*/
{
	struct student*head;
	n=0;
	p1=p2=(struct student*)malloc(LEN);        /*???????*/
	head=NULL;                                 /*?????NULL*/
	char tmp[40];
	scanf("%s",tmp);
	while (strcmp(tmp,"end")!=0)               /*?????????????end*/
	{
		scanf(" %s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->addr);
		strcpy(p1->num,tmp);
                n=n+1;
		if (n==1)            /*????????????*/
			head=p1;
		else 
			p2->next=p1;      /*???????????????next???????????*/
		p2=p1;
		p1=(struct student*)malloc(LEN);            /*???????*/
		scanf("%s",tmp);

		
	}
	p2->next=NULL;                                  /*?????????*/
	return(head);                                   /*????????????*/
}
struct student *backward(struct student * head)      /*??????????????????????*/
{
	struct student *new_head;                    /*????????????*/
	p1=head;
	p2=NULL;
	while(p1->next!=NULL)                  /*????????????*/
	{
		p2=p1;
		p1=p1->next;
	}
	new_head=p1;                           /*??????*/
	p1->next=p2;                           /*???????next???????*/
	p2->next=NULL;                         /*???????next??NULL*/
	while(head->next!=NULL)                /*??????next?NULL????*/
	{
		p1=head;                           
		p2=NULL;
		while(p1->next!=NULL)              /*?????????????next????????????????next??NULL*/
		{
		    p2=p1;
		    p1=p1->next;
		}
		p1->next=p2;
		p2->next=NULL;
	}
	return (new_head);              /*?????????*/
}
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->gender,p1->age,p1->score,p1->addr);
	}
}
void free(struct student*head)               /*?????????*/
{
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		free(p1);
	}
}
struct student
{char a[50];
struct student *prev;
};
void main()
{
	void print(struct student *head);
	int n=0;
	struct student *head;
	struct student *p1,*p2;
	p1=head=(struct student *)malloc(len);/*???????*/
	gets(p1->a);
	p2=NULL;
	while(strcmp(p1->a,"end")!=0)
	{
		n++;
		if(n==1)
			p2=p1;
		else
			p1->prev=head;
		head=p1;
		p1=(struct student *)malloc(len);
		gets(p1->a);
	}
	p2->prev=NULL;
	print(head);
}
void print(struct student *head)
{
	struct student *p;
	p=head;
	if(head!=NULL)
		do
		{
			printf("%s\n",p->a);
			p=p->prev;
		}
		while(p!=NULL);
}
struct a
{
    char s[6][100];
    struct a *next;
}head;
int tot=0;

void init()
{
    int i;
    struct a *p;
    head.next=NULL;
    while(1)
    {
        p=(struct a *)malloc(sizeof(struct a));
        scanf("%s",p->s[0]);
        if(!strcmp(p->s[0],"end"))  break;
        for(i=1;i<6;i++)
        {
            scanf("%s",p->s[i]);
        }
        p->next=head.next;
        head.next=p;
    }
}

void print()
{
    struct a *p=head.next;
    int i;
    while(p)
    {
        for(i=0;i<5;i++)
        {
            printf("%s ",p->s[i]);
        }
        puts(p->s[i]);
        p=p->next;
    }
}

int main()
{
    init();
    print();
    return 0;
}