struct student
{
	char xuehao[100];
	char name[100];
	char s;
	int age;
	float score;
	char add[100];

};

int main()
{
	int i,j,n=0;
	struct student stu[1000];
	for(i=0;i<1000;i++)
	{
		scanf("%s",stu[i].xuehao);
		if(stu[i].xuehao[0]=='e'&&stu[i].xuehao[1]=='n'&&stu[i].xuehao[2]=='d') break;
		scanf("%s %c %d %f %s",stu[i].name,&stu[i].s,&stu[i].age,&stu[i].score,stu[i].add);
		n++;
	}
	for(j=n-1;j>=0;j--)
	{
		if((int)stu[j].score==stu[j].score)
		printf("%s %s %c %d %d %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,(int)stu[j].score,stu[j].add);
		else
			printf("%s %s %c %d %.1f %s\n",stu[j].xuehao,stu[j].name,stu[j].s,stu[j].age,stu[j].score,stu[j].add);

	}
	return 0;
}


struct stu
{
       char a[50];
       struct stu* b;
};
int main()
{
struct stu* p1,* p2,stu;
p1=p2=&stu;
p1->b=NULL;
gets(p1->a);
for(;;)
{
       if(strcmp(p2->a,"end")==0)  break;
       p2=(struct stu*)malloc(N);
       gets(p2->a);
       p2->b=p1;
       p1=p2;

}
p2=p2->b;
for(;;)
{
       printf("%s",p2->a);
       if(p2->b==NULL) break;
       p2=p2->b;
       printf("\n");
}

}


struct student
{
	char num[20];
	char name[20];
	char sex[2];
	char age[20];
	char score[10];
	char add[20];
	struct student *next;
}*head,*p;
void input()
{
	head=NULL;
	int n=0;
	do
	{
		p=(struct student *)malloc(LEN);
		scanf("%s",p->num);
		if(p->num[0]=='e')
			break;
		scanf("%s%s%s%s%s",p->name,p->sex,&p->age,&p->score,p->add);
		n++;
		if(n==1)
			p->next=NULL;
		else
			p->next=head;
		head=p;
	}while(1);
	p=head;
}
void output()
{
		if(head!=NULL)
	{
		do
		{
			printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
			p=p->next;
		}while(p!=NULL);
	}
}
void main()
{
	input();
	output();
}


void main()
{
struct student{
char a[20];
char b[20];
char c;
int d;
float e;
char f[20];
struct student *next;
};
struct student *head,*p1,*p0;int n=0;
p1=(struct student*) malloc(LEN);
scanf("%s",p1->a);
head=p1;
p1->next=0;
while(strcmp(head->a,"end")!=0)
{
n++;
if(n>1) p1=p0;
scanf("%s %c %d %f %s",head->b,&head->c,&head->d,&head->e,head->f);
p0=(struct student*) malloc(LEN);
head=p0;
p0->next=p1;
scanf("%s",p0->a);
}
head=p1;
for(p1=head;(p1!=0)&&(strcmp(p1->a,"end")!=0);)
{
printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
p1=p1->next;
}
}


struct student
{
	char id[20];
	char name[30];
	char sex;
	int age;
	char score[30];
	char add[30];
	struct student *next;
    struct student *adv;
};
int n;
void main()
{
	struct student *p,*q,*head;
	n=0;
	p=q=(struct student *)malloc(LEN);
	scanf("%s %s %c %d %s %s",p->id,p->name,&(*(p)).sex,&(*(p)).age,p->score,p->add);
    head=NULL;
	while(strcmp(p->id,"end")!=0)
	{
		n=n+1;
		if(n==1) {p->adv=NULL;head=p;}
		else q->next=p;
		p->adv=q;
		q=p;

		p=(struct student *)malloc(LEN);
		scanf("%s %s %c %d %s %s",p->id,p->name,&p->sex,&p->age,p->score,p->add);

	}
    q->next=NULL;
    while(q!=NULL)
	{
		if(q!=head)
		{printf("%s %s %c %d %s %s\n",q->id,q->name,(*(q)).sex,(*(q)).age,q->score,q->add);
		q=q->adv;}
		else {printf("%s %s %c %d %s %s\n",head->id,head->name,(*(head)).sex,(*(head)).age,head->score,head->add);break;}
	}
}


struct stu
{
	struct stu *back;
	char info[number];
	struct stu *next;
}
main()
{
	char infos[number];
	char s[]="end";
	struct stu *head,*p1,*p2,*tail;

	gets(infos);
	p2=(struct stu *)malloc(Len);
	if (strcmp(infos,s)!=0)
	{
		head=p2;
		p2->back=NULL;
		strcpy(p2->info,infos);
		p2->next=NULL;
		gets(infos);
		p1=p2;
	}
	while(strcmp(infos,s)!=0)
	{
		p2=(struct stu *)malloc(Len);
		p1->next=p2;
		p2->back=p1;
		strcpy(p2->info,infos);
		p2->next=NULL;
		p1=p2;
		gets(infos);
	}
	tail=p1;
	while(p1)
	{
		printf("%s\n",p1->info);
		p1=p1->back;
	}
}


struct student
{
	char xuehao[200];
	char name[300];
	char xingbie;
	char age[20];
	char grade[20];
	char dizhi[200];
	struct student *next;
};
int main()
{
	int i;
	int n=0;
    struct student *tail;
	struct student *p1,*p2,*p;
	tail=NULL;
	p1=p2=NULL;
	for(i=1;;)
	{
		p1=(struct student*)malloc(LEN);
		p1->next=p2;
		scanf("%s",p1->xuehao);
		if(strcmp(p1->xuehao,"end")==0)
		{
			tail=p2;
			     break;
		}
		scanf("%s",p1->name);
		getchar();
		scanf("%c",&p1->xingbie);
		scanf("%s",p1->age);
		scanf("%s",p1->grade);
		scanf("%s",p1->dizhi);
		p2=p1;
        i++;
	}
	n=i-1;
A:  p=tail;
    for(;p!=NULL;)
	{
		printf("%s %s %c %s %s %s\n",p->xuehao,p->name,p->xingbie,p->age,p->grade,p->dizhi);
		p=p->next;
	}
	return 0;
}


void main()
{
	char *juzi[1000];
	char **p;

	p=juzi;
	*p=(char *)malloc(100*sizeof(char));
	gets(*p);
	while(strcmp(*p,"end")!=0)
	{
		p++;
		*p=(char *)malloc(100*sizeof(char));
		gets(*p);

	}
    p--;
	for(;p>=juzi;p--)
		puts(*p);

}


struct arr
{
	char num[20];
	char name[50];
	char sex;
	int age;
	float score;
	char address[50];
	struct arr *next;
};
int n;

struct arr *create(void)
{
	struct arr *head;
	struct arr *p1,*p2;
	n=0;
	p1=p2=(struct arr *)malloc(LEN);
	scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	head=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct arr *)malloc(LEN);
		scanf("%s",&p1->num );
		if(strcmp(p1->num,"end")==0)break;
		scanf("%s %c %d %f %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	}
	p2->next=NULL;
	return(head);
}
struct arr *reverse(struct arr *head)
{
	struct arr *p1,*p2,*p3;
	p1=p2=head;
	if(p1!=NULL&&p1->next!=NULL)
	{
		p1=p1->next;
		p2->next=NULL;
		while(p1!=NULL&&p1->next!=NULL)
		{
			p3=p1;
			p1=p1->next;
			p3->next=p2;
			p2=p3;
		}
		head=p1;
		p1->next=p2;
	}
	return(head);
}
void print(struct arr *head)
{
	int b;
	struct arr *p1;
	p1=head;
	while(p1!=NULL)
	{
		b=(int)p1->score;
		if(p1->score-b==0.0)
		printf("%s %s %c %d %d %s\n",p1->num,p1->name,p1->sex,p1->age,b,p1->address);
		else
			printf("%s %s %c %d %.1f %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		p1=p1->next;
	}
}

void freelist(struct arr *head)
	{
		struct arr *p=head ;
		while(p!=NULL)
		{
			head=head->next;
			free(p);
			p=head;
		}
}
void main()
{
	struct arr *head;
	head=create();
	head=reverse(head);
	print(head);
	freelist(head);
}


struct student
{
  char name[50];
  struct student *next;
  struct student *former;
};//????????

void main()
{
  struct student *head1,*head2;
  struct student *p1,*p2;

  p1=p2=(struct student*)malloc(LEN);
  gets(p1->name);
  p1->next=NULL;  //???p1->next???
  p1->former=NULL;
  head1=p1;

  while(strcmp(p1->name,"end"))
  {
   	p2=p1;
	p1=(struct student*)malloc(LEN);
    gets(p1->name);

	p1->next=NULL;
	p1->former=p2;
	p2->next=p1;
  }
  p2->next=NULL;

  do
  {
    puts(p2->name);
	p2=p2->former;
  }
  while(p2!=NULL);

}


struct Student
{
	char num[1000];
	char name[1000];
	char sex;
	int age;
	char score[1000];
	char add[1000];
	struct Student * next;
	struct Student * pre;
};
int n;
struct Student * creat(void)
{
	struct Student * head,* end;
	struct Student * p1,* p2;
	n=0;
	p1=p2=(struct Student *)malloc(LEN);
	scanf("%s",p1->num);
	head=NULL;
	while(p1->num[0]!='e')
	{
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		n++;
		if(n==1)	{	head=p1;	p1->pre=NULL;	}
		else		{	p2->next=p1;	p1->pre=p2;	}
		p2=p1;
		p1=(struct Student * )malloc(LEN);
		scanf("%s",p1->num);
	}
	p2->next=NULL;
	end=p2;
	return end;
}
void print(struct Student * end)
{
	struct Student * p;
	p=end;
	if(end!=NULL)
		do
		{
			printf("%s %s %c %d %s %s",p->num,p->name,p->sex,p->age,p->score,p->add);
			putchar('\n');
			p=p->pre;
		}
		while(p!=NULL);
}

int main()
{
	struct Student * p;
	p=creat();
	print(p);
	return 0;
}


struct stu
{
char data[100];
struct stu *next;
};
void main()
{
struct stu *head;
struct stu *p1,*p2;
p1=(struct stu *)malloc(LEN);
p1->next=NULL;
gets(p1->data);
while(strcmp(p1->data,"end"))
{
 p2=(struct stu *)malloc(LEN);
 p2->next=p1;
 p1=p2;
 gets(p1->data);
}
head=p1->next;
for(p2=head;p2;p2=p2->next)
puts(p2->data);
}


struct student
{
	char num[9];
	char name[20];
	char sex;
	int age;
	char grade[6];
	char add[11];
	struct student*next;
};
int n=0;
void main()
{
	struct student *head;
	struct student *p1,*p2,*temp,*p=NULL;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s",p1->num);
	scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
	head=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0)break;
	    scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,&p1->grade,p1->add);
	}
	p2->next=NULL;
	do
	{
		p2=NULL;
		p1=head;
		while(p1->next!=NULL)
		{
			p2=p1;
			p1=p1->next;
		}
		if(p==NULL)
		{
			p=p1;
			temp=p->next=p2;
		}
		temp=temp->next=p2;
		p2->next=NULL;
	}while(head->next!=NULL);
	do{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
		p=p->next;
	}while(p!=NULL);
}


struct student
{
	char info[100];
	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->info);
  head=NULL;
  while (strcmp(p1->info,"end")!=0)
  {
  	n=n+1;
  	if (n==1) head=p1;
  	else p2->next=p1;
  	p2=p1;
  	p1=(struct student*)malloc(LEN);
  	gets (p1->info);
  }
  p2->next=NULL;
  return (head);
}
void pri(struct student *head,int i)
{
	int j;
	struct student *p1,*p2;
	p1=head;
	for (j=1;j<i;j++)
	{
	   p2=p1;
	   p1=p2->next;
	}
	puts (p1->info);
}

