Under construction

Still being built. Things may change

Witch Dance

Time limit5sMemory limit1024 MB

Summary
Given N unit-length brooms that rotate clockwise at equal speed around fixed endpoints, decide whether any two brooms ever collide.
Level

Hard8 of 10

Topics
Geometry, Sorting
Solved
No attempts yet

Problem

Each Halloween, the NN witches of Sweden all gather high up in the air with their brooms to perform a magical dance. The dance consists of taking one's broom and rotating it clockwise around one of the ends of the broom. Each broom is exactly 1 m1\text{ m} long, and everyone rotates at the same speed. The ii-th witch originally starts rotated ri radiansr_i\text{ radians} clockwise. 0 radians means that the broom points to the right, that is, in the positive xx-direction. All the witches are located at the same height in the air, at positions (xi,yi)(x_i, y_i) for 1≤i≤N1 \le i \le N.

This dance is very beautiful, but in recent years it has been plagued by a certain problem. Nobody had choreographed the dance properly, so some of the witches crashed into each other's brooms. As a result, their brooms broke and they fell down, forced to use their parachutes. A coalition of witches is tired of their brooms breaking, so they have produced a choreography beforehand, consisting of the original locations and rotations of the witches' brooms. Check whether the dance will cause any brooms to crash into each other.

Input

The first line contains a single integer NN (1≤N≤200 0001 \le N \le 200\,000), the number of witches. Each of the next NN lines describes one broom with three real numbers xix_i, yiy_i, and rir_i, where −109≤xi≤109-10^{9} \le x_i \le 10^{9}, −109≤yi≤109-10^{9} \le y_i \le 10^{9}, and 0≤ri<2π0 \le r_i < 2\pi. All values have at most 2020 digits after the decimal point. The coordinates are measured in meters and give the end of the broom that the broom rotates around.

The input is such that the answer does not change even if the brooms were 1+10−6 m1 + 10^{-6}\text{ m} long.

Output

Output ok if no witches will crash into each other, and crash if at least one pair of witches will crash.

Examples2

  1. Example 1

    Input
    2
    0 0 0
    0 1.5 0
    
    Expected output
    ok
    
  2. Example 2

    Input
    2
    0 0 0
    0 1.5 3.14159
    
    Expected output
    crash