n = int(input())
s = []
r = []
sr = []
for i in range(n):
    s, r = map(str, input().split())
    sr.append([i+1, s, int(r)])
# print(sr)
sr1 = sorted(sr, key=lambda x:x[2], reverse=True)

ans = sorted(sr1, key=lambda x:x[1])

for i in range(n):
    print(ans[i][0]) n = int(input()) n int(input()) int input() input s = [] s [] r = [] r [] sr = [] sr [] for i in range(n):
    s, r = map(str, input().split())
    sr.append([i+1, s, int(r)])
# print(sr) i range(n) range n s, r = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split r sr.append([i+1, s, int(r)]) sr.append sr append [i+1, s, int(r)] i+1 i 1 s int(r) int r sr1 = sorted(sr, key=lambda x:x[2], reverse=True) sr1 sorted(sr, key=lambda x:x[2], reverse=True) sorted sr key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x reverse=True reverse True ans = sorted(sr1, key=lambda x:x[1]) ans sorted(sr1, key=lambda x:x[1]) sorted sr1 key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x for i in range(n):
    print(ans[i][0]) i range(n) range n print(ans[i][0]) print ans[i][0] [i] ans i 0 r = [] [] r sr = [] [] sr n = int(input()) int(input()) n sr1 = sorted(sr, key=lambda x:x[2], reverse=True) sorted(sr, key=lambda x:x[2], reverse=True) sr1 s, r = map(str, input().split()) map(str, input().split()) s s = [] [] s r = map(str, input().split()) map(str, input().split()) r ans = sorted(sr1, key=lambda x:x[1]) sorted(sr1, key=lambda x:x[1]) ans
n = int(input())
s = []
r = []
sr = []
for i in range(n):
    s, r = map(str, input().split())
    sr.append([i+1, s, int(r)])
# print(sr)
sr1 = sorted(sr, key=lambda x:x[2], reverse=True)

ans = sorted(sr1, key=lambda x:x[1])

for i in range(n):
    print(ans[i][0])