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 <iostream>
#include <list>

using namespace std;

int main()
{
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int a[20][20] = {0}, x, y;
		for(int i = 0; i < n; i++){
			cin >> x >> y;
			a[x][y] = 1;
		}
		int m, X=10, Y=10, cnt=0;
		char d;
		int l;
		cin >> m;
		for(int j = 0; j < m; j++){
				cin >> d >> l;
				for(int k = 0; k < l; k++){
				if(d == 'N') Y++;
				else if(d == 'E') X++;
				else if(d == 'S') Y--;
				else if(d == 'W') X--;
				if(a[X][Y] == 1) cnt++;
			}
		}
		if(cnt == n) cout << "Yes" <<endl;
		else cout << "No" << endl;
	}
	return 0;
}

C++: // Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

int test(int n){
    int mas[40][40]={0};
    int x,y;
    int w;
    
    for(int i = 0 ; i < n ; i++){
        cin >> x >> y;
        mas[x][y]=1;
    }
    
    int m;
    int curx = 10, cury = 10;
    char d;
    
    cin >> m;
    
    while(m--){
        cin >> d >> w;
        
        if(d == 'N'){
            if((cury+w)>20) continue;
            while(w--){
                if(cury<20){
                    cury++;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'E'){
            if((curx+w)>20) continue;
            while(w--){
                if(curx<20){
                    curx++;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'S'){
           if((cury-w)<0) continue;
            while(w--){
                if(cury>0){
                    cury--;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
        
        if(d == 'W'){
            if((curx-w)<0) continue;
            while(w--){
                if(curx>0){
                    curx--;
                    if(mas[curx][cury]==1){
                        mas[curx][cury]=0;
                        n--;
                    }
                }
            }
        }
    }
    
    if(n==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

main(){
    int n;
    
    while(cin >> n){
        if(n == 0) break;
        test(n);
    }
    
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<bits//stdc++.h>
#include<functional>
using namespace std;
int main() {
	int n;
	bool a[21][21];
	while(cin>>n&&n!=0){
		for(int i=0;i<=20;i++){
			for(int j=0;j<=20;j++) a[i][j]=false;
		}
		int c,d;
		for(int i=0;i<n;i++){
			cin>>c>>d;
			a[c][d]=true;
		}
		int sum=n,m;
		int x=10,y=10;
		cin>>m;
		char e;
		for(int i=0;i<m;i++){
			cin>>e>>c;
			if(e=='N')x-=d;
			else if(e=='S') x+=d;
			else if(e=='E') y+=d;
			else y-=d;
			if(a[x][y]) {
				sum--;
				a[x][y]=false;
			} 
		}
		if(sum==0) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n;
int main() {
	while (cin>>n) {
		if (n == 0)return 0;
		int x[21], y[21];
		for (int i = 0; i < n; i++) {
			cin >> x[i] >> y[i];
		}
		int m; cin >> m;
		char d[31];
		int l[31];
		bool a[21][21];
		for (int i = 0; i < 21; i++) {for (int j = 0; j < 21; j++) {a[i][j] = 0;}}
		a[10][10] = 1;
		for (int i = 0; i < m; i++) {cin >> d[i] >> l[i];}
		int cont = 0;
		int nowx = 10;
		int nowy = 10;
		while (cont < m) {
			if (d[cont] == 'N' || d[cont] == 'S') {
				if (d[cont] == 'N') {
					for (int i = nowy; i <= l[cont] + nowy; i++) {
						a[i][nowx] = 1;
					}
					nowy += l[cont];
				}
				else {
					for (int i = nowy; i >= nowy - l[cont]; i--) {
						a[i][nowx] = 1;
					}
					nowy -= l[cont];
				}
				
			}
			else {
				if (d[cont] == 'E') {
					for (int i = nowx; i <= l[cont] + nowx; i++) { 
						a[nowy][i] = 1; 
					}
					nowx += l[cont];
				}
				else {
					for (int i = nowx; i >= nowx - l[cont]; i--) {
						a[nowy][i] = 1; 
					}
					nowx -= l[cont];
				}
			}
			cont++;
		}
		//for (int i = 0; i < 21; i++) { for (int j = 0; j < 21; j++) { cout << a[i][j] << " "; if (j == 20)cout << endl; } }
		for (int i = 0; i < n; i++) {
			if (a[y[i]][x[i]] != 1) {cout << "No" << endl;break;}
			if (i == n - 1)cout << "Yes" << endl;
		}

	}
}