void main()
{
	int i;
	struct student *head,stu;
	head=creat ();
	for (i=n;i>0;i--)
	pri(head,i);
}


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

void main()
{
	struct student *p,*head;
	head=creat();
	p=head;
	while(p->before!=NULL)
	{printf("%s\n",p->str);
	p=p->before;
	}
	printf("%s",p->str);
}


struct student
{
	char num[10];
	char name[20];
	char s;
	int age;
	char score[20];
	char address[30];
	struct student *next;
};
int main()
{
	struct student *p1,*p2;
	p1=(struct student *)malloc(LEN);
	p1->next=0;
	scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address);
    while(1)
	{
		p2=p1;
		p1=(struct student *)malloc(LEN);
		p1->next=p2;
        scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->s,&p1->age,&p1->score,p1->address);
		if(p1->num[0]==	'e')
			break;
	}
     while(p1->next!=0)
	 {
		p1=p1->next;
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->s,p1->age,p1->score,p1->address);
	}
	 return 0;
}


void main()
{
	struct student
	{
		char num[10],name[20],sex,add[15];
		int age;
		float mark;
		struct student * next;
		struct student * before;
	};
	struct student *s1=(struct student *)malloc(sizeof(struct student)),*head=s1,*s2;
	(*s1).before=0;
	while(1)
	{
		scanf("%s",(*s1).num);
		if((*s1).num[0]!='e')
		{
			scanf("%s %c %d %f %s",(*s1).name,&((*s1).sex),&((*s1).age),&((*s1).mark),(*s1).add);
			s2=(*s1).next=(struct student *)malloc(sizeof(struct student));
			(*s2).before=s1;
			s1=s2;
		}
		else
		{
			head=(*s1).before;
			break;
		}
	}
	s1=head;
	while(1)
	{
		printf("%s %s %c %d %g %s\n",(*s1).num,(*s1).name,(*s1).sex,(*s1).age,(*s1).mark,(*s1).add);
		if((*s1).before)s1=(*s1).before;
		else break;
	}
}


struct student
{
	char num[100];
	char nam[100];
	char sex[2];
	char age[100];
	char sco[100];
	char add[100];
	struct student *prev;
	struct student *next;
};

struct student *create(void)
{
	struct student *head,*end,*p1,*p2;
	int n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s",p1->num);
	while(strcmp(p1->num,"end")!=0)
	{
		n++;
		scanf("%s%s%s%s%s",p1->nam,p1->sex,p1->age,p1->sco,p1->add);
		if(n==1)
		{
			head=p1;
			p1->prev=NULL;
		}
		else
		{
			p2->next=p1;
			p1->prev=p2;
		}
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s",p1->num);
	}
	p2->next=NULL;
	end=p2;
	return(end);
}

void print(struct student *end)
{
	struct student *p;
	p=end;
	do
	{
		printf("%s %s %s %s %s %s\n",p->num,p->nam,p->sex,p->age,p->sco,p->add);
		p=p->prev;
	}while(p!=NULL);
}

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


struct Student
{
	char num[10];
	char name[25];
	char sex;
	int age;
	float score;
	char add[15];
	struct Student *next;
};
int main()
{
	struct Student *creat(void);
	struct Student *head,*p;
	head=creat();
	p=head;
	while(p->next!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		p=p->next;
	}
	printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
}
struct Student *creat(void)
{
	struct Student *head,*news;
	int i;
	head=NULL;
	for(i=0;;i++)
	{
		news=(struct Student *)malloc(sizeof(struct Student));
		scanf("%s",news->num);
		if(news->num[0]=='e') break;
	    scanf(" %s %c %d %f %s",news->name,&news->sex,&news->age,&news->score,news->add);
		news->next=head;
	    head=news;
	}
	return(head);
}


struct student
{
	char num[200];
	char name[200];
	char sex;
	int age;
	float score;
	char address[200];
	struct student *next;
};
int num;
struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	head=NULL;
	num=0;
	while(1)
	{
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if (strcmp(p1->num,"end")==0)
		{
			p2->next=NULL;
			return (head);
			break;
		}
		else
		{
			scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
			if (num==0)
				head=p1;
			else
				p2->next=p1;
			p2=p1;
			num++;
		}
	}
}
int main()
{
	struct student *pt,*p,*pre;
	int i;
	pt=creat();
	for (i=1;i<=num;i++)
	{
		for (p=pre=pt;p;p=p->next)
		{
			if (p->next!=NULL)
				pre=p;
			else
			{
				printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
				pre->next=NULL;
			}
		}
	}
	return 0;
}


struct Student
{
    char num[41];
    char name[41];
    char gender[5];
    int age;
    char score[10];
    char address[41];
    struct  Student * next;
    struct  Student * pre;
};
int size=sizeof(struct Student);
struct Student gan;
void push ()
{
    char ster[41];struct Student * pt;
    scanf("%s",ster);
    while(strcmp(ster,"end")!=0)
    {
        pt=malloc(size);
        strcpy(pt->num,ster);
        scanf("%s %s %d %s %s",pt->name,pt->gender,&pt->age,pt->score,pt->address);
        (gan.pre)->next=pt;//????????????next?
        pt->pre=gan.pre;//????????????pre?
        gan.pre=pt;//??????????????
        pt->next=&gan;//???????
        scanf("%s",ster);
    }
}
void display(struct Student stu)
{
    printf("%s %s %s %d %s %s\n",stu.num,stu.name,stu.gender,stu.age,stu.score,stu.address);
}
int main()
{
    gan.next=&gan;
    gan.pre=&gan;
    push();
    struct  Student * pt;
    pt=gan.pre;
    while(pt!=&gan)
    {
        display(*pt);
        pt=pt->pre;
    }
    return 0;
}


struct student
{char num[20];
 char name[20];
 char sex;
 int age;
 char score[20];
 char addr[30];
 struct student *next;
};
int n;

struct student *creat(void)
{
	struct student *end,*p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %s %c %d %s %s",&p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
    end=NULL;
	while(strlen(p1->name)!=0)
	{
		n=n+1;
		if(n==1)
		{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->score,p1->addr);
	}
	end=p2;
	return end;
}

void main()
{
	struct student *p,*end;
	end=creat();
	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->addr);
			p=p->next;
		}
		while(p!=NULL);
	}
}


struct num
{
	char content[50];
	struct num *next;
};

struct num *crea()
{
	long i;
	struct num *head;
	struct num *p1,*p2;
	p1=p2=(struct num *)malloc(LEN);
	head=p1;
	gets(p1->content);
	head->next=NULL;
	for(;;)
    {
		p1=(struct num *)malloc(LEN);
		gets(p1->content);
		if(p1->content[0]!='e')
		{
			p1->next=p2;
			p2=p1;
		}
		else  {p1->next=p2,p2=p1;break;}
	}
   return(p1);
}
int main()
{
long nx,m,m0,tx,qx,q,mxh;
struct num *hi,*p,*t;
hi=crea();
t=hi->next;
for(p=t;p!=NULL;p=p->next)
printf("%s\n",p->content);
return 0;
}


struct student
{
	char seq[10];
	char other[100];
	struct student *next;
	struct student *previous;
};

void main()
{
	struct student *p1,*p2;
	int n=1;

	p1=p2=(struct student *)malloc(LEN);

	while(n++)
	{
		scanf("%s",p1->seq);
		if (strcmp(p1->seq,"end")==0) break;
		gets(p1->other);
		if (n>1) p1->previous=p2;
		p2=p1;
		p2->next=p1= (struct student *)malloc(LEN);

	}

	p1=p2;
	n=n-1;
	for (n;n>1;n--)
	{
		printf("%s%s\n",p1->seq,p1->other);
		p1=p1->previous;
	}
}


struct node
{
char data[10][20];
struct node *pre;
};
int main ()
{
int i,j;
struct node *p1,*p2;
p1=(struct node *)malloc(sizeof(struct node));
for (i=1;i<=6;i++)
cin>>(*p1).data[i];
p1->pre=NULL;
while((*p1).data[1][0]!='e')
{
p2=(struct node *)malloc(sizeof(struct node));
p2->pre=p1;
for (i=1;i<=6;i++)
cin>>(*p2).data[i];
p1=p2;
}
p1=p1->pre;
while(p1->pre)
{
for (i=1;i<=5;i++)
cout<<(*p1).data[i]<<' ';
cout<<(*p1).data[6]<<endl;
p1=p1->pre;
}
for (i=1;i<=5;i++)
cout<<(*p1).data[i]<<' ';
cout<<(*p1).data[6];
}


struct student
{
	char num[100];
	char name[100];
	char sex;
	int age;
	float score;
	char ad[100];
	struct student *next;
	struct student *former;
};
int n=1;
struct student *creat()
{
	struct student *thisnode,*newnode,*head;
	do
	{
	newnode=(struct student *)malloc(sizeof(struct student));
	scanf("%s",newnode->num);
	if(newnode->num[0]!='e')
	{
		scanf("%s %c%d%f%s",newnode->name,&newnode->sex,&newnode->age,&newnode->score,newnode->ad);
	   head=newnode;
	   if(n==1) newnode->former=NULL;
       else
	   {
		thisnode->next=newnode;
		newnode->former=thisnode;
	   }
	   thisnode=newnode;
	   n=n+1;
	}
	else
	{
		thisnode->next=NULL;
	}
	}while(newnode->num[0]!='e');
	return(head);
}
void main()
{
	struct student *p;
	p=creat();
	do
	{
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->ad);
		p=p->former;
	}while(p!=NULL);
}


struct record
{
	char stuinfo[50];
	struct record *pnext;
};

int main()
{
	record *stu,*head,*ptemp;
	head=(struct record*)malloc(sizeof(struct record));
	head->pnext=NULL;
	ptemp=(struct record*)malloc(sizeof(struct record));
	stu= (struct record*)malloc(sizeof(struct record));
	gets(stu->stuinfo);
	while(strcmp(stu->stuinfo, "end")){
		if (head->pnext==NULL)
			{
				head->pnext=stu;
				stu->pnext=NULL;
		}
		else
		{
			ptemp=head->pnext;
			head->pnext=stu;
			stu->pnext=ptemp;
		}
		stu= (struct record*)malloc(sizeof(struct record));
		gets(stu->stuinfo);
	}
	ptemp=head;
	while(ptemp->pnext!=NULL){
		ptemp=ptemp->pnext;
		printf("%s\n", ptemp->stuinfo);
	}

	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 destroy(struct student *end)
{
	struct student *p;
	p=end;
	while(end)
	{
		p=end;
		end=end->pro;
		free(p);
	}
}
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);
	destroy(end);
}


struct student
{
       char ID[10];
       char name[20],s;
       int age;
       char score[10];
       char ad[20];
       struct student *next;
};
int main()
{
    struct student *head;
    int n,i,j;
    n=0;
    head = NULL;
    struct student *p1 ;
    while (1)
    {
          p1 = (struct student *)malloc(len);
          scanf("%s" , p1 -> ID);
          if (p1 -> ID[0] == 'e' && p1 -> ID[1] == 'n' && p1 -> ID[2] == 'd' ) break;
          scanf(" %s %c %d %s %s",p1->name,&p1->s,&p1->age,p1->score,p1->ad);
          n++;
          p1 -> next = head;
          head = p1;
    }
    p1 = head;
    while (p1 != NULL)
    {
        printf("%s %s %c %d %s %s\n",p1->ID,p1->name,p1->s,p1->age,p1->score,p1->ad);
        p1 = p1 -> next;
    }

}


struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char mark[20];
	char add[20];
	struct student *next;
};
void main()
{
	struct student *creat(void);
	struct student *p;
	int m=0;
	p=creat();
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).sex,(*p).age,(*p).mark,(*p).add);
		p=(*p).next;
	} ;
}
int n;
struct student *creat(void)
{   int k;
	n=0;
	struct student *head,*p1,*p2;
	p2=p1=(struct student *)malloc(sizeof(struct student));
	scanf("%s%s %c%d%s%s",(*p1).num,(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add);
	while(p2!=NULL)
	{
		n=n+1;
		if(n==1)
		{(*p2).next=NULL;}
		else {(*p1).next=p2;}
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		scanf("%s",(*p1).num);
		k=strcmp((*p1).num,"end");
		if(k==0)
		{break;}
		else if(k!=0)
		{
			scanf("%s %c%d%s%s",(*p1).name,&(*p1).sex,&(*p1).age,(*p1).mark,(*p1).add);
        }
	}
	return(p2);
}


//struct student
struct student
{
    char content[50];
    struct student *next;
};

int main()
{
    struct student *head,*p1,*p2,*p3,*h,*p4,*p5,*p6;
    int i,j,k;
    char s[16];
    s[0]='e';
    s[1]='n';
    s[2]='d';
    s[3]='\0';
    int m=0;
    p6=p4=p5=p3=p1=p2=(struct student *)malloc(sizeof(struct student));
    gets(p1->content);
    p4=p1;
    for(;strcmp(p1->content,s)!=0;)
    {
            p2=p1;
            p1=(struct student *)malloc(sizeof(struct student));
            p1->next=p2;
            gets(p1->content);
    }
    p4->next=NULL;
    p3=head=p1->next;
    m=0;
    for(;p3!=NULL;)
    {
                   m++;
                   if(m==1)
                   {
                           printf("%s",p3->content);
                   }
                   else
                   {
                           printf("\n%s",p3->content);
                   }
                   p3=p3->next;
    }
    return 0;
}


struct student
{
	char number[20];
	char name[20];
	char sex;
	int age;
	float score;
	char address[20];
	struct student *next;
}

main()
{
	int i,j,m,n=0;
	struct student *head,*p1,*p2,*p;
	p1=p2=(struct student *)malloc(LEN);
	for(i=0;;i++)
	{
		scanf("%s",p1->number);
		if(strcmp(p1->number,"end")==0)
		{
			break;
		}
		else
		{
			scanf("%s%*c%c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
			n+=1;
		}
		if(i==0)
		{
			head=p1;
		}
		else
		{
			p2->next=p1;
		}
		p2=p1;
		p1=(struct student *)malloc(LEN);
	}
	p2->next=NULL;
	m=n;
	for(i=0;i<n;i++)
	{
		p=head;
		for(j=0;j<m-1;j++)
		{
			p=p->next;
		}
		printf("%s %s %c %d %g %s\n",p->number,p->name,p->sex,p->age,p->score,p->address);
		m-=1;
	}
}


struct student
{
       char num[30];
       char name[30];
       char s[2];
       int age;
       float score;
       char add[30];
       struct student *next;
};
struct student *creat()
{
       int n=0;
       struct student *head;
       struct student *p1;
       struct student *p2;
       p1=p2=(struct student *)malloc(LEN);
       scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add);
       p2->next=0;
       while(p1->num[0]!='e')
       {
           n=n+1;
           if(n>1)
           p1->next=p2;
           p2=p1;head=p1;
           p1=(struct student *)malloc(LEN);
           scanf("%s%s%s%d%f%s",p1->num,p1->name,p1->s,&p1->age,&p1->score,p1->add);
       }
       return(head);
}
int main()
{
    struct student *p=creat();
     for(;;)
    {
       printf("%s %s %s %d %g %s\n",p->num,p->name,p->s,p->age,p->score,p->add);
       p=p->next;
       if(p==0)break;
    }
}


struct student
{
	char num[10];
	char name[20];
	char sex[5];
	char age[5];
	char score[10];
	char adr[20];
	struct student *next;
};
struct student *creat(void)
{
	struct student *head;
    struct student *p1;
	head=p1=( struct student * ) malloc(LEN);
	scanf("%s%s%s%s%s%s",p1->num,p1->name,p1->sex,p1->age,&p1->score,p1->adr);
	p1->next=NULL;
    while(p1->num[0]!='e')
	{
		p1=( struct student * ) malloc(LEN);
		scanf("%s",p1->num);
	    if(p1->num[0]!='e')
		{
			scanf("%s%s%s%s%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->adr);
		    p1->next=head;
		    head=p1;
		}
	}
	return(head);
}
void print(struct student *head)
{
	struct student *p;
	p=head;
	while(p!=NULL)
	{
		printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->adr);
		p=p->next;
	}
}
void main()
{
	struct student *h;
	h=creat();
	print(h);
}


struct student
{
	char xuehao[20];
	char name[50];
	char sex;
	int age;
	float score;
	char addr[100];
	struct student *next;
};
void main()
{
	struct student *p1,*p2,*head,*newhead,*p3;
	int i=1;
	long n=0;
	p1=p2=(struct student *)malloc(LEN);
	head=NULL;
	scanf("%s %s %c %d%f %s",p1->xuehao,p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);
	while(i)
	{
		if(n==0)
		{head=p2=p1;n++;}
		else
		{
		p2->next=p1;p2=p1;
		p1=(struct student *)malloc(LEN);
		   scanf("%s",p1->xuehao);
		if(strcmp(p1->xuehao,"end")==0)
		{i=0;p2->next=NULL;}
		else {scanf("%s %c %d%f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->addr);n++;}
		}
	}
	for(i=0;i<n;i++)
	{p2=p1=head;
	     while(p1->next!=NULL)
		 {p2=p1;
	      p1=p1->next;
		 }
         if(i==0)
			 newhead=p3=p1;
		 else
			 p3=p3->next=p1;
		 p2->next=NULL;
	}

	p2=newhead;
	for(i=0;i<n;i++)
	{	printf("%s %s %c %d ",p2->xuehao,p2->name,p2->sex,p2->age);
	    if((*p2).score==(int)(p2->score))
			printf("%d ",(int)p2->score);
		else printf("%.1f ",p2->score);
		printf("%s\n",p2->addr);
	    p2=p2->next;
	}
}


struct Student
{
char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct Student *next;
struct Student *front;
};
int n;
void main()
{
	struct Student*p1,*p2;
	n=0;
	p1=p2=(struct Student*)malloc(LEN);
	scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	p1->front=NULL;
	while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
	{
			n=n+1;
			p2=p1;
			p1=(struct Student*)malloc(LEN);
			scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
			p1->front=p2;
	}
	while(p2!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
		p2=p2->front;
	}
}


struct student
{
	char a[20];
	char b[40];
	char c;
	int d;
	float e;
	char f[20];
	struct student*before;
};
int n;
struct student* hh()
{
	struct student*p1,*p2,*head;n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s ",&p1->a);head=NULL;
	while(strcmp(p1->a,"end"))
	{
		scanf("%s %c %d %f %s ",&p1->b,&p1->c,&p1->d,&p1->e,&p1->f);
		n=n+1;
		if(n==1)
			p1->before=NULL;
		else p1->before=p2;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s ",&p1->a);
	};
	head=p2;
	return(head);
}
void main()
{
	struct student*p;
	p=hh();
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
		p=p->before;
	};
}


void main()
{
    struct stu
    {
        char num[100];
        char nam[100];
        char sex;
        int age;
        float sco;
        char add[100];
        struct stu *next;
    };
    int len=1,i;
    struct stu *p1,*p2,*head,*new,*newhead;
    p1=p2=head=(struct stu *) malloc(sizeof(struct stu));
    scanf("%s",p1->num);
    while(strcmp(p1->num,"end")!=0)
    {
        scanf("%s %c%d%f%s",p1->nam,&p1->sex,&p1->age,&p1->sco,p1->add);
        p1=(struct stu *) malloc(sizeof(struct stu));
        scanf("%s",p1->num);
        if(strcmp(p1->num,"end")==0) p2->next=NULL;
        else
        {
            p2->next=p1;
            p2=p1;
            len++;
        }
    }
    p1=head;
    for(i=0;i<len;i++)
    {
        p2=p1=head;
        while(p1->next!=NULL)
        {
            p2=p1;
            p1=p1->next;
        }
        if(i==0)
            newhead=new=p1;
        else
            new=new->next=p1;
        p2->next=NULL;
    }
    p1=newhead;
    for(i=0;i<len;i++)
    {
        printf("%s %s %c %d %g %s\n",p1->num,p1->nam,p1->sex,p1->age,p1->sco,p1->add);
        p1=p1->next;
    }
}


struct Node
{
 char Info[200];
 struct Node *Next;
};

int Insert(struct Node *Head)
{
    struct Node *Tmp;
    Tmp=(struct Node *)malloc(sizeof(struct Node));
    gets(Tmp->Info);
    if(strcmp(Tmp->Info,"end")==0)
       {
         free(Tmp);
         return 0;
       }
    else
        {
          Tmp->Next=Head->Next;
          Head->Next=Tmp;
          return 1;
        }
}

int main()
{
    struct Node *Head,*Tmp;
    Head=(struct Node *)malloc(sizeof(struct Node));
    Head->Next=NULL;
    while(Insert(Head));
    Tmp=Head;
    while(Tmp->Next!=NULL)
         {
          Tmp=Tmp->Next;
          printf("%s\n",Tmp->Info);
         }
   return 1;
}


struct student
{
	char num[200],name[80],sex[20],age[30],score[30],add[200];
	struct student *next;
};
 struct student *creat()
{struct student *head,*p1,*p2;
  p1=(struct student*)malloc(LEN);
  scanf("%s",p1->num);
  p1->next=0;
  while(strcmp(p1->num,"end")!=0)
  {   p2=p1;
	  scanf("%s%s%s%s%s\n",p1->name,p1->sex,p1->age,p1->score,p1->add);
	  p1=(struct student*)malloc(LEN);
	  p1->next=p2;
	  scanf("%s",p1->num);
  }
  head=p2;
  return head;
}
void print (struct student* head)
  {   struct student *p;
      for(p=head;p!=0;p=p->next)
	  { printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
      }
  }

int main()
  {  struct student* head;
      head=creat();
      print(head);
	  return 7;
  }


struct sa
{
	char a[500];
	struct sa *next;
};
int n;
struct sa *kao(void)
{
	struct sa *head;
	struct sa *p1,*p2;
	n=0;
    head=NULL;
	p1=p2=(struct sa *)malloc(len);
	gets(p1->a);
	head=p1;
    for(;;)
	{
       n++;
	   if(n==1)
		   p1->next=NULL;
	   else
	   {
		   p2=p1;
           p1=(struct sa *)malloc(len);
		   p1->next=p2;
		   gets(p1->a);
	   }
	   if(strcmp(p1->a,"end")==0)
		   break;
	}
	head=p2;
	return (head);
}
int main()
{
	struct sa *p;
	p=kao();
	for(;p!=NULL;)
	{
		printf("%s\n",p->a);
		p=p->next;
	}
	return 0;
}


struct	STUDENT
{
 char student[100];
	struct STUDENT*	former;
};
int main()
{
	struct STUDENT*	p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT));
	struct STUDENT*	p2;
	p1->former = NULL;
	for (gets(p1->student);p1->student[0]!='e'; gets(p1->student))
	{
		p2 = p1;
		p1 = (struct STUDENT*) malloc(sizeof(struct STUDENT));
		p1->former = p2;
	}
	for (p1=p1->former; p1!=NULL; p1=p1->former)
	{
		printf("%s\n", p1->student);
	}
	return 0;
}


