# https://c...content-available-to-author-only...s.com/problemset/problem/106/B
##
##
## 5 (numarul de laptop-uri)
##
#laptop 1: 2100 512 150 200
# 2: 2000 2048 240 350
# 3: 2300 1024 200 320
# 4: 2500 2048 80 300
# 5: 2000 512 180 150
##
class laptop:
def __init__(self,speed, ram, hdd, cost):
self.speed = speed
self.ram = ram
self.hdd = hdd
self.cost = cost
def solve_problem_laptop():
#citim numarul N de laptopuri din Input Standard
n = int(input())
#declaram un vector sau un array de laptop-uri, unde laptop este o clasa
vec = [ laptop ] * n
#print( vec )
for i in range( n ):
#read speed, ram, hardisk, cost
s, r, h, c = map(int, input().split())
#adaugam un vector fiecare instanta a clasei laptop
vec[ i ] = laptop( s, r, h, c )
#print(vec)
com = [ 0 ] * n
#n = numarul de laptopuri
for i in range( n ):
for j in range( n ):
if i != j:
if vec[i].speed < vec[j].speed and vec[i].ram < vec[j].ram and vec[i].hdd < vec[j].hdd:
com[ i ] = 1
break
#print(com)
maximum = int(1e12)
idx = -1
for i in range(n):
if com[i] == 0:
if maximum > vec[i].cost:
idx = i + 1
maximum = vec[i].cost
print(idx)
solve_problem_laptop()
IyBodHRwczovL2MuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLnMuY29tL3Byb2JsZW1zZXQvcHJvYmxlbS8xMDYvQgojIwojIwojIyAgIDUgKG51bWFydWwgZGUgbGFwdG9wLXVyaSkKIyMKI2xhcHRvcCAxOiAyMTAwIDUxMiAxNTAgMjAwCiMgICAgICAgMjogMjAwMCAyMDQ4IDI0MCAzNTAKIyAgICAgICAzOiAyMzAwIDEwMjQgMjAwIDMyMAojICAgICAgIDQ6IDI1MDAgMjA0OCA4MCAzMDAKIyAgICAgICA1OiAyMDAwIDUxMiAxODAgMTUwCiMjCmNsYXNzIGxhcHRvcDoKICAgIGRlZiBfX2luaXRfXyhzZWxmLHNwZWVkLCByYW0sIGhkZCwgY29zdCk6CiAgICAgICAgc2VsZi5zcGVlZCA9IHNwZWVkCiAgICAgIC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A9IGludCgxZTEyKQogICAgaWR4ID0gLTEKICAgIGZvciBpIGluIHJhbmdlKG4pOgogICAgICAgIGlmIGNvbVtpXSA9PSAwOgogICAgICAgICAgICBpZiBtYXhpbXVtID4gdmVjW2ldLmNvc3Q6CiAgICAgICAgICAgICAgICBpZHggPSBpICsgMQogICAgICAgICAgICAgICAgbWF4aW11bSA9IHZlY1tpXS5jb3N0CiAgICBwcmludChpZHgpCnNvbHZlX3Byb2JsZW1fbGFwdG9wKCk=