ACM Underground

No attempts yetTime limit1sMemory limit128 MB

Statement

ACM is a town with a special underground metro system built from railway segments; each segment is called a line. Every line runs trains in both directions. Two lines may intersect, and at an intersection point a passenger can switch from a train on one line to a train on the other.

The source and destination of your trip both lie somewhere on the metro lines. You board on the line that the source lies on, you may change lines only at intersection points between two lines, and you keep going until you reach the destination. Your goal is to make the whole trip free of charge, that is, without ever buying a ticket.

The obstacle is a group of policemen who check tickets, and you must never let one check yours. You can be checked in exactly two situations:

  • At an intersection, but only if you actually change lines there. A policeman standing on an intersection checks you only when you switch lines at that point; if you merely pass through it while staying on the same line, he ignores you.
  • While riding along a line, if you pass the exact spot of a policeman who stands on that line but not on an intersection. Such a policeman checks everyone who rides past his spot.

Policemen who are not on any metro line are irrelevant and must be ignored. You know every policeman's position in advance.

For example, in the figure above there are five metro lines and three policemen (the black circles). You can travel from $s$ to $d$ along lines $l_1 \rightarrow l_4$ without meeting any policeman, but there is no way to travel from $s$ to $d'$ without being checked.

Write a program that reads the metro lines, the policemen, and the source and destination, and decides whether it is possible to travel from the source to the destination without being checked by any policeman.

Input

The first line contains an integer $T$, the number of test cases. Each test case has the following form:

  • One line with two integers $n$ and $m$ ($1 \le m \le 100$, $1 \le n \le 3000$): the number of metro lines and the number of policemen.
  • One line with four integers $x_s\ y_s\ x_d\ y_d$: the coordinates of the source $(x_s, y_s)$ and the destination $(x_d, y_d)$. Both points are guaranteed to lie on metro lines.
  • $n$ lines, each with four integers $x_1\ y_1\ x_2\ y_2$, giving the two endpoints $(x_1, y_1)$ and $(x_2, y_2)$ of one metro line.
  • $m$ lines, each with two integers $x\ y$, giving the position of one policeman.

All coordinates are arbitrary integers.

Output

Print $T$ lines, one per test case in the same order as the input. For each test case print a single word: YES if there is a safe way to travel from the source to the destination without being checked, or NO otherwise.