import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


n = ini()
res = []
for i in range(n):
    s, p = ins().split()
    p = int(p)
    res.append((s, -p, i))
res.sort()


def solve():
    return [i + 1 for s, p, i in res]


print(*solve(), sep="\n") import sys sys sys.setrecursionlimit(10 ** 8) sys.setrecursionlimit sys setrecursionlimit 10 ** 8 10 8 ini = lambda: int(sys.stdin.readline()) ini lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline inm = lambda: map(int, sys.stdin.readline().split()) inm lambda: map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split inl = lambda: list(inm()) inl lambda: list(inm()) list(inm()) list inm() inm ins = lambda: sys.stdin.readline().rstrip() ins lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print "\033[33m" *a a "\033[0m" **dict(file=sys.stderr, **kw) dict(file=sys.stderr, **kw) dict file=sys.stderr file sys.stderr sys stderr **kw kw *a **kw n = ini() n ini() ini res = [] res [] for i in range(n):
    s, p = ins().split()
    p = int(p)
    res.append((s, -p, i)) i range(n) range n s, p = ins().split() s ins().split() ().split () ins split p p = int(p) p int(p) int p res.append((s, -p, i)) res.append res append (s, -p, i) s -p p i res.sort() res.sort res sort def solve():
    return [i + 1 for s, p, i in res] solve i + 1 for s, p, i in res for s, p, i in res s p i res for s, p, i in res i + 1 i 1 return [i + 1 for s, p, i in res] [i + 1 for s, p, i in res] print(*solve(), sep="\n") print *solve() solve() solve sep="\n" sep "\n" inl = lambda: list(inm()) lambda: list(inm()) inl debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug inm = lambda: map(int, sys.stdin.readline().split()) lambda: map(int, sys.stdin.readline().split()) inm res = [] [] res ini = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ini ins = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() ins n = ini() ini() n def solve():
    return [i + 1 for s, p, i in res] def solve():
    return [i + 1 for s, p, i in res] solve p = int(p) int(p) p p = ins().split() ins().split() p s, p = ins().split() ins().split() s
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


n = ini()
res = []
for i in range(n):
    s, p = ins().split()
    p = int(p)
    res.append((s, -p, i))
res.sort()


def solve():
    return [i + 1 for s, p, i in res]


print(*solve(), sep="\n")
