#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int ns = 0;     bool ok = true;     for (int i = 0; i < n; i++) {       int val;       cin >> val;       string type;       cin >> type;       if (type ==  South ) {         if (ns + val > 20000)           ok &= false;         else           ns += val;       } else if (type ==  North ) {         if (ns - val < 0)           ok &= false;         else           ns -= val;       } else {         if (ns == 20000 || ns == 0) ok &= false;       }     }     ok &= ns == 0;     cout << (ok ?  YES n  :  NO n );     return 0;   }   