#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define mod 100100
using namespace std;
struct node
{
int x, y;
bool operator < (const node &a) const///重载运算
{
return x>a.x;//最小值优先
}
}ls;
int main()
{
int n;
while(~scanf("%d",&n))
{
int i;
priority_queue<node> q;
for(i = 0; i < n; i++)
{
scanf("%d %d",&ls.x,&ls.y);
q.push(ls);
}
while(!q.empty())
{
ls = q.top();
q.pop();
printf("%d %d\n",ls.x,ls.y);
}
}
return 0;
}
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#define mod 100100
using namespace std;
struct node
{
int x, y;
bool operator < (const node &a) const///重载运算
{
return x>a.x;//最小值优先
}
}ls;
int main()
{
int n;
while(~scanf("%d",&n))
{
int i;
priority_queue<node> q;
for(i = 0; i < n; i++)
{
scanf("%d %d",&ls.x,&ls.y);
q.push(ls);
}
while(!q.empty())
{
ls = q.top();
q.pop();
printf("%d %d\n",ls.x,ls.y);
}
}
return 0;
}