N = int(input())
town = {}

for i in range(N):  # 地名をキーとした辞書に、[店番号、点数]を付加する
    place, score = input().split()
    tmp = [i+1, int(score)]
    if place in town:
        town[place].append(tmp)
    else:
        town[place] = [tmp]

index = list(town.keys())
index.sort()

for _ in index:
    tmp = town[_]
    tmp = sorted(tmp, reverse=True, key=lambda x: x[1])
    for num in tmp:
        print(num[0]) N = int(input()) N int(input()) int input() input town = {} town {} for i in range(N):  # 地名をキーとした辞書に、[店番号、点数]を付加する
    place, score = input().split()
    tmp = [i+1, int(score)]
    if place in town:
        town[place].append(tmp)
    else:
        town[place] = [tmp] i range(N) range N place, score = input().split() place input().split() ().split () input split score tmp = [i+1, int(score)] tmp [i+1, int(score)] i+1 i 1 int(score) int score if place in town:
        town[place].append(tmp)
    else:
        town[place] = [tmp] place in town place town town[place].append(tmp) [place].append [place] town place append tmp town[place] = [tmp] town[place] town place [tmp] tmp index = list(town.keys()) index list(town.keys()) list town.keys() town.keys town keys index.sort() index.sort index sort for _ in index:
    tmp = town[_]
    tmp = sorted(tmp, reverse=True, key=lambda x: x[1])
    for num in tmp:
        print(num[0]) _ index tmp = town[_] tmp town[_] town _ tmp = sorted(tmp, reverse=True, key=lambda x: x[1]) tmp sorted(tmp, reverse=True, key=lambda x: x[1]) sorted tmp reverse=True reverse True key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x for num in tmp:
        print(num[0]) num tmp print(num[0]) print num[0] num 0 N = int(input()) int(input()) N index = list(town.keys()) list(town.keys()) index tmp = [i+1, int(score)] [i+1, int(score)] tmp tmp = town[_] town[_] tmp score = input().split() input().split() score tmp = sorted(tmp, reverse=True, key=lambda x: x[1]) sorted(tmp, reverse=True, key=lambda x: x[1]) tmp place, score = input().split() input().split() place town = {} {} town
N = int(input())
town = {}

for i in range(N):  # 地名をキーとした辞書に、[店番号、点数]を付加する
    place, score = input().split()
    tmp = [i+1, int(score)]
    if place in town:
        town[place].append(tmp)
    else:
        town[place] = [tmp]

index = list(town.keys())
index.sort()

for _ in index:
    tmp = town[_]
    tmp = sorted(tmp, reverse=True, key=lambda x: x[1])
    for num in tmp:
        print(num[0])