struct student
{
       char num[100];
       struct student *next;
};
main()
{
      int n;
      struct student *head;
      struct student *p1,*p2;
      n=0;
      p1=p2=(struct student*)malloc(LEN);
      gets(p1->num);

      while(p1->num[0]!='e')
      {
      n=n+1;
      if(n==1) p1->next=NULL;
      else p1->next=p2;
      p2=p1;
      p1=(struct student*)malloc(LEN);
      gets(p1->num);
      }
      head=p2;
      do
      {
              printf("%s\n",head->num);
              head=head->next;
      }while(head!=NULL);

}


struct student
{
	char num[10];
	char name[30];
	char gender;
	int age;
	char score[10];
	char address[30];
	struct student *before;
};

void main ()
{
	struct student stu[1000], *tail, *p;
	int i=0,j;

	while (scanf ("%s %s %c %d %s %s",&stu[i].num, &stu[i].name,
			&stu[i].gender, &stu[i].age, &stu[i].score, &stu[i].address)!=EOF)
			i++;
//	for (i=0;stu[i].num[0]!='e';i++)
//	{
//		scanf ("%s %s %c %d %d %s",stu[i].num, stu[i].name,
//			&stu[i].gender, &stu[i].age, &stu[i].score, stu[i].address);
//	}
	tail=&stu[i-1];
	for (j=i-1;j>=0;j--)
		stu[j].before=&stu[j-1];
	stu[0].before=0;
	p=tail->before;
	do
	{

			printf ("%s %s %c %d %s %s\n",p->num, p->name, p->gender,
				p->age, p->score, p->address);

	p=p->before;
	}
	while (p!=0);
}


struct student
{char c[300];
 struct student *next;
};
int n;
struct student * create()
{struct student *head,*p1,*p2;
 n=0;
 p1=p2=head=(struct student*)malloc(Len);
 gets(head->c);
 head->next=0;
 while (strcmp("end",p1->c)!=0)
 {head=p1;
  p1=(struct student*)malloc(Len);
  p1->next=head;
  gets(p1->c);
 }
 return head;
}
int main()
{   struct student *start;
	start=(struct student*)create();
	do
	{printf("%s\n",start->c);
	 start=start->next;
	}while (start->next!=0);
	printf("%s\n",start->c);
	return 7;
}


struct stu
{
	char num[20],name[20],add[30],sex;
	int age;
	float score;
	struct stu *next;
}
main()
{
	struct stu *p1,*p2;
	p1=(struct stu*)malloc(len);
	p1->next=NULL;
	while(1)
	{
		scanf("%s",p1->num);
		if(!strcmp(p1->num,"end")) break;
		scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->add);
		p2=(struct stu*)malloc(len);
		p2->next=p1;
		p1=p2;
	}
	p1=p1->next;
	while(p1)
	{
		printf("%s %s %c %d %g %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}

}


struct student
{
	char num[1000];
  	struct student *next;
};
int n;
struct student * creat (void )
{
	struct student * head;
	struct student *p1,*p2;
	char a[4]={"end"};
	n=0;
	p1=p2= (struct student *)malloc(LEN);
	gets( p1->num );
	head = NULL;
	while (strcmp(p1->num,a)!=0)
	{
		n=n+1;
		if (n==1) head =p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		 gets( p1->num );
	}
	p2->next =NULL;
	return 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 * sort (struct student *head)
{
     struct student *p1,*p2,*p3;

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

}
void main()
{
	struct student *head ;
	head=creat();
	head=sort(head);
	print(head);
}


struct student
{
       char what[100];
       struct student *last;
};
void print(struct student *p)
{
     printf("%s\n",p->what);
     if(p->last!=NULL)print(p->last);
}
main()
{
      struct student stu,*head,*tail,*p1,*p2;
      tail=(struct student*)malloc(LEN);
      tail->last=NULL;
      gets(tail->what);
      p1=tail;
      while(strcmp(p1->what,"end")!=0)
      {
                                      p2=(struct student*)malloc(LEN);
                                      p2->last=p1;
                                      gets(p2->what);
                                      p1=p2;
      }
      head=p1->last;
      print(head);
}


struct student
{
	char ID[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char address[20];
	struct student*next;
};
struct student*creat()
{
	struct student*head,*p1,*p2;
	p1=(struct student*)malloc(LEN);
    scanf("%s %s %c %d %s %s",p1->ID,p1->name,&p1->sex,&p1->age,p1->score,p1->address);
	p1->next=NULL;
	head=p1;
	p2=p1;
	do
	{
		p1=(struct student*)malloc(LEN);
		scanf("%s",p1->ID);
	    if(strcmp("end",p1->ID)==0)
		{
			break;
		}
		else
		{
            scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->address);
			p1->next=NULL;
		    p2->next=p1;
		    p2=p1;
		}
	}while(1);
	return(head);
}
void print(struct student*head)
{
	struct student*p,*ppr;
	while(head->next!=NULL)
	{
		ppr=head;
		p=head->next;
		while(p->next!=NULL)
		{
			ppr=p;
			p=p->next;
		}
		printf("%s %s %c %d %s %s\n",p->ID,p->name,p->sex,p->age,p->score,p->address);
		ppr->next=NULL;
	}
	printf("%s %s %c %d %s %s\n",head->ID,head->name,head->sex,head->age,head->score,head->address);
}
int main()
{
	struct student*head;
	head=creat();
	print(head);
}


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

void main()
{
	struct student *p1,*p2,*head,*p;
	p1=p2=(struct student *) malloc(LEN);
	scanf("%s",p1->num);
	p1->next=NULL;
	while(p1->num[0]!='e')
	{
		scanf("%s %c%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		p1=(struct student *) malloc(LEN);
		p1->next=p2;
		p2=p1;
		scanf("%s",p1->num);
	}
	p=head=p2->next;
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}


struct stu{
	char info[50];
	struct stu *next;
};

int main(int argc, char* argv[])
{
	struct stu *head,*p1,*p2;
	p2=NULL;
	while(1){
		p1=(struct stu*)malloc(LEN);
		gets(p1->info);
		if(strcmp(p1->info,"end")==0){
			break;
		}
		p1->next=p2;
		p2=p1;
	}
	head=p2;
	p1=head;
	while(1){
		printf("%s\n",p1->info);
		if(p1->next==NULL){
			break;
		}
		p1=p1->next;
		free(p2);
		p2=p1;
	}
	return 0;
}


struct student
{
	char id[1000];

    struct student *pre,*next;
};
void main()
{
	struct student *p1,*p2,*head1,*head2;
	int n=0;
	char temp[1000];
	p1=p2=NULL;
	while(gets(temp),strcmp(temp,"end")!=0)
	{
		n=n+1;
		p1=(struct student *)malloc(sizeof(struct student));
		p1->pre=NULL;
		p1->next=NULL;
		head1=NULL;
		strcpy(p1->id,temp);

		if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;}
		p2=p1;
	}

	head2=p2;
	while(p2!=NULL)
	{
		printf("%s\n",p2->id);
		p2=p2->pre;
	}
}


struct student
{
		char num[20];
		char name[20];
		char sex;
		int age;
		char score[10];
		char add[20];
		struct student *next;
};
int n=0;
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	p1=p2=(struct student *)malloc(LEN);
	head=NULL;
	scanf("%s",p1->num);
	if(p1->num[0]=='e')
		return(head);
	scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	p1->next=NULL;
	while(p1->num[0]!='e')
	{
		n=n+1;
		head=p1;
		if(n>1)
		{
			p1->next=p2;
			p2=p1;
		}
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
			break;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	}
	return(head);
}
void print(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->add);
			p=p->next;
		}while(p!=NULL);
}
void main()
{
	struct student *head;
	head=creat();
	print(head);
}


struct student
	{
		char num[10];
		char name[30];
		char sex;
		int age;
		char score[10];
		char address[20];
		struct student *next;
	};
struct student *creat()
{
	struct student *head,*p;
	head=(struct student*)malloc(Len);
	scanf("%s",head->num);
		if(strcmp(head->num,"end")==0) head=NULL;
			else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
	head->next=NULL;
	while(1)
	{
		p=head;
		head=(struct student*)malloc(Len);
		scanf("%s",head->num);
			if(strcmp(head->num,"end")==0) {head=p;break;}
			else scanf("%s %c %d %s %s",head->name,&head->sex,&head->age,head->score,head->address);
		head->next=p;
	}
	return head;
}
void print(struct student *head)
{struct student *q;
q=head;
while(q){printf("%s %s %c %d %s %s\n",q->num,q->name,q->sex,q->age,q->score,q->address);
q=q->next;}
}
void main()
{
	print(creat());
}


struct student
{
	char num[100];
	struct student *next;
};

main()
{
	int n,i;
	struct student *head,*p1,*p2,*p;
	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) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*) malloc(LEN);
		gets(p1->num);
	}
	p2->next=NULL;
	for(i=0;i<n;i++)
	{
		p=head;
		while(p->next!=NULL)
		{
			p1=p;
			p=p->next;
		}
		printf("%s\n",p->num);
		p1->next=NULL;
	}
}


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);
}


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;
}


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
{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;
}


struct xs
{
    char num[10];
    char name[30],sex[2],adr[100],grade[20];
    int year;
    struct xs *next;
};
struct xs *creat()// ?0?7?0?9×?0?0·?0?4 ?0?3?0?1 NULL ?0?4?0?1?0?7à?0?6?0?0?0?8?0?5?0?8×?0?8?0?1?0?0·
{
    struct xs *head,*p1,*p2;
    p1=p2=(struct xs *)malloc(LEN);
    head=NULL;
    p1->next=NULL;
    int n=0;
   while(1)
    {
        n++;
        scanf("%s",p1->num);
        if(strcmp(p1->num,"end")==0){
            if(n==1)return NULL;
            else break;
        }
        SCAN;
        if(n==1)head=p1;
        else p2->next=p1;
        p2=p1;
        p1=(struct xs*)malloc(LEN);
    }
    p2->next=NULL;
    return head;
}
void output(struct xs* head)//?0?8×?0?8?0?1?0?0·NULL ?0?8?0?1?0?6?0?2?0?3?0?1?0?6?0?8?0?3?0?5
{
    struct xs *p=head;
    if(p==NULL)printf("\n");
    else do
    {
    printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->year,p->grade,p->adr);
    p=p->next;
    }
    while(p!=NULL);
}
struct xs * change(struct xs*head)//?0?8×?0?8?0?1?0?0· NULL ?0?3?0?1 NULL
{
    struct xs *p1,*p2,*p3;
    if(head==0)
        return 0;
    p1=NULL;
    p2=head;
    p3=p2->next;
    while(1)
    {
         p2->next=p1;
         if(p3==NULL){

             head=p2;
             p2->next=p1;
             break;
         }
         else {
             p1=p2;
             p2=p3;
             p3=p3->next;
         }

    }
    return head;
}
int main()
{
    struct xs *head;
    head=creat();
    head=change(head);
    output(head);
    getchar();
    getchar();
    return 0;
}


struct s
{
char xh[50];
char xm[55];
char xb;
int nl;
char df[50];
char dz[50];
struct s *next;
};
void main()
{
struct s *head,*p1,*p2,*p;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=NULL;
while(strcmp(p2->xh,"end")!=0)
{
scanf("%s",p2->xm);
scanf(" %c",&p2->xb);
scanf(" %d",&p2->nl);
scanf(" %s",p2->df);
scanf(" %s",p2->dz);
head=p2;
p1=p2;
p2=(struct s *)malloc(len);
scanf("%s",p2->xh);
p2->next=p1;
}
p=head;
while(p!=NULL)
{printf("%s %s %c %d %s %s\n",p->xh,p->xm,p->xb,p->nl,p->df,p->dz);
p=p->next;}

}


