import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
guide = []
for i in range(N):
    s,p=LS()
    guide.append([s,100-int(p),i+1])
guide.sort()
for a in guide:
    print(a[2]) import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS N = I() N I() I guide = [] guide [] for i in range(N):
    s,p=LS()
    guide.append([s,100-int(p),i+1]) i range(N) range N s,p=LS() s LS() LS p guide.append([s,100-int(p),i+1]) guide.append guide append [s,100-int(p),i+1] s 100-int(p) 100 int(p) int p i+1 i 1 guide.sort() guide.sort guide sort for a in guide:
    print(a[2]) a guide print(a[2]) print a[2] a 2 def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS N = I() I() N p=LS() LS() p s,p=LS() LS() s def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI guide = [] [] guide
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
guide = []
for i in range(N):
    s,p=LS()
    guide.append([s,100-int(p),i+1])
guide.sort()
for a in guide:
    print(a[2])