#include <iostream>
#include <queue>
#include <cstdio>
using namespace std;
struct node
{
int x, y;
friend bool operator < (node a, node b)
{
return a.x < b.x; //x大的优先
}
};
int main()
{
priority_queue<node>q;
struct node t[5];
for (int i = 0 ; i < 5 ; i ++)
{
scanf("%d %d",&t[i].x, &t[i].y);
q.push(t[i]);
}
while(!q.empty())
{
struct node s = q.top();
q.pop();
printf("%d %d\n",s.x, s.y);
}
}