# リストに格納する
l = []
lk = []
lv = []
n = int(input())
for _ in range(n):
    s, p = input().split()
    l.append(f"{s} {p}")
    lk.append(s)
    lv.append(int(p))


# リストを辞書に変換する
d = {}
for i in range(n):
    s, p = lk[i], lv[i]
    if s in d:
        d[s].append(p)
    else:
        d[s] = []
        d[s].append(p)


# 辞書をソートする・答えを出力する
d = dict(sorted(d.items()))
for k, v in d.items():
    d[k] = sorted(v, reverse=True)
    for i in d[k]:
        print(l.index(f"{k} {i}") + 1) l = [] l [] lk = [] lk [] lv = [] lv [] n = int(input()) n int(input()) int input() input for _ in range(n):
    s, p = input().split()
    l.append(f"{s} {p}")
    lk.append(s)
    lv.append(int(p))


# リストを辞書に変換する _ range(n) range n s, p = input().split() s input().split() ().split () input split p l.append(f"{s} {p}") l.append l append f"{s} {p}" lk.append(s) lk.append lk append s lv.append(int(p)) lv.append lv append int(p) int p d = {} d {} for i in range(n):
    s, p = lk[i], lv[i]
    if s in d:
        d[s].append(p)
    else:
        d[s] = []
        d[s].append(p)


# 辞書をソートする・答えを出力する i range(n) range n s, p = lk[i], lv[i] s lk[i] lk i p lv[i] lv i if s in d:
        d[s].append(p)
    else:
        d[s] = []
        d[s].append(p)


# 辞書をソートする・答えを出力する s in d s d d[s].append(p) [s].append [s] d s append p d[s] = [] d[s] d s [] d[s].append(p) [s].append [s] d s append p d = dict(sorted(d.items())) d dict(sorted(d.items())) dict sorted(d.items()) sorted d.items() d.items d items for k, v in d.items():
    d[k] = sorted(v, reverse=True)
    for i in d[k]:
        print(l.index(f"{k} {i}") + 1) k v d.items() d.items d items d[k] = sorted(v, reverse=True) d[k] d k sorted(v, reverse=True) sorted v reverse=True reverse True for i in d[k]:
        print(l.index(f"{k} {i}") + 1) i d[k] d k print(l.index(f"{k} {i}") + 1) print l.index(f"{k} {i}") + 1 l.index(f"{k} {i}") l.index l index f"{k} {i}" 1 lk = [] [] lk d = {} {} d d = dict(sorted(d.items())) dict(sorted(d.items())) d p = lk[i], lv[i] lv[i] p s, p = input().split() input().split() s l = [] [] l n = int(input()) int(input()) n p = input().split() input().split() p lv = [] [] lv s, p = lk[i], lv[i] lk[i] s
# リストに格納する
l = []
lk = []
lv = []
n = int(input())
for _ in range(n):
    s, p = input().split()
    l.append(f"{s} {p}")
    lk.append(s)
    lv.append(int(p))


# リストを辞書に変換する
d = {}
for i in range(n):
    s, p = lk[i], lv[i]
    if s in d:
        d[s].append(p)
    else:
        d[s] = []
        d[s].append(p)


# 辞書をソートする・答えを出力する
d = dict(sorted(d.items()))
for k, v in d.items():
    d[k] = sorted(v, reverse=True)
    for i in d[k]:
        print(l.index(f"{k} {i}") + 1)