#include <stdio.h>
#include <stdlib.h>

typedef struct point
{
int x;
int y;
} Point;

int compare(const void *a,const void *b) {
    const Point *A =(const Point *)a;
    const Point *B = (const Point *)b;
    if (A->x==B->x) {
        return A->y-B->y;
    }
    return A->x-B->x;
}


Point num[100000];

int main() {
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++) {
        scanf("%d %d",&num[i].x, &num[i].y);
    }
    qsort(num,n,sizeof(Point),compare);
    for(int i=0;i<n; i++) {
        printf("%d %d\n",num[i].x, num[i].y);
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: