import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.*;

public class sentinels_nn_slow {
	static class Sentinel {
		int x;
		int y;
		int dir;

		public Sentinel(int x, int y, int dir) {
			this.x = x;
			this.y = y;
			this.dir = dir;
		}

	}

	static final String DIRS = "NESW";

	static void solve() throws Exception {
		int n = nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		char[] dir = new char[n];
		for (int i = 0; i < n; i++) {
			x[i] = nextInt();
			y[i] = nextInt();
			dir[i] = next().charAt(0);
		}
		int[] ans = solve(x, y, dir);
		for (int i = 0; i < n; i++) {
			out.println(ans[i]);
		}
	}

	static int[] solve(int[] x, int[] y, char[] dir) {
		int n = x.length;
		Sentinel[] a = new Sentinel[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Sentinel(x[i], y[i], DIRS.indexOf(dir[i]));
		}
		int[] ans = new int[a.length];
		for (int i = 0; i < a.length; i++) {
			ans[i] = solve(a[i], a) - 1;
		}
		return ans;
	}

	static boolean[] COMPARE1 = { true, true, false, false };
	static boolean[] COMPARE2 = { false, true, true, false };

	static int solve(Sentinel a, Sentinel[] b) {
		int d = a.dir;
		int ret = 0;
		for (Sentinel e : b) {
			ret += ok(a.x + a.y, e.x + e.y, COMPARE1[d])
					&& ok(a.x - a.y, e.x - e.y, COMPARE2[d]) ? 1 : 0;
		}
		return ret;
	}

	static boolean ok(int a, int b, boolean comp) {
		return a == b || ((a < b) == comp);
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static void debug(Object... a) {
		System.err.println(deepToString(a));
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		try {
			File file = new File("sentinels.in");
			InputStream input = System.in;
			OutputStream output = System.out;
			if (file.canRead()) {
				input = (new FileInputStream(file));
				output = (new PrintStream("sentinels.out"));
			}
			br = new BufferedReader(new InputStreamReader(input));
			out = new PrintWriter(output);
			solve();
			out.close();
			br.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}