n = int(input())
l = [list(input().split()) for i in range(n)]
s,p = [list(i) for i in zip(*l)]
p = [int(i) for i in p]
z = list(set(s))
z.sort()
m = list(p)
m.sort(reverse = True)
l = []
 
k = 0
for i in range(len(z)):
    l.append(k)
    k += 200
 
o = []
for i in range(n):
    w = l[z.index(s[i])]
    w += m.index(p[i])
    o.append(w)
 
r = list(o)
r.sort()
for i in range(n):
    print(o.index(r[i]) + 1)  n = int(input()) n int(input()) int input() input list(input().split()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(input().split()) list input().split() ().split () input split l = [list(input().split()) for i in range(n)] l [list(input().split()) for i in range(n)] list(i) for i in zip(*l) for i in zip(*l) i zip(*l) zip *l l for i in zip(*l) list(i) list i s,p = [list(i) for i in zip(*l)] s [list(i) for i in zip(*l)] p int(i) for i in p for i in p i p for i in p int(i) int i p = [int(i) for i in p] p [int(i) for i in p] z = list(set(s)) z list(set(s)) list set(s) set s z.sort() z.sort z sort m = list(p) m list(p) list p m.sort(reverse = True) m.sort m sort reverse = True reverse True l = [] l [] k = 0 k 0 for i in range(len(z)):
    l.append(k)
    k += 200
  i range(len(z)) range len(z) len z l.append(k) l.append l append k k += 200 k 200 o = [] o [] for i in range(n):
    w = l[z.index(s[i])]
    w += m.index(p[i])
    o.append(w)
  i range(n) range n w = l[z.index(s[i])] w l[z.index(s[i])] l z.index(s[i]) z.index z index s[i] s i w += m.index(p[i]) w m.index(p[i]) m.index m index p[i] p i o.append(w) o.append o append w r = list(o) r list(o) list o r.sort() r.sort r sort for i in range(n):
    print(o.index(r[i]) + 1)  i range(n) range n print(o.index(r[i]) + 1) print o.index(r[i]) + 1 o.index(r[i]) o.index o index r[i] r i 1 p = [list(i) for i in zip(*l)] [list(i) for i in zip(*l)] p z = list(set(s)) list(set(s)) z l = [] [] l l = [list(input().split()) for i in range(n)] [list(input().split()) for i in range(n)] l n = int(input()) int(input()) n p = [int(i) for i in p] [int(i) for i in p] p w += m.index(p[i]) m.index(p[i]) w m = list(p) list(p) m k += 200 200 k s,p = [list(i) for i in zip(*l)] [list(i) for i in zip(*l)] s r = list(o) list(o) r o = [] [] o k = 0 0 k w = l[z.index(s[i])] l[z.index(s[i])] w
n = int(input())
l = [list(input().split()) for i in range(n)]
s,p = [list(i) for i in zip(*l)]
p = [int(i) for i in p]
z = list(set(s))
z.sort()
m = list(p)
m.sort(reverse = True)
l = []
 
k = 0
for i in range(len(z)):
    l.append(k)
    k += 200
 
o = []
for i in range(n):
    w = l[z.index(s[i])]
    w += m.index(p[i])
    o.append(w)
 
r = list(o)
r.sort()
for i in range(n):
    print(o.index(r[i]) + 1) 