Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	sc = bufio.NewScanner(os.Stdin)
)

type Point struct {
	X, Y int
}

type Gem struct {
	ID int
	Point
}

type Map struct {
	Current       *Point
	Gems          map[int]*Gem
	CollectedGems map[int]*Gem
}

func (m *Map) Move(dir string, l int) {
	switch {
	case dir == "N" || dir == "S":
		a := 1
		if dir == "S" {
			a = -1
		}
		for i := 0; i < l; i++ {
			m.Current.Y += a
			for _, g := range m.Gems {
				m.TryToTakeGem(g)
			}
		}
	case dir == "E" || dir == "W":
		a := 1
		if dir == "W" {
			a = -1
		}
		for i := 0; i < l; i++ {
			m.Current.X += a
			for _, g := range m.Gems {
				m.TryToTakeGem(g)
			}
		}
	}
}

func (m *Map) HasCompleted() bool {
	return len(m.Gems) == 0
}

func (m *Map) TryToTakeGem(g *Gem) {
	if m.Current.X == g.X && m.Current.Y == g.Y {
		m.CollectedGems[g.ID] = g
		delete(m.Gems, g.ID)
	}
}

func main() {
	for sc.Scan() {
		n, _ := strconv.Atoi(sc.Text())
		if n == 0 {
			break
		}
		m := &Map{
			Current:       &Point{X: 10, Y: 10},
			Gems:          map[int]*Gem{},
			CollectedGems: map[int]*Gem{},
		}
		for i := 0; i < n; i++ {
			sc.Scan()
			chunks := strings.Split(sc.Text(), " ")
			x, _ := strconv.Atoi(chunks[0])
			y, _ := strconv.Atoi(chunks[1])
			m.Gems[i+1] = &Gem{ID: i + 1, Point: Point{X: x, Y: y}}
		}
		sc.Scan()
		opCnt, _ := strconv.Atoi(sc.Text())
		for i := 0; i < opCnt; i++ {
			sc.Scan()
			chunks := strings.Split(sc.Text(), " ")
			dir := chunks[0]
			v, _ := strconv.Atoi(chunks[1])
			m.Move(dir, v)
		}
		msg := "No"
		if m.HasCompleted() {
			msg = "Yes"
		}
		fmt.Println(msg)
	}
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double EPS = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int N, M;

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	while (cin >> N, N) {
		int table[21][21];
		rep(i, 21) rep(j, 21) table[i][j] = 0;
		int py = 10, px = 10;
		rep(i, N) {
			int x, y;
			cin >> x >> y;
			table[20 - y][x] = 1;
		}
		cin >> M;
		int cnt = 0;
		rep(i, M) {
			char d; int l;
			cin >> d >> l;
			switch (d) {
			case 'N':
				rep(i, l) {
					py--;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'S':
				rep(i, l) {
					py++;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'E':
				rep(i, l) {
					px++;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			case 'W':
				rep(i, l) {
					px--;
					if (table[py][px] == 1) {
						cnt++;
						table[py][px] = 0;
					}
				}
				break;
			}
		}
		if (cnt == N) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

int N, M;
int a[21][21];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while(cin>>N,N) {
		rep(i, 20) {rep(j, 20)a[i][j]=false;}
		
		int x, y;
		rep(i, N) {
			cin>>x>>y;
			a[x][y] = true;
		}
		
		cin>>M;
		x=10;
		y=10;
		rep(i, M) {
			char d;
			int l;
			cin>>d>>l;
			rep(i, l) {
				switch(d) {
					case 'N':y++;break;
					case 'E':x++;break;
					case 'S':y--;break;
					case 'W':x--;break;
				}
				a[x][y]=false;
			}
		}
		
		bool f = true;
		rep(i, 21) {
			rep(j, 21) {
				if(a[i][j]) {
					f=false;
					break;
				}
			}
			if(!f)break;
		}
		cout<<(f?"Yes":"No")<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a[21][21] = {};
	int n;
	int x, y;
	while (cin >> n&&n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> y >> x;
			a[y][x] = 1;
		}
		int m;
		x = 10, y = 10;
		int count = 0;
		int num;
		char c;
		cin>>m;
		while(m--) {
			cin >> c >> num;
			while(num--) {
				if (c == 'N')y++;
				else if (c == 'E')x++;
				else if (c == 'S')y--;
				else x--;
				if (a[y][x]) {
					count++;
					a[y][x] = 0;
				}
			}

		}
		if (count == n)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
	int n,m;
	while(cin>>n,n){
		vvi field(21,vi(21));
		for (int i = 0; i < n; i++)
		{
			int x,y;
			cin>>x>>y;
			field[x][y]=1;
		}
		cin>>m;
		int cx=10,cy=10;
		int cnt=0;
		for (int i = 0; i < m; i++)
		{
			char d;
			int l;
			cin>>d>>l;
			for (int j = 0; j < l; j++)
			{
				switch(d){
				case 'N':
					cy++;break;
				case 'S':
					cy--;break;
				case 'E':
					cx++;break;
				case 'W':
					cx--;break;
				default:
					assert(0);
				}
				if(field[cx][cy]){
					cnt++;
					field[cx][cy]=0;
				}
			}
		}
		cout<<(cnt==m?"Yes":"No")<<endl;
	}

}

C++: #include<iostream>
using namespace std;main(){char c;int N,M,x,y,i,f[21][21];for(;cin>>N,N;puts(N?"No":"Yes")){for(i=441;i-->0;)f[i%21][i/21]=0;for(;++i<N;f[y][x]=1)cin>>x>>y;x=y=10;for(cin>>M;M-->0;)for(cin>>c>>i;i-->0;y+=(c==78)-(c==83),f[y][x]&&N--,f[y][x]=0)x+=(c==69)-(c==87);}}

C++: #include <bits/stdc++.h>
using namespace std;

#define rep(i,j) for (int (i)=0;(i)<(int)(j);++(i))

int N, M;
int squ[21][21];

void init() {
    rep(i, 21) rep(j, 21) squ[i][j] = 0;
}

bool chk() {
    rep(i, 21) rep(j, 21) if (squ[i][j]) return false;
    return true;
}

int main() {
    while (cin >> N, N) {
        init();
        rep(i, N) {
            int x, y; cin >> x >> y;
            squ[x][y] = 1;
        }
        cin >> M;
        int posx = 10, posy = 10;
        rep(i, M) {
            char h; int v; bool ns = 0, ew = 0;
            cin >> h >> v;
            switch (h) {
                case 'N': ns = 1;
                case 'S':
                    rep(j, v) {
                        posy += (ns) ? 1 : -1;
                        squ[posx][posy] = 0;
                    }
                    break;
                case 'E': ew = 1;
                case 'W':
                    rep(j, v) {
                        posx += (ew) ? 1 : -1;
                        squ[posx][posy] = 0;
                    }
                    break;
            }
        }
        if (chk()) puts("YES");
        else puts("NO");
    }
}