public static void main(String[] args) {
		PolarAngles dpFib = new PolarAngles();
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Point[] p = new Point[N];
		PolarAngles s = new PolarAngles();
		for (int i= 0;i < N; i++) {
			p[i] = s.new Point(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(p, s.new PolarAngle());
		for (int i = 0; i < N; i++) {
			System.out.println(p[i].toString());
		}
	}