#include<algorithm>
#include<cstdio>
using namespace std;
typedef struct student{
	int xuehao;
	int score;
}student;
bool com(student left,student right)
{
	if(left.score<right.score)
	{
		return true;
	}
	else if(left.score==right.score&&left.xuehao<=right.xuehao)
	{
		return true;
	}
	else 
	return false;
}
int main()
{
	int n;
	student s[101];
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&s[i].xuehao,&s[i].score);
	}
	sort(s+1,s+n+1,com);
	for(int i=1;i<=n;i++)
	{
		printf("%d %d",s[i].xuehao,s[i].score);
		printf("\n");
	}
}

好神奇,有点领悟其中怎么运算了,关键来说,还是要找对数据结构!!以及存储结构,这样才能决定其运算方式