struct student
{
	char num[20];
	char name[30];
	char sex;
	int age;
	char score[20];
	char add[40];
	struct student *next;
};
void main()
{
	struct student *p1,*head;
	head=(struct student *)malloc(L);
	p1=head->next=NULL;
	scanf("%s",head->num);
	while(strcmp(head->num,"end")!=0)
	{
		p1=head;
		scanf(" %s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		head=(struct student *)malloc(L);
		head->next=p1;
		scanf("%s",head->num);
	}
	free(head);
	head=p1;
	while(p1!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
}


struct student
{
	char id[50];
	char *name;
	char sex;
	short int age;
	float score;
	char *add;
	struct student *next;
};
int n;
struct student *creat(void)
{
	struct student *p1,*head,*p2;
	n=0;
	head=NULL;
	p2=p1=(struct student*)malloc(sizeof(struct student));
    gets(p1->id);
	while(strcmp(p1->id,"end")!=0)
	{
		n++;
		if(n==1)
		p1->next=NULL;
		else
		{   p1->next=p2;
		}
		p2=p1;
		head=p2;
		p1=(struct student*)malloc(sizeof(struct student));
		gets(p1->id);
	}
	return head;
}
void print(struct student *head)
{
	struct student *p;
	p=head;
    while(p!=NULL)
	{
		printf("%s\n",p->id);
		p=p->next;
	}
}
main()
{
	struct student *head;
	head=creat();
	print(head);
}


struct Student
{
   char imf[100];
   struct Student *next,*pre;
};

int main()
{

    struct Student *p,*q,*h;

    h=p=q=malloc(LEN);
    gets(q->imf);
    q->pre=q->next=NULL;

    while(strcmp(q->imf,"end")!=0)
    {
       p=q;
       q=malloc(LEN);
       q->next=NULL;
       q->pre=p;
       p->next=q;
       gets(q->imf);
    }

    while(p!=NULL)
    {
      puts(p->imf);
      p=p->pre;
    }
}


struct student
{
	char s[10];
	char name[30];
	char sex;
	char age[3];
	char score[6];
	char place[15];
	struct student *next;
	struct student *last;
};
int n;
struct student *creat()
{
	struct student *head1,*head2;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(100);
    head1=NULL;scanf("%s ",&p1->s);
	do
	{
		scanf("%s %c %s %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->place);
		n=n+1;
		if(n==1)
		{head1=p1;p1->last=NULL;}
		else {p2->next=p1;p1->last=p2;
		p2=p1;}p1=(struct student*)malloc(100);scanf("%s",&p1->s);
	}while(p1->s[0]!='e');head2=p2;
	p2->next=NULL;
	return(head2);
}
void main()
{
	struct student *p1;
	p1=creat();
	do{printf("%s %s %c %s %s %s\n",p1->s,p1->name,p1->sex,p1->age,p1->score,p1->place);
		p1=p1->last;
		}while(p1!=NULL);
}


struct stu
{
	char a[100];
	struct stu *prev;
	struct stu *next;
};
void main()
{
	struct stu *end,*p1,*p2,*head;
	int m,n,j;
	p1=(struct stu*)malloc(sizeof(struct stu));
	end=p1;
	p2=p1;
	gets(p1->a);
	p1->next=0;
	scanf("\n");
	for(;;)
	{
		p1=(struct stu*)malloc(sizeof(struct stu));
		gets(p1->a);
		scanf("\n");
		if(strcmp(p1->a,"end")==0)
		{
			head=p2;
			break;
		}
		else
		{
			p1->next=p2;
			p2=p1;
		}
	}
	for(;head!=0;head=head->next)
	{
		puts(head->a);
	}
}


struct student
 {
   char num[30];
   char name[40];
   char sex[2];
   int age;
   float score;
   char add[50];
   struct student *next;
 };
int n;
struct student *creat()
{
  struct student *head;
  struct student *p1,*p2;
  n=0;
  p1=p2=( struct student * ) malloc(LEN);
  scanf("%s",p1->num);
  head=0;
  while(strcmp(p1->num,"end")!=0)
  {
    scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
	n++;
	if(n==1) p2->next=0;
	else p1->next=p2;
	p2=p1;
	p1=( struct student * ) malloc(LEN);
	scanf("%s",p1->num);
  }
  head=p2;

  return(head);
}
void print(struct student * head)
{
  struct student * p;
  p=head;
  if(head!=0)
	  do
	  {
		  printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
		  p=p->next;
	  }while(p!=0);
}
void main()
{
    struct student *head;
	head=creat();
	print(head);
}


struct Student
{
    char id[100];
    char name[300];
    int age;
    char sex;
    char score[100];
    char address[300];
    struct Student *before;
}s[2500];

main()
{
	struct Student *p,*q,*head;
	int i=0,j,k,n,m;
	scanf("%s",&s[0].id);
	p=&s[0];
	q=NULL;
	while (p!=NULL)
	{

		scanf("%s %c%d%s%s",p->name,&p->sex,&p->age,p->score,p->address);
		p->before=q;
		q=p;
		scanf("%s",&s[i+1].id);
		if (strcmp(s[i+1].id,"end")==0)
		{
			p=NULL;
			head=q;
		}
		else {
		p=&s[i+1];
		i++;
		}
	}
	p=head;q=NULL;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address);
		p=p->before;
	}

}


struct stu
{	//????????
	char stunum[10];
	char name[20];
	char sex[3];
	char age[10];
	char mark[10];
	char add[20];
	struct stu *next,*before;//??
};

void main()
{
	struct stu *p,*pt,*head;
	int i=0,n=0;
	char a[4];
	strcpy(a, "end");
	pt=p=head=(struct stu *)malloc(Len);
	for(i=0;;i++)
	{
		scanf("%s",&p->stunum);
		if(strcmp(p->stunum,a)==0)
		{
			pt->next=NULL;break;
		}
		scanf("%s %s %s %s %s",&p->name,&p->sex,&p->age,&p->mark,&p->add);
		pt=p;
		p=(struct stu *)malloc(Len);
		pt->next=p;
		p->before=pt;
	}
	p=pt;
	if(p!=head)
	{
		for(i=0;;i++)
		{
			printf("%s %s %s %s %s %s",&p->stunum,&p->name,&p->sex,&p->age,&p->mark,&p->add);
			if(p==head)
				break;
			printf("\n");
			p=p->before;
		}
	}
	printf("\n");
}


struct stu{
	char name[20];
	char num[10];
	char x[5];
	int y;
	float f;
	char add[100];
	struct stu *next;
};

int main()
{
	struct stu *p1,*p2;

	p1=(struct stu *)malloc(sizeof(struct stu));

	p1->next=0;

	scanf("%s",p1->num);

	while(p1->num[0]!='e')
	{
		scanf("%s%s%d%f%s",p1->name,p1->x,&p1->y,&p1->f,p1->add);
		p2=p1;
		p1=(struct stu *)malloc(sizeof(struct stu));
		p1->next=p2;
		scanf("%s",p1->num);
	}

    p1=p1->next;
	printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->x,p1->y,p1->f,p1->add);
	while(p1->next!=0)
	{
		p1=p1->next;
		printf("%s %s %s %d %g %s\n",p1->num,p1->name,p1->x,p1->y,p1->f,p1->add);
	}

	return 0;
}


struct Student
{
    char stu[500];
    struct Student * next;
};

int n=0;
void main()
{
    struct Student * creat();
    void print(struct Student *head,int num);
    struct Student *head;
    head=creat();
    int i=0;
    for(i=n;i>0;i--)
        print(head,i);
}

struct Student * creat()
{
    struct Student *p1,*p2;
    struct Student *head;
    head=NULL;
    p1=p2=(struct Student *)malloc(LEN);
    gets(p1->stu);
    while(strcmp(p1->stu,"end")!=0)
    {
        n=n+1;
        if(n==1)
        {
            head=p1;
        }
        else
        {
            p2->next=p1;
        }
        p2=p1;
        p1=(struct Student *)malloc(LEN);
        gets(p1->stu);
    }
    p2->next=NULL;
    return(head);
}

void print(struct Student *head,int num)
{
    struct Student *p;
    p=head;
    int count=1;
    while(count<num)
    {
        p=p->next;
        count+=1;
    }
    printf("%s\n",p->stu);
}


main()
{
   struct h
   {char mun[10];
    char name[20];
    char sex;
    int age;
    float score;
    char add[20];
    struct h *p;
   } ;

   struct h *a,*b;
   a=len;
   a->p=NULL;
   int i;
   for(i=0;i<1000;i++)
   {scanf("%s",a->mun);
	if(!strcmp(a->mun,"end")) break;
    scanf("%s %c %d %f %s",a->name,&a->sex,&a->age,&a->score,a->add);
   b=len;
   b->p=a;
   a=b;}
   a=a->p;
   while(a)
   {
     printf("%s %s %c %d %g %s\n",a->mun,a->name,a->sex,a->age,a->score,a->add);
     a=a->p;
   }

}


struct student
{
	char inf[200];
	struct student *next;
};
int n;
struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=(struct student *)malloc(LEN);
	p2=p1;
	gets(p1->inf);
	head=NULL;
	do
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		gets(p1->inf);
	}
	while(strcmp((p1->inf),"end")!=0);
	p2->next=NULL;
	return(head);
}
int main()
{
	struct student *r,*headr;
	r=creat();
	headr=r;
	r=r->next;
	for(;r!=headr;)
	{
		for(r=headr;r->next!=NULL;)r=r->next;
		printf("%s\n",r->inf);
		for(r=headr;(r->next)->next!=NULL;)r=r->next;
		r->next=NULL;
	}
	printf("%s",headr->inf);
}


struct student
{
	char infor[100];
		struct student *next;
};

struct student *creat(void)
{  struct student *head;
       struct student *p1,*p2;
         int n;
		 char l[4]={"end"};
		 n=0;
       p1=p2=(struct student *)malloc(LEN);
      gets(p1->infor);
       head=NULL;
       while(strcmp(p1->infor,l)!=0)
	   {   n=n+1;
           if(n==1) head=p1;
           else p2->next=p1;
              p2=p1;
             p1=(struct student *)malloc(LEN);
            gets(p1->infor);
	   }
           p2->next=NULL;
        return(head);
}
void print(struct student *head)
{
	struct student *p,*p1,*p2;
	p=p1=p2=head;
	p2=p->next;
	p1=p2->next;
	head->next=NULL;
	for(;p1->next!=NULL;)
	{
	p2->next=p;
	p=p2;
	p2=p1;
	p1=p1->next;
	}
	p2->next=p;
	p1->next=p2;
	head=p1;
	p=head;
	for(;p!=NULL;)
	{printf("%s\n",p->infor);
      p=p->next;
	}
}
void main()
{
	struct student *head;
	head=creat();
	print(head);
}


int n=1;
struct student
{char num[20];
char name[20];
char sex;
int age;
char score[10];
char ad[20];
struct student *next;
};
struct student* appendnewnode(void)
{
	struct student *newnode,*thisnode;
	int x;
    do{
		newnode=(struct student*)malloc(sizeof(struct student));
		scanf("%s",newnode->num);
		getchar();
		x=strcmp(newnode->num,"end");
		if(x!=0){
			scanf("%s %c %d %s %s",newnode->name ,&newnode->sex ,&newnode->age ,newnode->score ,newnode->ad);
		if(n==1)
		{
			newnode->next =0;
		}
		else
		{
			newnode->next =thisnode;
		}
		thisnode=newnode;
		n++;
		}
	}while(x!=0);
	return(thisnode);
}
void main()
{
	struct student *p,*head;
	head=appendnewnode();
	p=head;
	do
	{
		printf("%s %s %c %d %s %s\n",p->num ,p->name ,p->sex ,p->age ,p->score ,p->ad);
	    p=p->next ;
	}while(p!=NULL);
}


