{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eACM is a town with a very special underground metro system which consists of a set of railway segments, each is called a line. There are trains in both directions of each line. Two lines may intersect which allows a passenger to switch from one train in the first line to another train in the second line on that intersection. The source and destination of your travel lie somewhere on the metro lines. You start using the metro line where the source is located on and may change your line only at the intersection points between two metro lines, and continue until your reach the destination. Your goal is to make your travel free of charge; i.e., without the need to buy any tickets. The problem is that there are a number of policemen who check your tickets. Obviously, you do not want to confront with any of these policemen during your travel. You may confront policemen in two situations: either on an intersection, but only when you are changing your line, or when you are traveling along a line in which a policeman indiscriminately asks for everyone\u0027s tickets that are inside that wagon, including you. You know the locations of all policemen in advance. Note that if a police is located on an intersection, he asks for your ticket only if you want to change your line on that intersection, and if a police is located on a line (but not on an intersection), he will ask for your ticket if you are passing that location. In your map, there are some policemen in other locations, not on any metro lines, which you must ignore. \u003c/p\u003e\u003cp\u003eFor example, in the following figure, there are five metro lines, with three policemen located at black circles. You may travel from \u003ci\u003es\u003c/i\u003e to \u003ci\u003ed\u003c/i\u003e without meeting any police along the path \u003ci\u003el\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e -- \u003ci\u003el\u003c/i\u003e\u003csub\u003e4\u003c/sub\u003e, but it is not possible to travel from \u003ci\u003es\u003c/i\u003e to \u003ci\u003ed\u0027\u003c/i\u003e without confronting any policemen.\u003c/p\u003e\u003cp\u003e\u003c/p\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/6320dbb586a73b1fb9adec5204db8598?v\u003d1675016057\"\u003e\u003c/center\u003e\u003cp\u003e\u003c/p\u003e\u003cp\u003eIn this problem, you must write a program that reads the metro line specifications, the police locations, and your source and destination, and determine whether it is possible to travel from the given source to the given destination without meeting any policeman.\u003c/p\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first number in the input line, \u003ci\u003eT\u003c/i\u003e is the number of test cases. The first line of each test case contains two integers \u003ci\u003en\u003c/i\u003e and \u003ci\u003em\u003c/i\u003e (1 ≤ \u003ci\u003em\u003c/i\u003e ≤ 100, 1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 3000) which are the number of lines and the number of policemen. The second line contains four integers \u003ci\u003ex\u003csub\u003es\u003c/sub\u003e\u003c/i\u003e \u003ci\u003ey\u003csub\u003es\u003c/sub\u003e\u003c/i\u003e \u003ci\u003ex\u003csub\u003ed\u003c/sub\u003e\u003c/i\u003e \u003ci\u003ey\u003csub\u003ed\u003c/sub\u003e\u003c/i\u003e which are the coordinates of the source and the destination points respectively. You may assume these two points lie on metro lines. Following the second line, there are \u003ci\u003en\u003c/i\u003e lines of the form \u003ci\u003ex\u003csub\u003e1\u003c/sub\u003e\u003c/i\u003e \u003ci\u003ey\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e \u003ci\u003ex\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e \u003ci\u003ey\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e describing the metro lines where (\u003ci\u003ex\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e, \u003ci\u003ey\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e) and (\u003ci\u003ex\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e, \u003ci\u003ey\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e) specify the endpoints of the metro line. After this, there are \u003ci\u003em\u003c/i\u003e lines each containing a pair of integers \u003ci\u003ex\u003c/i\u003e \u003ci\u003ey\u003c/i\u003e that specify the location of a policeman. All coordinates are arbitrary integer numbers.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe output contains \u003ci\u003eT\u003c/i\u003e lines, each corresponding to an input test case in that order. The output line contains a single word YES or NO depending on whether there is a safe way to travel from source to destination or not.\u003c/p\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n4 2\r\n3 2 5 8\r\n3 2 3 6\r\n8 1 5 8\r\n7 7 2 2\r\n9 2 1 6\r\n3 4\r\n6 6\r\n3 2\r\n2 3 6 3\r\n1 3 7 3\r\n3 2 3 6\r\n1 5 7 2\r\n3 4\r\n4 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\r\nNO\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}