import java.util.*;
import java.io.*;

class PointC implements Comparable<PointC>{
	int x;
	int y;
	public PointC(int x, int y) {
		this.x = x;
		this.y = y;
	}
	public int compareTo (PointC x2){  
		if (this.x == x2.x){			
			if (this.y < x2.y)
				return -1;
			else return 1;
			
		}else{
			if (this.x < x2.x)
				return -1;
			else {
				return 1;
			}
		}
	}
}

class Point {
	Scanner in = new Scanner(new File("points.in"));
	ArrayList<PointC>points = new ArrayList<PointC>();
	public Point() throws Exception{
		while(in.hasNextInt()){
			int x = in.nextInt();
			int y = in.nextInt();
			points.add(new PointC(x, y));	
		}
		Collections.sort(points);
		in.close();
	}
	
}
public class Sort {
	public static void main(String[] args) throws Exception{
		Point P = new Point();
		PrintWriter out = new PrintWriter("points.out");
		for(int i = 0; i < P.points.size();i++)
			out.println(P.points.get(i).x +" "+  P.points.get(i).y);
	out.close();
	}
	
	}