struct Student{
	char stu[100];
	struct Student *next;
};
int main()
{
	struct Student *p,*head,*p1,*p2;
	int n = 0;
	p2 = p1 = (struct Student *)malloc(Len);
	head = NULL;
	gets(p1->stu);
	while(strcmp(p1->stu,"end")!=0){
		n++;
		head = p1;
		if (n==1) p1->next = NULL;
		else{
			p1->next = p2;
		    p2 = p1;
		}
		    p1 = (struct Student *)malloc(Len);
		    gets(p1->stu);
	}

    p = head;
    if (head != NULL){
		do{
			puts(p->stu);
			p=p->next;
		}while(p != NULL);
	}

	return 0;
}


struct xinxi
{
	char stu[1000];
	struct xinxi *next;
};
void main()
{
	struct xinxi *head,*p,*pt;
	int i,n;

	p=(struct xinxi *)malloc(sizeof(struct xinxi));
	gets(p->stu);
	pt=p;
	head=(struct xinxi *)malloc(sizeof(struct xinxi));
	n=0;
	while(strcmp(p->stu,"end")!=0)
	{   n=n+1;
		if(n==1)head->next=p;
		if(n>1)pt->next=p;

		pt=p;
		p=(struct xinxi *)malloc(sizeof(struct xinxi));
		n=n+1;
        gets(p->stu);
	}
	pt->next=NULL;

while(head->next!=NULL)
	{	pt=head;
	p=head->next;
	while(p->next!=NULL)
	{p=p->next;
	pt=pt->next;}

	puts(p->stu);
	pt->next=NULL;
	}
}


struct stu
{
     char inf[100];
     struct stu *next;
};

void down(struct stu *now)
{
     if (now->next!=0) down(now->next);
     if (now->next!=0) printf("%s\n",now->inf);
}

int main()
{
    void down(struct stu *now);
    struct stu *head,*now,*neww;
    head=(struct stu*) malloc(sizeof(struct stu));
    head->next=0;
    gets(head->inf);
    now=head;
     do
     {
       neww=(struct stu*) malloc(sizeof(struct stu));
       neww->next=0;
       gets(neww->inf);
       now->next=neww;
       now=neww;
                                         //      printf("%s\n",now->inf);

     }while (strcmp(now->inf,"end")!=0);
    down(head);
 //   int i;scanf("%d",&i);
    return 0;
}


struct student
{
	char id[10];
	char name[20];
	char sex[2];
	int age;
	char s[10];
	char add[20];
	struct student *next;
};
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int i=0;
	p1=p2=(struct student*)malloc(LEN);
	head=NULL;
	while(scanf("%s",p1->id)&&*p1->id>=48&&*p1->id<=57)
	{
		scanf("%s%s%d%s%s",p1->name,p1->sex,&p1->age,p1->s,p1->add);
		if(i==0)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		i++;
	}
	p2->next=NULL;
    return (head);
}
void turn(struct student *head)
{
	struct student *p1,*p2;
	p2=p1=head;
	while(head->next!=NULL)
	{
		while(p1->next!=NULL)
		{
			p2=p1;
			p1=p1->next;
		}
		printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add);
		p2->next=NULL;p1=head;
	}
printf("%s %s %s %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->s,p1->add);
}
void main()
{
	struct student *head;
	head=creat();
	turn(head);
}


struct stu
{
       char x[300];
       struct stu *next;
};

void creat1(struct stu *head,char *p)           //?????
{
     struct stu *pre,*p1,*s;
     s=(struct stu *)malloc(sizeof(struct stu));
     strcpy(s->x,p);
     pre=head;
     p1=pre->next;
     pre->next=s;
     s->next=p1;
}

void creat2(struct stu *head,char *p)           //?????
{
     struct stu *pre,*p1,*s;
     s=(struct stu *)malloc(sizeof(struct stu));
     strcpy(s->x,p);
     pre=head;
     p1=pre->next;
     for(;p1!=NULL;)
     {
                   pre=p1;
                   p1=p1->next;
     }
     pre->next=s;
     s->next=p1;
}

int main()
{
    int i,j,k,m,n;
    char *p;
    p=(char *)malloc(300*sizeof(int));
    struct stu *head,*s;
    head=(struct stu *)malloc(sizeof(struct stu));
    head->next=NULL;
    for(i=0;;i++)
    {
                 gets(p);
                 if(*(p+0)=='e')
                 {
                                break;
                 }
                 else
                 {
                     creat1(head,p);
                 }
    }
    s=head->next;
    for(;s!=NULL;)
    {
                  puts(s->x);
                  s=s->next;
    }
    return 0;
}


// ??????????.cpp : ??????????????
//

struct student
{
	char info[100];
	struct student *pre;
};

struct student *creat()
{
	struct student *p1,*p2,*head;
	p1=(struct student*)malloc(L);
	gets(p1->info);
	if(strcmp(p1->info,"end")==0)
	{
		return(NULL);
		exit;
	}
	else
	{
	    p2=NULL;
	    for(int i=1;;i++)
	    {
		    p1->pre=p2;
		    p2=p1;
		    p1=(struct student*)malloc(L);
		    gets(p1->info);
		    if(strcmp(p1->info,"end")==0) break;
	    }
	    p1->pre=p2;
	    head=p1->pre;
	    return(head);
    }
}

int main()
{
	struct student *p;
	p=creat();
	while(p!=NULL)
	{
		printf("%s\n",p->info);
		p=p->pre;
	};
	return 0;
}


struct student
{
	char num[10];
	char name[30];
	char sex[2];
	char age[5];
	char score[10];
	char add[20];
	struct student *prev;
};
struct student *create(void)
{
	struct student *p1,*p2;
	p1=(struct student *)malloc(sizeof(struct student));
	scanf("%s",p1->num);
	if(strcmp(p1->num,"end"))
	{
		scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->add);
		p2=p1;
		p1->prev=NULL;
	}
	while(strcmp(p1->num,"end"))
	{
		p1=(struct student *)malloc(sizeof(struct student));
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end"))
		{
			scanf("%s%s%s%s%s",p1->name,p1->sex,p1->age,p1->score,p1->add);
			p1->prev=p2;
			p2=p1;
		}
	}
	return(p2);
}
void main()
{
	struct student *p1;
	p1=create();
	while(p1!=NULL)
	{
		printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->prev;
	}
}


struct student
{
	char num[200];
	struct student *next;
};
void main()
{
	int n,i,k,j;
	    struct student *head;
		struct student *p1,*p2;
		struct student *newhead,*nnew;
		n=0;
		p1=p2=(struct student *)malloc(sizeof(struct student));
		gets(p1->num);
		head=NULL;
		while(strcmp(p1->num,"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->num);
		}
		p2->next=NULL;
		for(i=0;i<n;i++)
		{
			p2=p1=head;
			while(p1->next!=NULL)
			{
				p2=p1;
				p1=p1->next;
			}
			if(i==0)
				newhead=nnew=p1;
			else
				nnew=nnew->next=p1;
			p2->next=NULL;
		}
		p1=newhead;
		for(i=0;i<n;i++)
		{
			printf("%s",p1->num);
			p1=p1->next;
			printf("\n");
		}
}


struct stu
{
	char information[100];//????????????????????????????
	struct stu*next;//??????
	struct stu*last;//??????????????????????????
};
struct stu*creat(void)
{   struct stu *end,*p1,*p2;
    int flag=1;
	p1=(struct stu*)malloc(Len);
	gets(p1->information);
	if(strcmp(p1->information,"end")==0) //??????????????
	{	p2=null; flag=0;}
	else
	{
	    p1->last=null;//?????????????
	   do
	   {
		p2=p1;
		p1=(struct stu*)malloc(Len);
		p2->next=p1; //????????????
		p1->last=p2;//?????????????????
	    gets(p1->information);
		if(strcmp(p1->information,"end")==0) flag=0;//??end???????
	    }while(flag==1);
	}
	end=p2;
	return end;
}
void printf(struct stu*end)
{
	struct stu* p;
	p=end;
	while(p!=null)
	{
		 printf("%s\n",p->information);
		 p=p->last;//???????????
	}
}

int main()
{
	struct stu *move;
	move=creat();
	printf(move);
}


struct student{
               char info[100];
               struct student *before;
               }student[10000];

int main()
{
    void print(struct student *p);
    int i=0,j;
    char a[10000][100];
    gets(a[0]);
    while(a[i][0]!='e'){
                        strcpy(student[i].info,a[i]);
                        i++;
                        gets(a[i]);
                        }
    student[0].before=NULL;
    for(j=0;j<=i-1;j++){
                      student[j+1].before=&student[j];
                      }
    print(&student[i-1]);
    return 0;
    }

void print(struct student *p)
{
     printf("%s\n", p->info);
     if(p->before!=NULL){print(p->before);}
     }


//???
int main()
{
   struct student
   {
      char id[200];
	  char name[200];
	  char sex;
	  int age;
	  double score;
	  char add[200];
   }stu[1000];
   int i=0;
   while(cin>>stu[i].id)
   {
	   if(strcmp(stu[i].id,"end")==0)
		   break;
	   else
		   cin>>stu[i].name>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].add;
	   i++;
   }
   int j=i;
   for(j=i-1;j>=0;j--)
   {
	   cout<<stu[j].id<<' '<<stu[j].name<<' '<<stu[j].sex<<' '<<stu[j].age<<' '<<stu[j].score<<' '<<stu[j].add<<endl;
   }
   return 0;
}


struct student
{
	char inf[100];
	struct student *next;
	struct student *last;
};
int n;
struct student *end;
struct student *creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	gets(p1->inf);
	head=NULL;
	while(1)
	{
		n=n+1;
		if(n==1)head=p1;
		else {p2->next=p1;p1->last=p2;}
		p2=p1;
		p1=(struct student*)malloc(LEN);
	    gets(p1->inf);
		if((p1->inf)[0]=='e') break;
	}
	head->last=NULL;
	p2->next=NULL;
	end=p2;
	return(head);
}
main()
{
	struct student *head;
	struct student *p1,*p2;
	head=creat();
	p1=end;
	while(p1!=NULL)
	{
		p2=p1;
		puts(p1->inf);
		p1=p2->last;
	}
}


struct student
{
	char num[100];
	char name[100];
	char sex;
	int age;
	char score[20];
	char address[100];
	struct student *next;
};
struct student *creat()
{
	struct student *head,*p1,*p2;
	p1 = (struct student*)malloc(len);
    p2 = p1;
	scanf("%s",p1->num);
    if(strcmp(p1->num,"end") == 0)
	{head = p1;p1->next = NULL;}
	else
	{
	scanf(wtf);
	p1->next = NULL;
	for (;;)
	{
      p1 = (struct student*)malloc(len);
	  scanf("%s",p1->num);
	  if(strcmp(p1->num,"end") == 0)
		  break;
	  scanf(wtf);
	  p1->next = p2;
	  p2 = p1;
	}
	head = p2;
	}
	return(head);
}
main()
{
	struct student *p;
	p = creat();
	if (p->next == NULL)
		printf("\n");
	else
	{
	for(;p!=NULL;)
	{
		printf(wtf2);
		p = p->next;
	}
	}
}


