Stepan is about to meet Marysia, but he is stuck on the following problem:
Given a rectangle of size a \times b with opposite corners at and . Inside the rectangle, there are points, numbered from to . Each point has coordinates (x_i, y_i). Points with coordinates are called left points, and points with coordinates are called right points. Some of the points are connected by segments, and it is possible to move along each segment from one endpoint to the other; each segment allows movement in one or both directions, depending on its type. Segments do not overlap or intersect except at endpoints.
For each left point , determine how many right points can reach it via segments.
The first line contains four integers , , , (1 \le n \le 300\,000, 0 \le m \le 900\,000, 1 \le a, b \le 10^9) — the number of points, the number of segments, and the dimensions of the rectangle, respectively.
Each of the next lines contains two integers x_i and y_i — the coordinates of the -th point. No two points share the same coordinates.
Each of the next lines describes a segment with three integers , , (1 \le x, y \le n, 1 \le k \le 2), where there is a segment between the -th and -th points. If k = 1, movement is allowed only from point to point . If k = 2, the segment is bidirectional.
For each left point, output the number of right points that can reach it via segments. Output the answers for left points in descending order of their -coordinates.
Example 1