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

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

/*class Point {
	Scanner in = new Scanner(new File("points.in"));
	LinkedList<PointC>points = new LinkedList<PointC>();

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