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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

bool fld[21][21];

signed main()
{
    int N;

    while (cin >> N, N) {
        memset(fld, false, sizeof(fld));
        rep(i, N) {
            int x, y; cin >> x >> y; 

            fld[y][x] = true;
        }

        int cnt = 0;

        pii now = pii(10, 10);

        if (fld[now.fst][now.scd]) {
            fld[now.fst][now.scd] = false;
            cnt++;
        }

        int M;

        cin >> M;

        rep(i, M) {
            char c; cin >> c;
            int v; cin >> v;

            rep(j, v) {
                if (c == 'N') now.fst ++;
                if (c == 'E') now.scd ++;
                if (c == 'S') now.fst --;
                if (c == 'W') now.scd --;

                if (fld[now.fst][now.scd]) {
                    fld[now.fst][now.scd] = false;
                    cnt++;
                }
            }
        }

        if (cnt == N) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

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

#define int long long

signed main() {
	int n;
	while ( cin >> n, n ) {
		bool used[21][21] = {{0}};
		for ( int i = 0; i < n; i++ ) {
			int x, y;
			cin >> x >> y;
			used[y][x] = 1;
		}

		int m;
		cin >> m;
		int nx = 10, ny = 10;
		used[ny][nx] = 0;
		for ( int i = 0; i < m; i++ ) {
			char c;
			int d;
			cin >> c >> d;
			if ( c == 'N' ) {
				for ( int i = 0; i < d; i++ ) {
					used[++ny][nx] = 0;
				}
			}
			if ( c == 'E' ) {
				for ( int i = 0; i < d; i++ ) {
					used[ny][++nx] = 0;
				}
			}
			if ( c == 'S' ) {
				for ( int i = 0; i < d; i++ ) {
					used[--ny][nx] = 0;
				}
			}
			if ( c == 'W' ) {
				for ( int i = 0; i < d; i++ ) {
					used[++ny][--nx] = 0;
				}
			}			
		}
		int cnt = 0;
		for ( int i = 0; i < 21; i++ ) {
			for ( int j = 0; j < 21; j++ ) cnt += used[i][j];
		}

		if ( cnt ) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

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 FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main() {
	int N;

	while(cin >> N, N) {
		int rx = 10, ry = 10;
		vvi field(21, vi(21, 0));

		int x, y;
		REP(i, N) {
			cin >> x >> y;
			field[x][y] = 1;
		}

		int M;
		cin >> M;
		
		char c;
		int t;
		REP(i, M) {
			cin >> c >> t;
			if(c == 'N') {
				REP(j, t) {
					ry++;
					field[rx][ry] = 0;
				}
			} else if(c == 'E') {
				REP(j, t) {
					rx++;
					field[rx][ry] = 0;
				}
			} else if(c == 'W') {
				REP(j, t) {
					rx--;
					field[rx][ry] = 0;
				}
			} else {
				REP(j, t) {
					ry--;
					field[rx][ry] = 0;
				}
			}
		}

		FOR(i, 0, 20) {
			FOR(j, 0, 20) {
				if(field[i][j] == 1) {
					cout << "No" << endl;
					goto ne;
				} else {

				}
			}
		}

		cout << "Yes" << endl;

		ne:;
	}

	return 0;
}

C++: #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
	while (1) {
		int N = 0;
		int matrix[20][20] = {};
		
		cin >> N;
		if (N == 0) break;

		for (int i = 0; i < N; i++) {
			int x, y;
			cin >> x >> y;
			matrix[x][y] = 1;
		}

		int M;
		char dir[30];
		int val[30];

		cin >> M;

		for(int i = 0; i < M; i++) {
			cin >> dir[i] >> val[i];
		}

		int x = 10, y = 10;
		int deltax;
		int deltay;
		matrix[x][y] = 0;
		for (int i = 0; i < M; i++) {
			if (dir[i] == 'N') {
				deltax = 0;
				deltay = 1;
			}
			if (dir[i] == 'S') {
				deltax = 0;
				deltay = -1;
			}
			if (dir[i] == 'W') {
				deltax = -1;
				deltay = 0;
			}
			if (dir[i] == 'E') {
				deltax = 1;
				deltay = 0;
			}
			for (int j = 0; j < val[i]; j++) {
				x += deltax;
				y += deltay;
				matrix[x][y] = 0;
			}
		}

		int result = true;
		for (int i = 0; i < 20; i++) {
			for (int j = 0; j < 20; j++) {
				//cout << matrix[j][i];
				if (matrix[i][j]) result = false;
			}
			//cout << endl;
		}

		if (result) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}