#include <stdio.h>
#include <math.h>
#include <string.h>

typedef struct Num
{
    int a;
    int b;
}num;

int main(void){
	int n;
	scanf("%d", &n);
    num arr[n];
	
	for(int f=0; f<n; f++)
	{
	    scanf("%d %d", &arr[f].a, &arr[f].b);
	}
	
	for(int i=0; i<n-1; i++) //바퀴 반복
    {
        for(int j=0; j<n-1-i; j++) //비교활동 반복
        {
            if(arr[j].a > arr[j+1].a)
            {
                int t; // 임시 저장
                int m; // b 임시저장
                t=arr[j].a;
                m = arr[j].b;
                arr[j].a = arr[j+1].a;
                arr[j].b = arr[j+1].b;
                arr[j+1].a = t;
                arr[j+1].b = m;
            }
        }
    }

    for(int i=0; i<n; i++)
    {
        printf("%d %d\n",arr[i].a, arr[i].b);
    }
	
}





Embed on website

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