N = int(input())
rank = []
for i in range(N):
  name, point = input().split(" ")
  rank.append({
    "name": name,
    "point": 100 - int(point),
    "id": i + 1
  })

rank.sort(key = lambda x: (x["name"], x["point"]))
print("\n".join(list(map(lambda r: str(r["id"]), rank)))) N = int(input()) N int(input()) int input() input rank = [] rank [] for i in range(N):
  name, point = input().split(" ")
  rank.append({
    "name": name,
    "point": 100 - int(point),
    "id": i + 1
  }) i range(N) range N name, point = input().split(" ") name input().split(" ") ().split () input split " " point rank.append({
    "name": name,
    "point": 100 - int(point),
    "id": i + 1
  }) rank.append rank append {
    "name": name,
    "point": 100 - int(point),
    "id": i + 1
  } "name" "name" name "point" "point" 100 - int(point) 100 int(point) int point "id" "id" i + 1 i 1 rank.sort(key = lambda x: (x["name"], x["point"])) rank.sort rank sort key = lambda x: (x["name"], x["point"]) key lambda x: (x["name"], x["point"]) (x["name"], x["point"]) x["name"] x "name" x["point"] x "point" x print("\n".join(list(map(lambda r: str(r["id"]), rank)))) print "\n".join(list(map(lambda r: str(r["id"]), rank))) "\n".join "\n" join list(map(lambda r: str(r["id"]), rank)) list map(lambda r: str(r["id"]), rank) map lambda r: str(r["id"]) str(r["id"]) str r["id"] r "id" r rank point = input().split(" ") input().split(" ") point name, point = input().split(" ") input().split(" ") name N = int(input()) int(input()) N rank = [] [] rank
N = int(input())
rank = []
for i in range(N):
  name, point = input().split(" ")
  rank.append({
    "name": name,
    "point": 100 - int(point),
    "id": i + 1
  })

rank.sort(key = lambda x: (x["name"], x["point"]))
print("\n".join(list(map(lambda r: str(r["id"]), rank))))