# include & ltcstdio & gt
# include & ltcstring & gt
# include & ltcmath & gt
# include & lt algorithm & gt
# include & ltcctype & gt
Use namespace std
Structural node
{
char name[30];
int num
int k; //input sequence
} s[ 1234];
Int cmp (node a, node b)
{
If (quantity = = quantity)
Return to a.k & ltb.k
Return to a.num & ltb.num
}
int main()
{
int n;
while(scanf("%d ",& ampn)! =EOF)
{
for(int I = 0; I & ltn;; i++)
{
scanf("%s %d ",s[i])。 Name & amps[i]. num);
s[i]。 k = I;
}
sort(s,s+n,CMP);
for(int I = 0; I & ltn;; i++)
printf("%s %d\n ",s[i]。 Name, s[i] num);
}
Returns 0;
}