import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.io.PrintWriter;
import java.io.File;

/**
 * Created by IntelliJ IDEA.
 * User: Ãëåá
 * Date: 18.11.2009
 * Time: 12:39:16
 * To change this template use File | Settings | File Templates.
 */
public class SortPairs implements Runnable {

    class Point implements Comparable<Point> {
        int x, y;

        Point(int x, int y) {
            this.x = x; this.y = y;
        }

        public int compareTo( Point p ) {
            if ( x < p.x || ( x == p.x && y < p.y ) ) return -1;
            if ( x == p.x && y == p.y ) return 0;
            return 1;
        }

        public String toString() {
            return "" + x + " " + y;
        }
    }

    final String fileName = "points";

    Scanner in;
    PrintWriter out;

    public void run() {
        try {
            long startTime = System.nanoTime();
            in = new Scanner( new File( fileName + ".in" ) );
            out = new PrintWriter( new File( fileName + ".out" ) );
            ArrayList<Point> p = new ArrayList<Point>();
            while ( in.hasNextInt() ) {
                p.add( new Point( in.nextInt(), in.nextInt() ) );
            }
            Collections.sort(p);
            for( Point pp : p ) {
                out.println(pp);
            }
            in.close();
            out.close();
            System.out.println("working time: " + 1.0 * ( System.nanoTime() - startTime ) / 1e9 );
        } catch ( Exception e ) {
            e.printStackTrace();
            System.exit( 1 );
        }
    }

    public static void main( String[] args ) {
        new Thread( new SortPairs() ).start();
    }
}
