Under construction

Still being built. Things may change

Planar Graph

Time limit1sMemory limit2048 MB

Summary
For each segment of a plane graph, decide whether some source point can reach its midpoint by a curve that crosses no other segment.
Level

Medium7 of 10

Topics
Geometry, Graph, Implementation
Solved
No attempts yet

Problem

There are nn base points on the plane, with some segments connecting them. Every two base points are distinct, no three base points are collinear, and segments only intersect at their endpoints. There are also mm source points on the plane. Each source point is different from all nn base points and does not lie on any segment. For each segment, determine whether you can draw a curve from some source point to the midpoint of that segment without intersecting any other segment.

Input

The first line contains three integers nn, mm, ee (1≤n,m≤1001 \le n, m \le 100; 0≤e≤3000 \le e \le 300). Each of the next nn lines contains two integers xx, yy (∣x∣,∣y∣≤109|x|, |y| \le 10^9), the coordinates of a base point. Each of the next mm lines contains two integers xx, yy (∣x∣,∣y∣≤109|x|, |y| \le 10^9), the coordinates of a source point. Each of the last ee lines contains two integers ii, jj (1≤i<j≤n1 \le i < j \le n), meaning the segment connects the ii-th and jj-th base points.

Output

Print a string of length ee. The ii-th character is "1" if some source point has a curve to the midpoint of the ii-th segment that does not intersect any other segment, and "0" otherwise.

Examples1

  1. Example 1

    Input
    4 1 3
    -2 0
    0 2
    2 0
    0 1
    0 3
    1 2
    2 3
    1 3
    
    Expected output
    111