This page is still under construction.

Parts of this page are still being built. What you see may change.

Cosmic Pursuit

Time limit1sMemory limit512 MB

Summary
You order integer-time shots so each pursuer is destroyed before it reaches your ship.
Level

Medium6 of 10

Topics
Greedy, Sorting, Math
Solved
No attempts yet

Problem

Bajtoks, a galactic troublemaker, is in hot water again. Right now he is fleeing in his spaceship from a squad of Bitoks.

Luckily he is not alone. On board with him are Bajtinoks, the laser cannon gunner, and you, the programmer running the ship's computer. The Bitoks are a rather primitive species with no long range weapons, so they simply try to catch up to Bajtoks's ship. Bajtinoks is a crack shot and never misses, but he does not know in which order to fire at the enemies. That is exactly your job.

Write a program that computes the order in which Bajtinoks should fire so that the crew shoots down every pursuer and escapes.

Input

The first line contains one integer nn (1≤n≤1061 \le n \le 10^6), the number of enemy ships. The second line contains two integers a0a_0 and v0v_0 (−109≤a0≤109-10^9 \le a_0 \le 10^9, 1≤v0≤1061 \le v_0 \le 10^6), separated by a single space, the initial position and speed of Bajtoks's ship.

Each of the next nn lines describes one enemy ship with two integers aia_i and viv_i (−109≤ai≤109-10^9 \le a_i \le 10^9, 1≤vi≤1061 \le v_i \le 10^6), separated by a single space, the initial position and speed of the ii-th enemy ship. All positions are in bytemeters and all speeds in bytemeters per bytesecond. Every ship moves along the same straight line in the same direction.

Between any two shots at least one bytesecond must pass so that Bajtinoks can reload the cannon. During that second every ship moves by its own speed viv_i. If during this movement any enemy ship reaches the same position as Bajtoks, the hero loses. The only exception: if exactly one enemy ship reaches that position and it does so precisely at the instant the reload finishes (an integer time), that enemy can still be shot down.

At the start of the chase Bajtinoks is already ready to fire, so no reload is needed before the first shot. Shots therefore happen at times 0,1,2,…0, 1, 2, \dots

Initially Bajtoks's ship is ahead of all the others (that is, ai<a0a_i < a_0 for every i≥1i \ge 1). Ships pass one another without any trouble. Bajtinoks can hit any enemy, the laser's travel time is negligible, and a single hit destroys any ship.

Output

If Bajtoks's crew can shoot down every pursuer, print the firing order on a single line: a permutation of the integers 11 through nn, where the kk-th number is the index of the enemy destroyed by the kk-th shot. If several firing orders let Bajtoks escape, print the lexicographically smallest one.

If escape is impossible and the crew is doomed, print GAME OVER on a single line.

Notes

In the example, enemy 22 reaches Bajtoks at time 11, so it must be shot no later than time 11, while enemies 11 and 33 arrive much later. Among all winning orders the lexicographically smallest is 1 2 3. Firing in this order, enemy 22 is destroyed exactly at time 11, the instant the reload finishes (it is the only enemy at Bajtoks's position at that moment), so the crew survives that close call.

Examples3

  1. Example 1

    Input
    3
    5 1
    0 2
    3 3
    -2 3
    
    Expected output
    1 2 3
    
  2. Example 2

    Input
    3
    10 1
    5 3
    9 1000000
    4 3
    
    Expected output
    2 1 3
    
  3. Example 3

    Input
    2
    5 1
    4 1000000
    3 1000000
    
    Expected output
    GAME OVER