This page is still under construction.

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

Candles

Interview

Time limit2sMemory limit1024 MB

Summary
Given n candle points inside a circle and m lines that cut the cake, decide whether some region bounded by the lines contains two or more candles.
Level

Medium5 of 10

Topics
Geometry, Hash map, Sorting, Implementation
Solved
No attempts yet

Problem

Misha has turned nn years old. The birthday cake baked for the occasion is a circle of radius rr centered at the origin. There are nn candles on the cake. Misha's mother divided the cake into pieces by making mm straight cuts. Each guest took one of the resulting pieces.

Misha wants to know whether any of his guests ended up with more than one candle. Help him find out.

Input

The first line of the input file contains the integers nn, mm, and rr (1≤n≤100001\le n\le 10000, 0≤m≤10000\le m\le 1000, 1≤r≤20001\le r\le 2000).

The following nn lines contain pairs of integers x_i,y_ix\_i, y\_i, the coordinates of the points where the candles are placed. These points lie inside the circle, and the size of the candles can be ignored. No two candles coincide.

The last mm lines describe the cuts, each with three integers a_i,b_i,c_ia\_i, b\_i, c\_i. Such a triple corresponds to the cut given by the equation a_ix+b_iy+c_i=0a\_i x + b\_i y + c\_i = 0. No cut passes through a candle. No two cuts coincide. The values of a_i,b_i,c_ia\_i, b\_i, c\_i do not exceed 1000010000 in absolute value.

Output

If one of the guests got more than one candle, output the word <<YES>> to the output file, otherwise output the word <<NO>>.

Examples3

  1. Example 1

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

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

    Input
    1 0 100
    0 0
    
    Expected output
    NO