#include
struct birth {
int year,mon,day;
};
struct contact {
struct birth b;
char name[10];
char tel[15];
};
int main(void) {
struct contact c1[20],t;
struct birth ;
int i,n,j,index;
scanf("%d",&n);
for(i=0;i
scanf("%s %d %d %d %s",c1[i].name,&c1[i].b.year,&c1[i].b.mon,&c1[i].b.day,c1[i].tel);
}
for(i=0;i
{
index=i;
for(j=i+1;j
if(c1[j].b.year
{
index=j;
}
else if(c1[j].b.year==c1[index].b.year)
{
if(c1[j].b.mon
{
index=j;
}
else if(c1[j].b.mon==c1[index].b.mon)
{
if(c1[j].b.day
{
index=j;
}
}
}
}
t=c1[index];c1[index]=c1[i];c1[i]=t;
}
for(i=0;i
printf("%s\t",c1[i].name);
printf(" %d%d%d\t",c1[i].b.year,c1[i].b.mon,c1[i].b.day);
printf("%s\n",c1[i].tel);
}
return 0;
}