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>
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class ggg{
	
		private static InputStream stream;
		private static byte[] buf = new byte[1024];
		private static int curChar;
		private static int numChars;
		private static SpaceCharFilter filter;
		private static PrintWriter pw;
		private static long max=Long.MIN_VALUE;
		private static int mod=1000000000+7;
		private static int pa[][];
		private static long cnt=0;
		//private static HashMap<Integer,Long> map=new HashMap<Integer,Long>();
		//private static int[] lazy;
		//private static int cnt=0;
		private static int[] arr1;
		private static int[] arr;
		private static int k;
		private static String s="0123";
		private static LinkedList<Integer>[] l; 
		private static void soln(){
			int n=nextInt();
			int x1=0;
			int x2=0;
			while(n-->0){
				String[] s=nextLine().split(" ");
				int x=Integer.parseInt(s[0]);
				if(s[1].charAt(0)=='S'){
					if(x1==20000 || (x+x1)>20000){
						System.out.println("NO");
						System.exit(0);
					}
					x1+=x;
				}
				if(s[1].charAt(0)=='N'){
					if(x1==0 || x>x1){
						System.out.print("NO");
						System.exit(0);
					}
					x1-=x;
				}
				if(s[1].charAt(0)=='E'){
					if(x1==0 || x1==20000){
						System.out.println("NO");
						System.exit(0);
					}
					x2+=x;
				}
				if(s[1].charAt(0)=='W'){
					if(x1==0 || x1==20000){
						System.out.println("NO");
						System.exit(0);
					}
					x2-=x;
				}
				//System.out.println(x1);
			}
			if(x1==0)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		private static void solution(int[] arr){
			int n=arr.length;
			int[] l=new int[n];
			int[] r=new int[n];
			l[0]=0;
			Stack<Integer> s=new Stack();
			s.push(0);
			for(int i=1;i<n;i++){
				int h=arr[i];
				while(!s.isEmpty() && arr[s.peek()]<h){
					s.pop();
				}
				if(s.isEmpty())
					l[i]=0;
				else
					l[i]=s.peek();
				s.push(i);
			}
			s.clear();
			r[n-1]=n-1;
			s.push(n-1);
			for(int i=n-2;i>=0;i--){
				int h=arr[i];
				while(!s.isEmpty() && arr[s.peek()]<h)
					s.pop();
				if(s.isEmpty())
					r[i]=n-1;
				else
					r[i]=s.peek();
				s.push(i);
			}
			int max=-1;
			int ind=-1;
			for(int i=0;i<n;i++){
				long x=r[i]-l[i];
				int ans=(int) ((((x*x)%mod)*((long)i+1))%mod);
				//pw.println(arr[l[i]]+" "+arr[r[i]]+" "+(i+1)+" "+ans);
				if(max<ans){
					max=ans;
					ind=i+1;
				}
			}
			pw.println(ind);
		}
		private static int count(int a){
			int cnt=0;
			while(a!=0){
				cnt+=a%2;
				a=a/2;
			}
			return cnt;
		}
		private static void dfs1(int cur,int prev){
			int xor=0;
			Iterator<Integer> i=l[cur].listIterator();
			while(i.hasNext()){
				int j=i.next();
				if(j!=prev){
					xor^=arr[j];
					dfs1(j,cur);
				}
			}
			cnt+=count(xor);
			if(cur==k-1)
				cnt+=(xor^arr[k-1]);
		}
		public static void sort(int inputArr[]) {
	        int length = inputArr.length;
	        doMergeSort(inputArr,0, length - 1);
	    }
	 
	    private static void doMergeSort(int[] arr,int lowerIndex, int higherIndex) {         
	        if (lowerIndex < higherIndex) {
	            int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
	            doMergeSort(arr,lowerIndex, middle);
	            doMergeSort(arr,middle + 1, higherIndex);
	            mergeParts(arr,lowerIndex, middle, higherIndex);
	        }
	    }
	    private static void mergeParts(int[]array,int lowerIndex, int middle, int higherIndex) {
	    	int[] temp=new int[higherIndex-lowerIndex+1];
	        for (int i = lowerIndex; i <= higherIndex; i++) {
	            temp[i-lowerIndex] = array[i];
	        }
	        int i = lowerIndex;
	        int j = middle + 1;
	        int k = lowerIndex;
	        while (i <= middle && j <= higherIndex) {
	            if (temp[i-lowerIndex] < temp[j-lowerIndex]) {
	                array[k] = temp[i-lowerIndex];
	                i++;
	            } else {
	                array[k] = temp[j-lowerIndex];
	                j++;
	                cnt+=(middle+1-i);
	            }
	            k++;
	        }
	        while (i <= middle) {
	            array[k] = temp[i-lowerIndex];
	            k++;
	            i++;
	        }
	        while(j<=higherIndex){
	        	array[k]=temp[j-lowerIndex];
	        	k++;
	        	j++;
	        }
	        /*pw.println(lowerIndex+" "+higherIndex);
	        for(int m=lowerIndex;m<=higherIndex;m++)
	        	pw.print(array[m]+" ");
	        pw.println();*/
	    }

		private static void multiply(int A[][],int[][] B){
			int[][] mul=new int[3][3];
			for(int i=0;i<3;i++)
				for(int j=0;j<3;j++){
					mul[i][j]=0;
					for(int k=0;k<3;k++)
						mul[i][j]=(mul[i][j]+(A[i][k]*B[k][j])%2)%2;
				}
			for(int i=0;i<3;i++){
				for(int j=0;j<3;j++){
					A[i][j]=mul[i][j];
					System.out.print(A[i][j]+" ");
				}
				System.out.println();
			}
			System.out.println();
		}
		private static int LCA(int u,int v,int[] depth,int lg){
			if(depth[u]<depth[v])
				return LCA(v,u,depth,lg);
			int diff=depth[u]-depth[v];
			for(int i=0;i<lg;i++)
				if(((diff>>i)&1)==1)
					u=pa[u][i];
			if(u!=v){
				for(int i=lg-1;i>=0;i--)
					if(pa[u][i]!=pa[v][i]){
						u=pa[u][i];
						v=pa[v][i];
					}
				u=pa[u][0];
			}
			return u;
		}
		private static class node{
			private int count;
			private node left;
			private node right;
			public node(int cnt,node a,node b){
				count=cnt;
				left=a;
				right=b;
			}
			public node insert(int l,int r,int w){
				if(l<=w && w<r){
					if(l+1<=r)
						return new node(count+1,null,null);
					int m=(l+r)>>1;
					return new node(count+1,left.insert(l, m, w),right.insert(m, r, w));
				}
				return this;
			}
		}
		private static void method(int index,int n,LinkedList<Long>[] list,long x,int[] cnt){
			if(index==n){
				pw.print(x+" ");
				return;
			}
			Iterator<Long> i;
			if(cnt[index]==1)
				i=list[index].descendingIterator();
			else
				i=list[index].listIterator();
			while(i.hasNext()){
				long y=i.next();
				method(index+1,n,list,x*y,cnt);
				if(cnt[index+1]==1)
					cnt[index+1]=0;
				else
					cnt[index+1]=1;
			}
		}
		private static void bfs(int v,LinkedList<Integer>[] graph,int[] val,int n){
			boolean[] visited=new boolean[n];
			visited[v]=true;
			Queue<Integer> q=new PriorityQueue();
			q.add(v);
			while(!q.isEmpty()){
				int a=q.poll();
				int flag=(val[a]==1)?0:1;
				Iterator<Integer> i=graph[a].iterator();
				while(i.hasNext()){
					int j=i.next();
					if(!visited[j]){
						visited[j]=true;
						q.add(j);
						val[j]=flag;
					}
					if(visited[j] && flag==0)
						val[j]=0;
					//System.out.println(j+" "+flag);
				}
			}
		}
		private static class tmp implements Comparable<tmp>{
			private long x;
			private long y;
			public tmp(long x,long y){
				this.x=x;
				this.y=y;
			}
			@Override
			public int compareTo(tmp o) {
				return (int) (this.x-o.x);
			}
			
		}
		private static class temp implements Comparable<temp>{
			private int x;
			private LinkedList<Integer> list;
			public temp(int a){
				x=a;
				list=new LinkedList();
			}
			@Override
			public int compareTo(temp arg0) {
				return this.x-arg0.x;
			}
		}
		private static class Segment{
			//private int[] base;
			private int[] tree;
			private int size;
			private int n;
			private class node{
				private int a;
				private int b;
				private int c;
				public node(int x,int y,int z){
					a=x;
					b=y;
					c=z;
				}
			}
			public Segment(int n){
				//this.base=arr;
				int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
		        size = 2 * (int) Math.pow(2, x) - 1;
				tree=new int[size];
				this.n=n;
				//build(0,0,n-1);
			}
			private void build(int id,int l,int r){
				//pw.println(1);
				if(r==l){
					tree[id]=1;
					return;
				}
				int mid=l+(r-l)/2;
				//System.out.println(2*id+1+" "+l+" "+mid);
				build(2*id+1,l,mid);
				//System.out.println(2*id+2+" "+(mid+1)+" "+r);
				build(2*id+2,mid+1,r);
				tree[id]=tree[2*id+1]+tree[2*id+2];
			}
			public int query(int l,int r){
				return queryUtil(l,r,0,0,n-1);
			}
			private int queryUtil(int x,int y,int id,int l,int r){
				if(l>y || x>r) 
					return 0;
				if(x <= l && r<=y)
					return tree[id];
				int mid=l+(r-l)/2;
				return queryUtil(x,y,2*id+1,l,mid)+queryUtil(x,y,2*id+2,mid+1,r);
			}
			public void print(){
				HashSet<Integer> set=new HashSet<Integer>();
				cnt(0,0,n-1,set);
				pw.println(set.size());
			}
			private void cnt(int id,int l,int r,HashSet<Integer> set){
				if(tree[id]!=0){
					set.add(tree[id]);
					return;
				}
				if(r==l)
					return;
				int mid=l+(r-l)/2;
				cnt(2*id+1,l,mid,set);
				cnt(2*id+2,mid+1,r,set);
			}
			public void update(int x,int y,int colour,int id,int l,int r){
				if(x>r || l>y)
					return;
				if(x<=l && r<=y){
					tree[id]=colour;
					return;
				}
				int mid=l+(r-l)/2;
				shift(id);
				update(x,y,colour,2*id+1,l,mid);
				update(x,y,colour,2*id+2,mid+1,r);
				//tree[id]=tree[2*id+1]+tree[2*id+2];
			}
			private void shift(int id){
				if(tree[id]!=0){
					tree[2*id+1]=tree[2*id+2]=tree[id];
				}
				tree[id]=0;
			}
		}
		private static String solve(long a,long b){
	        long x = 0, y = 1, lastx = 1, lasty = 0, temp;
	        while (b != 0){
	            long q = a / b;
	            long r = a % b;
	            a = b;
	            b = r;
	            temp = x;
	            x = lastx - q * x;
	            lastx = temp;
	            temp = y;
	            y = lasty - q * y;
	            lasty = temp;            
	        }
	        return new String(lastx+" "+lasty);
		}
		private static long power(long x,long y,long m){
			if(y==0)
				return 1;
			long p=power(x,y/2,m)%m;
			p=(p*p)%m;
			return (y%2==0)?p:(x*p)%m;
		}
		private static boolean isPrime(int n){
			if(n%2==0 || n%3==0)
				return false;
			for(int i=5;i*i<=n;i+=6)
				if(n%i==0 || n%(i+2)==0)
					return false;
			return true;
					
		}
		private static void DFS(int cur,int prev,int[] depth,int[] val,LinkedList<Integer>[] list,int parent[]){
			//System.out.println(v);
			pa[cur][0]=prev;
			parent[cur]=prev;
			depth[cur]=(prev==-1)?0:depth[prev]+1;
			Iterator<Integer> i=list[cur].listIterator();
			while(i.hasNext()){
				int x=i.next();
				if(x!=prev)
					DFS(x,cur,depth,val,list,parent);
			}
		}
		private static long gcd(long n,long r){
			if(r==0)
				return n;
			else return gcd(r,n%r);
		}
	
		private static long min(long a,long b){
			if(a>b)
				return b;
			else
				return a;
		}
		private static class Pair implements Comparable<Pair>{
			int x;
			int y;
			public Pair(int a,int b){
				x=a;
				y=b;
			}
			@Override
			public int compareTo(Pair arg0) {
				if(this.x > arg0.x)
					return 1;
				return 0;
			}
		}
		private static long pow(int a, BigInteger b, int MOD) {
			long x = 1, y = a;
			    while(b.compareTo(new BigInteger("0"))==1) {
			        if(b.mod(new BigInteger("2")).intValue() == 1) {
			            x=(x*y);
			            if(x>MOD) x%=MOD;
			        }
			        y = (y*y);
			        if(y>MOD) y%=MOD;
			        b =b.divide(new BigInteger("2"));
			    }
			    return x;
			}
		private static void computeLpsArray(String pat,int size,int[] lps){
			int len=0;
			int i=1;
			lps[0]=0;
			while(i<size){
				if(pat.charAt(i)==pat.charAt(len)){
					len++;
					lps[i]=len;
					i++;
				}else{
					if(len!=0){
						len=lps[len-1];
					}else{
						lps[i]=len;
						i++;
					}
				}
			}
		}
		private static int KMP(String pat,String txt){
			int m=pat.length();
			int n=txt.length();
			int[] lps=new int[m];
			int j=0;
			int len=0;
			int index=0;
			computeLpsArray(pat,m,lps);
			int i=0;
			while(i<n){
				if(pat.charAt(j)==txt.charAt(i)){
					i++;
					j++;
				}else{
					if(j!=0)
						j=lps[j-1];
					else
						i++;
				}
				if(len<j){
					len=j;
					//pw.println(i);
					index=i;
				}
			}
			return index-len;
		}
		private static long max(long a,long b){
			if(a>b)
				return a;
			return b;
		}
		public static void main(String[] args) throws Exception {
			InputReader(System.in);
			pw = new PrintWriter(System.out);
			soln();
			pw.close();
		}
	
		// To Get Input
		// Some Buffer Methods
	
		public static void InputReader(InputStream stream1) {
			stream = stream1;
		}
	
		private static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	
		private static boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	
		private static int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
	
		private static int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		private static long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		private static String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
	
		private static String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
	
		private static int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}
	
		private static long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}
	
		private static void pArray(int[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			return;
		}
	
		private static void pArray(long[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			return;
		}
	
		private static boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}
	
		private interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	
	}