int main(){
int i,n;
struct information{
char num[20];
char name[20];
char sex;
int age;
char score[100];
char address[20];
}stu[1000];         //????
for(i=0;i<1000;i++){
	cin>>stu[i].num;
	if((stu[i].num[0]=='e')&&(stu[i].num[1]=='n')&&(stu[i].num[2]=='d')){
		n=i-1;
		break;}   //???end?????
	else{
	cin>>stu[i].name;
	cin>>stu[i].sex;
	cin>>stu[i].age;
	cin>>stu[i].score;
	cin>>stu[i].address;}
}           //????
for(i=n;i>=0;i--){
	cout<<stu[i].num<<" "<<stu[i].name<<" "<<stu[i].sex<<" "<<stu[i].age<<" "<<stu[i].score<<" "<<stu[i].address<<endl;
}       //????
return 0;
}


char ss[]={'e','n','d'};
int n=0;
struct st
{
	char s[200];
	struct st *next1;
};
void main()
{
	struct st *p;
	struct st *creat(void);
	int i=0;
	struct st *head;
	struct st *p1,*p2;
	p1=p2=(struct st *)malloc(len);
	p1->next1=NULL;
	gets(p1->s);
	head=p1;
	while(1)
	{
		n++;
		if(n==1)head=p1;
		p2=p1;
		p1=(struct st *)malloc(len);
		gets(p1->s);
		p1->next1=p2;
		if(strcmp(p1->s,ss)==0)
		{
			break;
		}
	}
	head->next1=NULL;
	for(i=0;i<n;i++)
	{
		printf("%s\n",p2->s);
		p2=p2->next1;
	}
}


struct stu{
	char num[20];
	char name[20];
	char gender;
	int age;
	float score;
	char address[20];
	struct stu *next;
};

struct stu *creat()
{
	struct stu *head,*p1,*p2;
	head=p1=p2=(struct stu *)malloc(LEN);
	head->next=NULL;
	scanf("%s",p1->num);
	SCAN;
	for(;;)
	{
	    p1=(struct stu *)malloc(LEN);
		scanf("%s",p1->num);
	    if(p1->num[0]!='e')
		{SCAN;
	     p1->next=p2;
  	     p2=p1;}
        else
        {break;}
	}
	return(p2);
}

int main()
{
	struct stu *p,*t;
	t=creat();
	for(p=t;p!=NULL;p=p->next)
	printf("%s %s %c %d %g %s\n",p->num,p->name,p->gender,p->age,p->score,p->address);
}


struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	float grade;
	char addr[100];
	struct student *next;
};
struct student *creat()
{
	struct student *pt,*pn;
	pn=(struct student *)malloc(sizeof(struct student));
	pt=0;
	scanf("%s",pn->num);
	pn->next=0;
	while(pn->num[0]!='e')
	{
		scanf("%s %c %d %f %s",pn->name,&pn->sex,&pn->age,&pn->grade,pn->addr);
		pt=pn;
		pn=(struct student *)malloc(sizeof(struct student));
		pn->next=pt;
		scanf("%s",pn->num);
	}
	return(pt);
}
int main()
{
	struct student *head,*p;
	head=creat();
	p=head;
	while(p!=0)
	{
		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->addr);
		p=p->next;
	}
	return 0;
}


struct stu
{
	char num[15];
	char name[20];
	char sex;
	int age;
	char score[10];
	char addr[15];
	struct stu* next;
};
int main()
{
	struct stu* p1,*p2;
	p1=(struct stu*)malloc(len);
	scanf("%s%s %c%d%s%s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
	p1->next=NULL;
	while(1)
	{
		p2=(struct stu*)malloc(len);
		scanf("%s",p2->num);
		if(p2->num[0]=='e')
			break;
        scanf("%s %c%d%s%s",p2->name,&p2->sex,&p2->age,p2->score,p2->addr);
		p2->next=p1;
		p1=p2;
	}
	while(p1!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->addr);
		p1=p1->next;
	}
	return 0;
}


struct stu
{
	char a[1000];
	struct stu *next;
};
void main()
{
	struct stu *head,*p1,*p2;
	p1=p2=(struct stu*)malloc(LEN);
	head=p1;
	p1->next=NULL;
	gets(p1->a);
	while (strcmp(p1->a,"end")!=0)
	{
			p1=(struct stu*)malloc(LEN);
			gets(p1->a);
			head=p1;
			p1->next=p2;
			p2=p1;
	}
	p1=head->next;
	while (p1!=NULL)
	{
		puts(p1->a);
		p1=p1->next;
	}
}


typedef struct student
{
	char num[20];
	char name[20];
	char sex[2];
	char age[3];
	char mark[10];
	char add[30];
	struct student *next;
} stu;
int n;
stu* rcreate()
{
	stu *head,*p;
	head=p=(stu*)malloc(LEN);
	scanf("%s",p->num);
	p->next=NULL;
	if(strcmp(p->num,"end")==0)
	{
		head=NULL;
		return(NULL);
	}
	while(strcmp(p->num,"end")!=0)
	{
		scanf("%s %s %s %s %s",p->name,p->sex,p->age,p->mark,p->add);
		p=(stu*)malloc(LEN);
		p->next=head;
		head=p;
		scanf("%s",p->num);
	}
	head=p->next;
	free(p);
	return(head);
}
void print(stu* head)
{
	stu *p;
	p=head;
	if(p==NULL)
	{
		printf("list null!");
		return;
	}
	while(p->next!=NULL)
	{
		printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
		p=p->next;
	}
	printf("%s %s %s %s %s %s\n",p->num,p->name,p->sex,p->age,p->mark,p->add);
}
void main()
{
	stu *h;
	h=rcreate();
	print(h);
}


struct student
{
	char num[100];
	char name[100];
	char gender;
	int age;
	float score;
	char add[100];
	struct student *next;
};
int n;
struct student *head=0;
struct student * creat(void)
{
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *) malloc(LEN);
	while(strcmp(p1->num,"end")!=0)
	{
		n++;
		if(n==1)
			p2->next=0;
		else p1->next=p2;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
		scanf("%s %c %d %f %s",p1->name,&p1->gender,&p1->age,&p1->score,p1->add);
	}
	head=p2;
	return(head);
}
void main()
{
	struct student *p;
	p=creat();
	if(p!=0)
		do
		{
			printf("%s %s %c %d %g %s",p->num,p->name,p->gender,p->age,p->score,p->add);
			p=p->next;
			if(p->next!=0)
				printf("\n");
		} while(p->next!=0);
}


struct S
{
	char xuehao[200];
	char xingming[200];
	char xingbie;
	int nianling;
	float defen;
	char dizhi[200];
	struct S *next;
};
int main()
{
	struct S *p1,*p2,*head;
	head=(struct S *)malloc(sizeof(struct S));
	p1=head;
	scanf("%s",p1->xuehao);
	head->next=NULL;
	while(p1->xuehao[0]!='e')
	{
		scanf("%s %c%d%f %s",p1->xingming,&p1->xingbie,&p1->nianling,&p1->defen,p1->dizhi);
		p2=(struct S*)malloc(sizeof(struct S));
		p2->next=p1;
		p1=p2;
		scanf("%s",p1->xuehao);
	}
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p1->next->xuehao,p1->next->xingming,p1->next->xingbie,p1->next->nianling,p1->next->defen,p1->next->dizhi);
		p1=p1->next;
	}
	return 0;
}


/*
 * tongjixueshengxinxi.cpp
 *
 *  Created on: 2011-12-18
 *      Author: 1100012857
 */
int main(void)
{
	struct student
	{
		char stunum[100];
		char stuname[20];
		char sex;
		int age;
		char score[20];
		char location[20];
		//struct student *next;
	}stu[990];
	int i;
	for(i=0;;i++)
	{
		cin>>stu[i].stunum;
		if(stu[i].stunum[0]=='e')
			break;
		cin>>stu[i].stuname>>stu[i].sex>>stu[i].age>>stu[i].score>>stu[i].location;

	}
	i--;
	int n=i;
	for(i=n;i>=0;i--)
	{
		cout<<stu[i].stunum<<' '<<stu[i].stuname<<' '<<stu[i].sex<<' '<<stu[i].age<<' '<<stu[i].score<<' '<<stu[i].location<<endl;
	}
	return 0;
}


