# -*- coding: utf-8 -*-

n = int(input())

shop = []
for i in range(n):
    s, p = input().split()
    p = int(p)

    shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}]

shop_sorted = sorted(shop, key=lambda x:x['val'])

for shop in shop_sorted:
    print(shop['idx']) n = int(input()) n int(input()) int input() input shop = [] shop [] for i in range(n):
    s, p = input().split()
    p = int(p)

    shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}] i range(n) range n s, p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}] shop [{'idx': i+1, 'val':s+f'{100-p:03}'}] {'idx': i+1, 'val':s+f'{100-p:03}'} 'idx' 'idx' i+1 i 1 'val' 'val' s+f'{100-p:03}' s f'{100-p:03}' shop_sorted = sorted(shop, key=lambda x:x['val']) shop_sorted sorted(shop, key=lambda x:x['val']) sorted shop key=lambda x:x['val'] key lambda x:x['val'] x['val'] x 'val' x for shop in shop_sorted:
    print(shop['idx']) shop shop_sorted print(shop['idx']) print shop['idx'] shop 'idx' n = int(input()) int(input()) n shop = [] [] shop p = input().split() input().split() p s, p = input().split() input().split() s p = int(p) int(p) p shop_sorted = sorted(shop, key=lambda x:x['val']) sorted(shop, key=lambda x:x['val']) shop_sorted shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}] [{'idx': i+1, 'val':s+f'{100-p:03}'}] shop
# -*- coding: utf-8 -*-

n = int(input())

shop = []
for i in range(n):
    s, p = input().split()
    p = int(p)

    shop += [{'idx': i+1, 'val':s+f'{100-p:03}'}]

shop_sorted = sorted(shop, key=lambda x:x['val'])

for shop in shop_sorted:
    print(shop['idx'])
