n = int(input())
table = []
start = 0
end = 0

# [(길이, 시작, 번호)]
# [(2, 3, 2), (1, 2, 4), (8, 7, 3)]

for n in range(1, n+1):
    start, end = map(int, input().split())
    # start = int(start)
    # end = int(end)
    lent = abs(start-end)
    table.append((lent, start, n))

table.sort()

for i in table:
    print(i[2])
    

Embed on website

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