In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or vice versa takes exactly 20 000 kilometers.

Limak, a polar bear, lives on the North Pole. Close to the New Year, he helps somebody with delivering packages all around the world. Instead of coordinates of places to visit, Limak got a description how he should move, assuming that he starts from the North Pole. The description consists of n parts. In the i-th part of his journey, Limak should move ti kilometers in the direction represented by a string diri that is one of: "North", "South", "West", "East".

Limak isn’t sure whether the description is valid. You must help him to check the following conditions:

  * If at any moment of time (before any of the instructions or while performing one of them) Limak is on the North Pole, he can move only to the South. 
  * If at any moment of time (before any of the instructions or while performing one of them) Limak is on the South Pole, he can move only to the North. 
  * The journey must end on the North Pole. 



Check if the above conditions are satisfied and print "YES" or "NO" on a single line.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 50).

The i-th of next n lines contains an integer ti and a string diri (1 ≤ ti ≤ 106, <image>) — the length and the direction of the i-th part of the journey, according to the description Limak got.

Output

Print "YES" if the description satisfies the three conditions, otherwise print "NO", both without the quotes.

Examples

Input

5
7500 South
10000 East
3500 North
4444 West
4000 North


Output

YES


Input

2
15000 South
4000 East


Output

NO


Input

5
20000 South
1000 North
1000000 West
9000 North
10000 North


Output

YES


Input

3
20000 South
10 East
20000 North


Output

NO


Input

2
1000 North
1000 South


Output

NO


Input

4
50 South
50 North
15000 South
15000 North


Output

YES

Note

Drawings below show how Limak's journey would look like in first two samples. In the second sample the answer is "NO" because he doesn't end on the North Pole.

<image>
//Author: Mo Abjal, MJP Rohilkhand University Bareilly, UP, India 2018.
///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////********************//////////////////////////////////////////////
/////////////////////////////////////////*     S0LUT10N     *//////////////////////////////////////////////
/////////////////////////////////////////********************//////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////

//mahnazanwar
//mahnaz1641
// 743545
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
public class Main{
	public static StringTokenizer token = new StringTokenizer("");
	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	public static PrintWriter output = new PrintWriter(System.out);
	public static void main(String[] afzal) throws Exception {		
		int N = ni();
		long sum=0;
		boolean ans=true;
		for(int i=0;i<N;i++){
			int dist = pi(ns()); 
			String dir = ns();
			if(sum==0){
				if(!dir.equals("South")) ans = false;
			}
			if(sum==20000){
				if(!dir.equals("North")) ans = false;
			}
			if(dir.equals("South")){
				sum+=dist;
			}
			if(dir.equals("North")){
				sum-=dist;
			}
			if(sum<0 || sum>20000) ans=false;
		}
		if(sum!=0) ans=false; //output.println(sum);
		if(ans) output.println("YES"); else output.println("NO"); output.close();
	}
	public static String pc(char c){
		return Character.toString(c);
	} 
	public static Integer pci(char c){
		return pi(Character.toString(c));
	}
	public static Integer pi(String str){
		return Integer.parseInt(str);
	}
	public static Long pl(String str){
		return Long.parseLong(str);
	}
	public static String ps(Integer N){
		return Integer.toString(N);
	}
	public static char[] pcc(String str){
		return str.toCharArray();
	}
	public static Integer ni() throws IOException{
		if(!token.hasMoreElements()){
			token = new StringTokenizer(br.readLine());
		}
		return Integer.parseInt(token.nextToken());
	}
	public static Long nl() throws IOException{
		if(!token.hasMoreElements()){
			token = new StringTokenizer(br.readLine());
		}
		return Long.parseLong(token.nextToken());
	}
	public static Double nd() throws IOException{
		if(!token.hasMoreElements()){
			token = new StringTokenizer(br.readLine());
		}
		return Double.parseDouble(token.nextToken());
	}
	public static String ns() throws IOException{
		if(!token.hasMoreElements()){
			token = new StringTokenizer(br.readLine());
		}
		return token.nextToken();
	}
	public static Integer[] ai(int N) throws IOException{
		Integer A[] = new Integer[N];
		token = new StringTokenizer(br.readLine());
		for(int i=0;i<A.length;i++){
			A[i] = pi(token.nextToken());
		}
		return A;
	}
	public static long[] al(int N) throws IOException{
		long A[] = new long[N];
		token = new StringTokenizer(br.readLine());
		for(int i=0;i<N;i++){
			A[i] = Long.parseLong(token.nextToken());
		}
		return A;
	}
	public static char[][] acc(int N,int M) throws IOException{
		char C[][] = new char[N][M];
		for(int i=0;i<N;i++){
			token = new StringTokenizer(br.readLine());
			String s = token.nextToken();
			for(int j=0;j<M;j++){
				C[i][j] = s.charAt(j);
			}
		}
		return C;
	}
	public static String[] as(int N) throws IOException{
		String S[] = new String[N];
		token = new StringTokenizer(br.readLine());
		for(int i=0;i<S.length;i++){
			S[i] = token.nextToken();
		}
		return S;
	}
	public static double ncr(int n, int r){
		if(n==r) return 1;
		else
		return (fact(n)/(fact(r)*fact(n-r)));
	}
	public static long fact(long N){
		long fact = 1;
		for(int i=1;i<=N;i++){
			fact = fact * i;
		}
		return fact;
	}
	public static BigInteger factB(int N){
		BigInteger b = new BigInteger("1");
		for(int i=1;i<=N;i++){
			b = b.multiply(BigInteger.valueOf(i));
		}
		return b;
	}
	public static long sod(long N){
		long sum = 0;
		while(N>0){
			long x = N%10;
			sum = sum + x;
			N = N/10;
		}
		return sum;
	}
	public static Integer cd(long N){
		int count=0;
		while(N>0){
			N = N/10; count++;
		}
		return count=0;
	}
}
class Pair implements Comparable{
	int a,b;
	public Pair(int a,int b){
		this.a = a;
		this.b = b;
	}
	public int compareTo(Object p){
		Pair pa = (Pair)p;
		//if(this.a==pa.a) return this.b - pa.b;
		return this.a - pa.a;
	} 
}class Pair3 implements Comparable{
	int a,b,c;
	public Pair3(int a,int b,int c){
		this.a = a;
		this.b = b;
		this.c = c;
	}
	public int compareTo(Object p){
		Pair pa = (Pair)p;
		//if(this.a==pa.a) return this.b - pa.b;
		return this.a - pa.a;
	} 
}
//Copyright Reserved - Mo Abjal.
