#include<iostream> #include<algorithm> #include<string.h> #include<stdio.h> using namespace std; struct node{ int t1; int t2; }a[100]; int cmp(struct node a,struct node b) { if(a.t1>b.t1)//从小到大排序 return 0; else if(a.t1==b.t1) { if(a.t2>b.t2) return 0; else return 1; } else return 1; } int main() { int n,i,j; while(scanf("%d",&n)!=EOF) { for(i=0;i<n;i++) scanf("%d%d",&a[i].t1,&a[i].t2); sort(a,a+n,cmp); for(i=0;i<n;i++) printf("%d %d\n",a[i].t1,a[i].t2); } return 0; }