import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.deepToString;
import static java.util.Arrays.sort;

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

public class sentinels_nn {

	static class Sentinel {
		int x;
		int y;
		int ans;
		int dir;

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

	}

	static String DIRS = "NESW";
	static final int MAXN = 50000;
	static final int MAXX = 1000 * 1000 * 1000;

	static void solve() throws Exception {
		int n = nextInt();
		assert 1 <= n && n <= MAXN;
		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();
			assert -MAXX <= x[i] && x[i] <= MAXX;
			assert -MAXX <= y[i] && y[i] <= MAXX;
			String str = next();
			assert str != null && str.length() == 1 && DIRS.indexOf(str) >= 0;
			dir[i] = str.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[] all = new Sentinel[n];
		for (int i = 0; i < n; i++) {
			all[i] = new Sentinel(x[i] + y[i], -x[i] + y[i],
					DIRS.indexOf(dir[i]));
		}
		{
			int[] xC = new int[n];
			for (int i = 0; i < n; i++) {
				xC[i] = all[i].x;
			}
			xC = sortAndUnique(xC);
			for (int i = 0; i < n; i++) {
				all[i].x = binarySearch(xC, all[i].x);
			}
		}
		{
			int[] yC = new int[n];
			for (int i = 0; i < n; i++) {
				yC[i] = all[i].y;
			}
			yC = sortAndUnique(yC);
			for (int i = 0; i < n; i++) {
				all[i].y = binarySearch(yC, all[i].y);
			}
		}
		Sentinel[] s = all.clone();
		solve(s);
		flipY(all);
		solve(s);
		flipX(all);
		solve(s);
		flipY(all);
		solve(s);
		int[] ans = new int[n];
		for (int i = 0; i < n; i++) {
			ans[i] = all[i].ans;
		}
		return ans;
	}

	static void flipX(Sentinel[] s) {
		int n = s.length;
		for (Sentinel e : s) {
			e.dir = 3 - e.dir;
			e.x = n - e.x - 1;
		}
	}

	static void flipY(Sentinel[] s) {
		int n = s.length;
		for (Sentinel e : s) {
			e.dir ^= 1;
			e.y = n - e.y - 1;
		}
	}

	static class Fenwick {
		int[] a;

		public Fenwick(int n) {
			a = new int[n];
		}

		void add(int x, int y) {
			for (int i = x; i < a.length; i |= i + 1) {
				a[i] += y;
			}
		}

		int getSum(int x) {
			int ret = 0;
			for (int i = x; i >= 0; i = (i & (i + 1)) - 1) {
				ret += a[i];
			}
			return ret;
		}
	}

	static void solve(Sentinel[] s) {
		sort(s, new Comparator<Sentinel>() {
			@Override
			public int compare(Sentinel a, Sentinel b) {
				if (a.x != b.x) {
					return b.x - a.x;
				}
				return b.y - a.y;
			}
		});
		int n = s.length;
		Fenwick f = new Fenwick(n);
		for (Sentinel e : s) {
			if (e.dir == 0) {
				e.ans = f.getSum(n - e.y - 1);
			}
			f.add(n - e.y - 1, 1);
		}
	}

	static int[] sortAndUnique(int[] a) {
		sort(a);
		int cnt = 0;
		int last = Integer.MIN_VALUE;
		for (int i = 0; i < a.length; i++) {
			if (a[i] != last) {
				a[cnt++] = a[i];
			}
			last = a[i];
		}
		return copyOf(a, cnt);
	}

	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);
		}
	}
}
