Guardians
Petya and Vasya are back to playing spies. This time, Vasya's grandmother, acting as the adversary, has captured Vasya and taken him to a secret dacha. After several days of waiting for rescue, Vasya realized that Petya knew the location of his grandmother's dacha, which didn't align with their spy game. To make the game more challenging, Vasya decided to station guards—his friends—in the forest surrounding the dacha to prevent Petya from rescuing him.
Vasya used a map of the area, set up a coordinate system with the Oy axis pointing north and the Ox axis pointing east, and marked the positions of the guards. Each guard was equipped with a powerful flashlight that illuminates a 90-degree angle in front of them. These flashlights are so strong that they can shine over any distance. However, to give Petya a fighting chance, Vasya restricted the guards to point their flashlights in only one of four directions: strictly north, west, south, or east. The bisector of the flashlight's angle aligns with the chosen direction.
To evaluate his chances of being rescued, Vasya wants to know, for each guard, how many other guards are illuminated by that guard's flashlight.
Input
The first line of the input contains an integer n (1 ≤ n ≤ 50000)—the number of guards in the forest. The following n lines provide information about each guard. The i-th line contains two integers x_i and y_i (|x_i|, |y_i| ≤ 10^9)—the coordinates of the i-th guard on Petya's map, followed by a letter indicating the direction the guard is facing: N, E, S, or W, representing north, east, south, and west, respectively. No two guards share the same location.
Output
Output n lines. The i-th line should contain a single integer—the number of guards illuminated by the i-th guard's flashlight, excluding themselves.
Explanation of examples
First example
Second example