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>

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

bool solve(int n) {
	vector<vector<int>> mapv(21, vector<int>(21));
	rep(i, n) {
		int x, y; cin >> x >> y; mapv[x][y] = 1;
	}
	map<char, int> dir;
	dir['N'] = 0;
	dir['E'] = 1;
	dir['S'] = 2;
	dir['W'] = 3;
	int dy[] = {1, 0, -1,  0};
	int dx[] = {0, 1,  0, -1};
	int m; cin >> m;
	int res = n;
	int x = 10, y = 10;
	rep(i, m) {
		char c; cin >> c;
		int d = dir[c];
		int l; cin >> l;
		rep(i, l) {
			x += dx[d];
			y += dy[d];
			if (mapv[x][y]) {
				mapv[x][y]--; res--;
			}
		}
	}
	return res == 0;
}

signed main() {
	int n;
	while (cin >> n, n) cout << (solve(n) ? "Yes" : "No") << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int n, m, x1, y1, x, y, len;
  char dir;
  int grid[21][21];
  while(cin >> n, n){
    memset(grid, 0, sizeof(grid));
    x = 10; y = 10;
    grid[y][x] = 1;
    for(int i = 0 ; i < n ; i++){
      cin >> x1 >> y1;
      grid[x1][y1] = 5;
    }

    /*for(int a = 0 ; a < 21 ; a++){
  for(int b = 0 ; b < 21 ; b++){
    cout << grid[b][a];
  }
  cout << endl;
  }*/

    cin >> m;
    for(int i = 0 ; i < m ; i++){
      cin >> dir >> len;
      if(dir == 'N'){
	for(int j = 0 ; j < len ; j++){
	  grid[x][++y] = 1;
	}
      }
      if(dir == 'E'){
	for(int j = 0 ; j < len ; j++){
	  grid[++x][y] = 1;
	}
      }
      if(dir == 'S'){
	for(int j = 0 ; j < len ; j++){
	  grid[x][--y] = 1;
	}
      }
      if(dir == 'W'){
	for(int j = 0 ; j < len ; j++){
	  grid[--x][y] = 1;
	}
      }

      /*for(int a = 0 ; a < 21 ; a++){
  for(int b = 0 ; b < 21 ; b++){
    cout << grid[b][a];
  }
  cout << endl;
 }*/
    }
    bool flag=0;
    for(int i = 0 ; i < 21 ; i++){
      for(int j = 0 ; j < 21 ; j++){
	if(grid[i][j] == 5) flag = 1;
      }
    }
    if(flag == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
	int x = 10, y = 10, i, j;
	int n, X[100], Y[100], N, vn[100],flag;
	char dir[100];   //宝石個数n、移動回数N  
	while (1) {
		flag = 0;
		for (int i = 0; i < 10; i++)
			X[i] = Y[i] = 0;
		scanf("%d", &n);
		
		if (n == 0) {
			break;
		}
		for (i = 0; i < n; i++) {
			scanf("%d %d", &X[i], &Y[i]);
		}

		scanf("%d", &N);

		for (i = 0; i < N; i++) {
			scanf("%s %d", &dir[i], &vn[i]);
		}


		for (i = 0; i < n; i++) {
			for (j = 1; j <= vn[i]; j++) {
				if (dir[i] == 'N')
					y += 1;
				else if (dir[i] == 'E')
					x += 1;
				else if (dir[i] == 'S')
					y -= 1;
				else
					x -= 1;

				if (X[i] == x && Y[i] == y)
					flag += 1;



			}
			

		}
		if (flag == n)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}