Trokut
Time limit1sMemory limit1024 MB
Players alternately add non-crossing segments between points of a regular N-gon, and whoever closes a triangle first wins. Report the winner for each N.
- Level
Medium6 of 10
- Topics
- Game theory, Math
- Solved
- No attempts yet
Problem
Ivan and Lucija are on a journey to a place far, far away. The journey will last a long time, and at some point they will be bored. Lucija came up with a game to pass the time.
She drew points on paper so that they form the vertices of a regular -gon, labeled from 1 to in order. On each turn, the player selects two of the drawn points so that the segment connecting them does not intersect any previously drawn segment. Segments are allowed to touch at vertices. After a move, a player wins if three drawn segments form a triangle, that is, there are three points that are each connected to the other two by drawn segments. Adjacent vertices may be connected, and those segments count toward triangles. Players take turns, and Lucija moves first.
Both players are extremely skilled and play optimally. For a given , determine the winner. It can be shown that the game always ends after a finite number of moves and that there is always a winner.
Input
The first line contains an integer (), the number of scenarios. Each of the next lines contains an integer (), the number of points Lucija drew.
Output
For each scenario, in the given order, print "Ivan" or "Lucija" on its own line, the winner of that scenario.