Codeforces Beta Round 82 (Div. 2)
B
Choosing Laptop
Codeforces
1000
原题
← AC →
翻译中…

Vasya is choosing a laptop. The shop has $*n*$ laptops to all tastes.

翻译中…

Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in all other properties.

翻译中…

If all three properties of a laptop are strictly less than those properties of some other laptop, then the first laptop is considered outdated by Vasya. Among all laptops Vasya does not consider outdated, he chooses the cheapest one.

翻译中…

There are very many laptops, which is why Vasya decided to write a program that chooses the suitable laptop. However, Vasya doesn't have his own laptop yet and he asks you to help him.

翻译中…

Input

翻译中…

The first line contains number $*n*$ ($1 ≤ *n* ≤ 100$).

翻译中…

Then follow $*n*$ lines. Each describes a laptop as $*speed*$ $*ram*$ $*hdd*$ $*cost*$. Besides,

翻译中…
  • $*speed*$, $*ram*$, $*hdd*$ and $*cost*$ are integers
  • $1000 ≤ *speed* ≤ 4200$ is the processor's speed in megahertz
  • $256 ≤ *ram* ≤ 4096$ the RAM volume in megabytes
  • $1 ≤ *hdd* ≤ 500$ is the HDD in gigabytes
  • $100 ≤ *cost* ≤ 1000$ is price in tugriks
翻译中…

All laptops have different prices.

翻译中…

Output

翻译中…

Print a single number — the number of a laptop Vasya will choose. The laptops are numbered with positive integers from $1$ to $*n*$ in the order in which they are given in the input data.

翻译中…

Note

翻译中…

In the third sample Vasya considers the first and fifth laptops outdated as all of their properties cannot match those of the third laptop. The fourth one is the cheapest among the laptops that are left. Thus, Vasya chooses the fourth laptop.

翻译中…

样例

Input #1
5
2100 512 150 200
2000 2048 240 350
2300 1024 200 320
2500 2048 80 300
2000 512 180 150
Output #1
4
InputCopy OutputCopy
题目信息
题号
106B
时间限制
2 s
内存限制
256 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。