Serious Cow Tag

No attempts yetTime limit1sMemory limit128 MB

Problem

Farmer John's $N$ cows ($1 \le N \le 1000$), numbered $1$ through $N$, are playing a game called Serious Cow Tag. Each cow stands on a distinct grid point in the pasture with integer coordinates satisfying $-7500 \le X \le 7500$ and $-7500 \le Y \le 7500$. The positions are chosen so that the distances between every pair of cows are all different.

The cows take turns in order: cow $1$ first, then cow $2$, then cow $3$, and so on. After cow $N$ the order wraps back to cow $1$ and repeats. A cow that has already been tagged is skipped and never takes a turn again.

On her turn, the active cow looks at every cow still in the game, walks to the closest one, tags her, and returns to her own spot. The tagged cow is immediately out of the game. Because all pairwise distances are distinct, the closest remaining cow is always unique.

The game continues until only one cow is left; that cow is declared the winner.

Farmer John wants to know the winner in advance. Given the cows' positions, determine which cow wins.

Input

  • The first line contains a single integer $N$, the number of cows.
  • Each of the next $N$ lines contains two space-separated integers $X$ and $Y$, the coordinates of cow $i$ (for $i$ from $1$ to $N$).

Output

  • Print a single line containing the number of the winning cow.

Hint

With three cows, cow $1$ goes first and tags her nearest neighbor, cow $2$, who is eliminated and therefore never takes a turn. Cow $3$ then tags the only other remaining cow, cow $1$. Cow $3$ is the last one standing, so she wins.