struct student
{
	char num[10];
	char name[20];
	char sex;
	int age;
	char score[10];
	char add[15];
	struct student *next;
};
void main()
{
	struct student *p1,*p2,*head;
	int n=0;
	p1=p2=(struct student*)malloc(LEN);
	p1->next=NULL;
	scanf("%s",p1->num);
	while(strcmp(p1->num,"end")!=0)
	{
		scanf("%s %c %d %s %s\n",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		n++;
		p2=(struct student*)malloc(LEN);
		p2->next=p1;
		p1=p2;
		scanf("%s",p1->num);
	}
	head=p1->next;
	p1=head;
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}


struct student
{
    char con[50];
    struct student *next;
};
int n;

struct student *creat(void)
{
    struct student *head,*p,*q;
    n=0;
    p=q=(struct student *)malloc(len);
	gets(p->con);
    head=null;
    while(strcmp(p->con,"end")!=0)
    {
        //scanf("%s %c %d %d %s",p->name,&p->gender,&p->age,&p->score,p->add);
        n++;
        if(n==1)head=p,p->next=null;
        else head=p,p->next=q;
        q=p;
        p=(struct student *)malloc(len);
		gets(p->con);
    }
    return(head);
}

void print(struct student *head)
{
    struct student *p;
    p=head;
    int i;
    for(i=0;i<n;i++)
    {
		printf("%s\n",p->con);
        p=p->next;
    }
}

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


struct student
	{
		char number[30];
		char name[30];
		char gender;
		int age;
		char score[30];
		char add[30];
	};
int main()
{

	int lengthofnumber[505]={0},lengthofname[505]={0},lengthofadd[505]={0},lengthofscore[505]={0};
	int i,j,numberofstudent=0;
	struct student stu[505];
	for(i=0;i<505;i++)
	{//read
		for(j=0;j<30;j++)
		{//number
			scanf("%c",&stu[i].number[j]);
			if(stu[i].number[j]==' '||stu[i].number[j]=='d')
			{
				break;
			}
			else
			{
				lengthofnumber[i]+=1;
			}
		}//number
		if(stu[i].number[2]=='d')
		{
			break;
		}
		else
		{
			numberofstudent+=1;
		}
		for(j=0;j<30;j++)
		{//name
			scanf("%c",&stu[i].name[j]);
			if(stu[i].name[j]==' ')
			{
				break;
			}
			else
			{
				lengthofname[i]+=1;
			}
		}//name
		scanf("%c",&stu[i].gender);
		getchar();
		scanf("%d",&stu[i].age);
		getchar();
		for(j=0;j<30;j++)
		{//score
			scanf("%c",&stu[i].score[j]);
			if(stu[i].score[j]!=' ')
			{
				lengthofscore[i]+=1;
			}
			else
			{
				break;
			}
		}//score
		for(j=0;j<30;j++)
		{//add
			scanf("%c",&stu[i].add[j]);
			if(stu[i].add[j]!='\n')
			{
				lengthofadd[i]+=1;
			}
			else
			{
				break;
			}
		}//add

	}//read
			i=numberofstudent-1;
			while(i!=0)//for(i=numberofstudent-1;i==0;i--)
			{

				for(j=0;j<lengthofnumber[i];j++)
				{
					printf("%c",stu[i].number[j]);
				}
				printf(" ");
				for(j=0;j<lengthofname[i];j++)
				{
					printf("%c",stu[i].name[j]);
				}
				printf(" ");
				printf("%c ",stu[i].gender);
				printf("%d ",stu[i].age);
				for(j=0;j<lengthofscore[i];j++)
				{
					printf("%c",stu[i].score[j]);
				}
				printf(" ");
				for(j=0;j<lengthofadd[i];j++)
				{
					printf("%c",stu[i].add[j]);
				}
				printf("\n");
				i--;
			}

			for(j=0;j<lengthofnumber[0];j++)
			{
				printf("%c",stu[0].number[j]);
			}
			printf(" ");
			for(j=0;j<lengthofname[0];j++)
			{
				printf("%c",stu[0].name[j]);
			}
			printf(" ");
			printf("%c ",stu[0].gender);
			printf("%d ",stu[0].age);
			for(j=0;j<lengthofscore[0];j++)
				{
					printf("%c",stu[0].score[j]);
				}
			printf(" ");
			for(j=0;j<lengthofadd[0];j++)
			{
				printf("%c",stu[0].add[j]);
			}
	return 0;
}


struct stu
{
	char num[20];
	char name[20];
	char s;
	int age;
	char point[10];
	char adr[50];
	struct stu *p;
};
void main()
{
	struct stu *stu1=NULL;
	int n=sizeof(struct stu);
	stu1=(struct stu *) malloc(n);
	struct stu *head=NULL,*curent=NULL;
	stu1->p=NULL;
	while(scanf("%s",stu1->num))
	{
		if((strcmp(stu1->num,"end"))==0)
			break;
		scanf("%s %c %d %s %s",stu1->name,&stu1->s,&stu1->age,&stu1->point,stu1->adr);
		stu1->p=curent;
		curent=stu1;
		stu1=(struct stu*) malloc(n);
	}
	while(curent!=NULL)
	{
		printf("%s %s %c %d %s %s\n",curent->num,curent->name,curent->s,curent->age,curent->point,curent->adr);
		curent=curent->p;
	}
}


struct student
{
       char num[20];
       char name[20];
       char ch[1];
       int ye;char gra[10];char add[20];
       struct student *next;
};
int main()
{
    struct student *p,*p1,*p2;
    int n;
    p1=p2=(struct student*) malloc(LEN);
    scanf("%s",&p1->num);
    p=NULL;n=0;
    while (p1->num[0]!='e')
    {
          scanf("%s%s%d%s%s",&p1->name,&p1->ch,&p1->ye,&p1->gra,&p1->add);
          n++;if (n==1) p2=p1;
          else p1->next=p2;
          p=p1;p2=p1;
          p1=(struct student *)malloc(LEN);
          scanf("%s",&p1->num);
    }
    if (p!=NULL)
    do
    {
      printf("%s %s %s %d %s %s\n",p->num,p->name,p->ch,p->ye,p->gra,p->add);
      p=p->next;
                }while (p!=NULL);

}


struct student
{
	char num[9];
	char name[20];
	char sex;
	int age;
	float grade;
	char address[20];
	struct student *next;
};
void main()
{
	int n=1,i;
	struct student *thisnode,*newnode,*p;
    for(i=1;;i++)
	{
		newnode=(struct student *)malloc(LEN);
		scanf("%s",newnode->num);
		if(newnode->num[0]=='e')  break;
		scanf("%s %c %d %g %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
        if(n==1)
		{
			newnode->next=NULL;
			thisnode=newnode;
		}
		else
		{
			newnode->next=thisnode;
			thisnode=newnode;
		}
		n++;

	}

    p=thisnode;
	while(p!=NULL)
	{

		printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
		p=p->next;
	}

}


struct st
{
    char id[200];
    struct st *pre;
    struct st *next;
} *p1, *p2;
int main(void)
{
    p1 = p2 = (struct st*)malloc(LEN);
    p1->pre = NULL;
    gets(p1->id);

    while(strcmp(p1->id,"end"))
    {
        p2->next=p1;
        p2=p1;
        p1=(struct st*)malloc(LEN);
        gets(p1->id);
        p1->pre=p2;
    }

    while(p2!=NULL)
    {
        printf("%s\n",p2->id);
        p2 = p2->pre;
    }

    return 0;
}


struct student
{
	char num[10];
	char qita[50];
	struct student *last;
};

void main()
{
	int l;
	struct student *end,*head,*p1,*p2;
	l=sizeof(struct student);
	end=(struct student*)malloc(l);
	head=(struct student*)malloc(l);
	scanf("%s",head->num);
	gets(head->qita);
	head->last=end;
	end->last=NULL;
	p1=head;
	p2=head;
	for(;;)
	{
		p1=(struct student*)malloc(l);
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
			break;
		gets(p1->qita);
		p1->last=p2;
		p2=p1;
	}
	while(p2->last!=NULL)
	{
		printf("%s%s\n",p2->num,p2->qita);
		p2=p2->last;
	}
}


struct student
{
	char num[30];
	char name[50];
	char sex;
	int age;
	float score;
	char addr[100];
	struct student *next;
	struct student *pre;
};
int n;
struct student *end;
struct student *creat()
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(sizeof(struct student));
	scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
	head=0;
	p1->pre=0;
	for(;strcmp(p1->num,"end")!=0;)
	{
		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		p1->pre=p2;
		scanf("%s %s %c %d %f %s",&p1->num,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->addr);
	}
	p2->next=0;
	end=p2;
	return head;
}
void backprint(struct student *head,struct student *end)
{
	struct student *p;
	p=end;
	if(n==0)
	printf("1\n");
	else
	if(end!=0)
		for(;p!=0;)
		{
			printf("%s %s %c %d %g %s",p->num,p->name,p->sex,p->age,p->score,p->addr);
			printf("\n");
			p=p->pre;
		}
}
void main()
{
	struct student *head;
	head=creat();
	backprint(head,end);
}


struct student
{
 char num[50];
 char name[20];
 char sex;
 int year;
 char score[10];
 char add[50];
 struct student *next;
};

int n;

struct student *Create()
{
 struct student *head;
 struct student *p1=NULL;
 struct student *p2=NULL;
 n = 0;
 p1 = (struct student *)malloc(LEN);
 p2 = p1;

  head = NULL;
   scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->year,p1->score,p1->add);

 int j=0;
 for(;;j++)
 {
  n += 1;

  if (n==1)
  {
   head = p1;

p2->next = NULL;
  }
  else
  {
   p2->next = p1;
  }

  p2 = p1;

  p1 = (struct student *)malloc(LEN);
  scanf("%s",p1->num);
  if(strcmp(p1->num,"end")==0)
		{
			p2->next=NULL;
			break;
		}
  scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->year,p1->score,p1->add);
 }

 p2->next = NULL;

 free(p1);
 p1 = NULL;
 return head;
}
struct student *Reverse(struct student *head)
{
 struct student *p;
 struct student *p1;
 struct student *p2;

 p1 = NULL;
 p2 = head;
 while (p2 != NULL)
 {
  p = p2->next;
  p2->next = p1;
  p1 = p2;
  p2 = p;
 }
 head = p1;
 return head;
}

void Print(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->year,p->score,p->add);
   p = p->next;
  }
  while (p != NULL);
 }
}

int main()
{
  struct student *head;
head = Create();
head = Reverse(head);
 Print(head);
	return 0;

}


struct student
{
	char a[100];
	struct student *next;
};
int n;

void main()
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student *)malloc(L);
	gets(p1->a);
	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(L);
		gets(p1->a);
	}
	p2->next=NULL;
	int i,k;
	struct student *j;
	j=head;
	for(k=n-1;k>-1;k--)
	{
		for(i=0;i<k;i++)
			j=j->next;
		puts(j->a);
		j=head;
	}
}


struct student
{
	char inf[200];
	struct student *prev;
};
struct student *creat()
{
	struct student *p1,*p2,*head;
	p1=p2=(struct student *)malloc(sizeof(struct student));
	gets(p1->inf);
	p1->prev=0;
	while(p1->inf[0]!='e')
	{
		p2=p1;
		p1=(struct student *)malloc(sizeof(struct student));
		gets(p1->inf);
		p1->prev=p2;
	}
	return(p2);
}
void print_f(struct student *head)
{
	struct student *p1;
	p1=head;
	while(p1!=0)
	{
		printf("%s\n",p1->inf);
		p1=p1->prev;
	}
}
void main()
{
	print_f(creat());
}


struct stu
{
	struct stu *next;
	char a[100];
};
void print(struct stu*p,int n)
{
	if(n>0)
	{
		printf("%s",p->a);
		printf("\n");
		print(p->next,n-1);
	}
}
int main()
{
	int n=1,i,m=100000;
	struct stu *p1,*p2;
	p1=(struct stu*)malloc(LEN);
	gets(p1->a);
		for(i=0;i<m;i++)
		{
			p2=(struct stu*)malloc(LEN);
			gets(p2->a);
			if(p2->a[0]!='e'&&p2->a[1]!='n'&&p2->a[2]!='d')
			{
				p2->next=p1;
				p1=p2;
				n+=1;
			}
			else
			{
				p2->next=p1;
				break;
			}
		}
		print(p2->next,n);
		return 0;
}


struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct student *next;
};
void main()
{
	struct student *p1,*p2;
		p1=p2=(struct student *)malloc(sizeof(struct student));
	p1->next=NULL;
	while(1)
	{
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
		{
			scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
			p1=(struct student *)malloc(sizeof(struct student));
			p1->next=p2;
			p2=p1;
		}
		else
			break;
	}
	p1=p1->next;
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
}


char a[]="end";

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

struct student *Appendnewnode()
{
	struct student *head=NULL, *newnode, *thisnode,*end;
	int i=0;
	do
	{
		newnode=(struct student *)malloc(sizeof(struct student));
		if(newnode==NULL)
		{
			printf("Memory request failed!");
			exit(-1);
		}
		scanf("%s",newnode->num);
		if(strcmp(newnode->num,a)!=0)
			scanf("%s %c %d %s %s",newnode->name,&newnode->sex,&newnode->age,&newnode->grade,newnode->address);
		if(i==0)
		{
			head=newnode;
			thisnode=head;
			newnode->last=NULL;
			if(strcmp(newnode->num,a)!=0)
				newnode->next=NULL;
			i++;
		}
		else
		{
			thisnode->next=newnode;
			newnode->last=thisnode;
			if(strcmp(newnode->num,a)!=0)
				thisnode=newnode;
		}
	}while(strcmp(newnode->num,a)!=0);
	end=thisnode;
	thisnode->next=NULL;
	return(end);
}

void main()
{
	struct student *end, *p;
	end=Appendnewnode();
	for(p=end;p->last!=NULL;p=p->last)
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
	printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->address);
}


struct student
{
       char id[400];
       struct student *pre;
};
int main()
{
    int i=1,n=0;
    struct student a[1000],*head,*p;
    do
    {
                          gets(a[i].id);
                          i++;
                          n++;
    } while(a[i-1].id[0]!='e');
    head=&a[n-1];
    for(i=n-1;i>=2;i--)
    {a[i].pre=&a[i-1];}
    a[1].pre=NULL;
    p=head;
    for(i=1;i<=n-1;i++)
    {
                     puts(p->id);
                     p=p->pre;
    }
    return 0;

}


int n;

struct student
{char string[10000];
 struct student *next;
};

struct student *create(void)
{
     struct student *tail,*p1,*p2,*head;

	 n=0;
	 p1=p2=(struct student *)malloc(Len);
	 gets(p1->string);
	 tail=NULL;

	 while(strcmp(p1->string,"end")!=0)
	 {
		 n=n+1;
		 if(n==1)
		 {
			 tail=p1;
			 p1->next=NULL;
		 }
		 else
		 {
			 p1->next=p2;
		 }

		 p2=p1;
		 p1=(struct student *)malloc(Len);
		 gets(p1->string);
	 }
	 head=p2;
	 return head;
}

void main()
{

	struct student *head,*p;
	head=create();

	p=head;

      do
        {
            puts(p->string);
            p=p->next;
        }
        while (p!=NULL);

}