<PREV Problem:
NEXT>
Solved by 105 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Way among sticks

Time limit = 5 second(s)

Memory limit = 10

There are some stick on the plane. Their ends have integer coordinates. Two points A and B has integer coordinates and don't lie on a stick.

Your program should determine whether there is continuous way from A to B not crossing sticks.

Input First two line contain coordinates of point A and point B. Next line contains number of sticks N. In the next N lines coordinates of stick ends are given. Each line contains four numbers x1, y1, x2, y2, separated with space.

Output YES or NO.

Input#1
0 0
10 0
1
2 2 2 -2
Output#1
YES

Input#2
0 0
10 0
4
-4 -4 4 -4
4 -4 4 4
4 4 -4 4
-4 4 -4 -4
Output#2
NO

Author:
Voroztsov Artem
26 march 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 54.80.60.91