#include<stdio.h>
#include<malloc.h>
typedef struct Polynode
{
int coef;
int exf;
struct Polynode *next;}*Polylist;
void Init(Polylist *l)
{
*l=(Polylist)malloc(sizeof(Polynode));
(*l)->next=NULL;}
void Creat(Polylist l)
{
Polynode *r,*s;
r=l;
int c,e;
scanf("%d%d",&c,&e);
while(c!=0)
{
s=(Polynode*)malloc(sizeof(Polynode));
s->coef=c;s->exf=e;
s->next=r;
r=s;
scanf("%d%d",&c,&e);}
r->next=NULL;
}
void Printf(Polylist l)
{
Polynode *p=l->next;
while(p!=NULL)
{
printf("%d %d\n",p->coef,p->exf);
p=p->next;}
}
int main()
{
Polylist l;
Init(&l);
Creat(l);
Printf(l);
return 0;
}