#include <stdio.h>
#include <stdlib.h>
typedef struct bank{
int money;
int num;
char * name;
}bank;
typedef struct node{
bank val;
struct node* next;
}node;
void push(node *);
void pop(node *);
int main()
{
node head;
int i;
head.next=NULL;
for(i=0;i<10;i++) push(&head);
for(i=0;i<10;i++) pop(&head);
return 0;
}
void push(node * target)
{
node * newnode=(node *)malloc(sizeof(node));
node * temp=target->next;
int tmoney,tnum;
char * tname=(char *)malloc(sizeof(char)*100);
scanf("%s %d %d",tname,&tnum,&tmoney);
newnode->val.name=tname;
newnode->val.num=tnum;
newnode->val.money=tmoney;
target->next=newnode;
newnode->next=temp;
}
void pop(node * target)
{
node * kill=(node *)malloc(sizeof(node));
if(target==NULL) abort();
if(target->next->next==NULL)
{
printf("%s %d %d\n",target->next->val.name,target->next->val.num,target->next->val.money);
kill=target->next;
target->next=NULL;
free(kill);
}
else pop(target->next);
}