Two Dots

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

"Only 1% can solve this problem!!!"

One day, Yunee saw an advertisement for the game named "Two Dots". The goal of this game was to connect all pairs of points with the same colors.

The rules are as follows. The game area is a square of size L×LL\times L. NN points are on the square, some completely inside and others on the boundary. They are divided into N/2N/2 pairs by their colors. You can connect a pair of points by drawing a curved line connecting them. The lines must lie completely inside the square and never cross each other.

Yunee found that the problem in the advertisement could never be solved. Mad at this, Yunee is going to report this ad as a false advertisement by proving that the problem cannot be solved. If the problem can't be solved, then only 0% can solve this problem!!!

Help Yunee write a program to determine whether it is possible to solve a given problem.

입력

The first line contains an integer LL (1L100,000)(1\leq L \leq 100,000) and an even integer NN (2Nmin\[300,000,(L+1)2])(2\leq N\leq \min\[300,000, (L+1)^2]). LL is the side length of the game area and NN is the number of points. The four vertices of the game area are (0,0),(L,0),(L,L)(0, 0), (L, 0), (L, L) and (0,L)(0, L).

The next NN lines describe the points. The ii-th line contains the coordinate x,yx, y and the color cc of the ii-th point (0x,yL,1cN/2)(0 \leq x, y \leq L, 1 \leq c \leq N/2). The coordinates of the NN points are distinct. There are exactly two points with each color c=1,,N/2c=1,\cdots,N/2.

출력

Output 1% if it is possible to solve the problem, and 0% otherwise.