The first line of the standard input contains four integers $n, m$, $A$ and $B$ $(1 \le n \le 300000$, $0 \le m \le 900000$, $1 \le A,B \le 10^9)$. They denote the number of junctions in the center of Gdynia, the number of streets and dimensions of the island, respectively.
In each of the following $n$ lines there are two integers $x_i$, $y_i$ $(0 \le x_i \le A, 0 \le y_i \le B)$ describing the coordinates of the junction number $i$. No two junctions can have the same coordinates.
The next $m$ lines describe the streets. Each street is represented in a single line by three integers $c_i, d_i, k_i (1 \le c_i,d_i \le n, c_i \ne d_i, k_i \in \{1,2\})$. Their meaning is that junctions $c_i$ and $d_i$ are connected with a street. If $k_i = 1$, then this is a unidirectional street from $c_i$ to $d_i$. Otherwise, the street can be driven in both directions. Each unordered pair $\{c_i,d_i\}$ can appear in the input at most once.
You can assume that there is at least one junction on the western side of the island from which it is possible to reach some junction on the eastern side of the island.
Additionally, in test cases worth at least 30 points, $n,m \le 6000$.
