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


/**
 * Created by IntelliJ IDEA.
 * User: m09aya
 * Date: 18.11.2009
 * Time: 17:15:42
 * To change this template use File | Settings | File Templates.
 */
public class Sort {
    static class Point implements Comparable<Point> {
            int abc; int ord;

            Point(int a, int o){
                abc=a; ord=o;
            }

            public int compareTo(Point p){
                if (abc<p.abc) return -1;
                if (abc>p.abc) return 1;
                if ((abc==p.abc)&(ord==p.ord)) return 0;
                if ((abc==p.abc)&(ord<p.ord)) return -1;
                if ((abc==p.abc)&(ord>p.ord)) return 1;
                return 0;
            }
        }

    public static void main ( String [] args ) throws Exception {
       ArrayList<Point> q  = new ArrayList<Point>();
        Scanner in = new Scanner(new File("points.in"));
        PrintWriter out = new PrintWriter (new File("points.out"));
        int n=0;
        while (in.hasNext()) {
            q.add( new Point(in.nextInt(),in.nextInt()) );
            n=n+1;
        }
        Collections.sort(q);
        for (int i =0; i<n; i++){
            out.print(q.get(i).abc+" ");
            out.println(q.get(i).ord);
        }  
        in.close();
        out.close();
    }
}
