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)
	}
}

Python: def check(f):
        for k in range (n):
                if j[k]==g:
                        j[k]=[-1,-1]
                        f+=1
        return f

while 1:
        n=input()
        if n==0:
                break
        j=[0 for i in range(n)]
        for i in range(n):
                j[i]=map(int,raw_input().split())

        m=input()
        g=[10,10]
        o=[0,0]
        f=0
        for i in range(m):
                o=map(str,raw_input().split())
                for l in range(int(o[1])):
                        if o[0]=="N":
                                g[1]+=1
                                f=check(f)
                        elif o[0]=="S":
                                g[1]-=1
                                f=check(f)
                        elif o[0]=="E":
                                g[0]+=1
                                f=check(f)
                        elif o[0]=="W":
                                g[0]-=1
                                f=check(f)
        if n<=f:
                print("Yes")
        else:
                print("No")

Python: #?????????????????§?¨?x,y
x = 10
y = 10
i = 0
j = 0
roboPos = []
#?????????????????????????????°
gemPos = 0
#??§?¨????????????????????????°
orderPos = 0
#??????????????°
gemNum = 0
#??????????????°
orderNum = 0
#??????????????????
cnt = 0
#???????????§?¨?
gemXY = []

def get_input():
    while True:
        try:
            a = input()
            if a == "0":
                break
            yield ''.join(a)
        except EOFError:
            break
if __name__ == "__main__":
    array = list(get_input())

    while orderPos + orderNum < len(array):

        gemNum = int(array[orderPos + orderNum])
        gemPos = orderPos + orderNum + 1
        #print("??????????????°???{0}".format(gemNum))
        for i in range(gemPos,gemPos+gemNum):
            gem_x,gem_y = array[i].split()
            gem_x,gem_y = int(gem_x),int(gem_y)
            gemXY.append([gem_x,gem_y])
            #print("??????????????????{0},{1}".format(gem_x,gem_y))

        orderNum = int(array[gemPos+gemNum])
        orderPos = gemPos+gemNum+1
        #print("??????????????°???{0}".format(orderNum))
        for i in range(orderPos,orderPos+orderNum):
            #print("?????????{0}".format(array[i]))
            direction,length = array[i].split()
            length = int(length)
            if  direction == "N":
                for j in range(length):
                    y += 1
                    #print("?????¨???????????§?¨????{0},{1}".format(x,y))
                    roboPos = [x,y]
                    if roboPos in gemXY:
                        #print("????????????????????°??????")
                        cnt += 1
            elif direction == "S":
                for j in range(length):
                    y -= 1
                    #print("?????¨???????????§?¨????{0},{1}".format(x,y))
                    roboPos = [x,y]
                    if roboPos in gemXY:
                        #print("????????????????????°??????")
                        cnt += 1
            elif direction == "E":
                for j in range(length):
                    x += 1
                    #print("?????¨???????????§?¨????{0},{1}".format(x,y))
                    roboPos = [x,y]
                    if roboPos in gemXY:
                        #print("????????????????????°??????")
                        cnt += 1
            else:
                for j in range(length):
                    x -= 1
                    #print("?????¨???????????§?¨????{0},{1}".format(x,y))
                    roboPos = [x,y]
                    if roboPos in gemXY:
                        #print("????????????????????°??????")
                        cnt += 1

        if cnt == gemNum:
            print("Yes")
        else:
            print("No")
        #print("+++++++++++1???????????????+++++++++++++")
        del gemXY[:]
        x,y = 10,10
        cnt = 0

Python: while True:
    rx = 10
    ry = 10
    n = int(input())
    if n == 0:
        exit()
    gems = [[0 for j in range(21)] for i in range(21)]
    for _ in range(n):
        (x, y) = [int(x) for x in input().split()]
        gems[x][y] = 1
    m = int(input())
    for _ in range(m):
        (d, l) = input().split()
        if d=='N':
            for i in range(1, int(l)+1):
                gems[rx][ry+i] = 0
            ry = ry+int(l)
        elif d=='W':
            for i in range(1, int(l)+1):
                gems[rx-i][ry] = 0
            rx = rx-int(l)
        elif d=='E':
            for i in range(1, int(l)+1):
                gems[rx+i][ry] = 0
            rx = rx+int(l)
        elif d=='S':
            for i in range(1, int(l)+1):
                gems[rx][ry-i] = 0
            ry = ry-int(l)
    if sum([sum(gems[i]) for i in range(21)])==0:
        print('Yes')
    else:
        print('No')

Python: k = ['N','E','S','W']
v = [[0,1],[1,0],[0,-1],[-1,0]]
while True:
    n = int(input())
    if not(n): break
    x,y = 10,10
    p = [list(map(int,input().split())) for _ in range(n)]
    for d,r in [input().split() for _ in range(int(input()))]:
        t = v[k.index(d)]
        for _ in range(int(r)):
            x,y =  x+t[0],y+t[1]
            if [x,y] in p: del p[p.index([x,y])]
    print('Yes' if not(p)else 'No')

Python: #!/usr/bin/env python3
#aoj a

while 1:
    N = int(input())
    if N == 0:
        break
    A = [list(map(int,input().split())) for _ in range(N)]
    M = int(input())
    B = [list(input().split()) for _ in range(M)]
    D = []
    nx,ny = 10,10
    for i in range(M):
        if B[i][0] == "N":
            for j in range(1,int(B[i][1])+1):
                D.append([nx,ny+j])
            ny += int(B[i][1])
        elif B[i][0] == "E":
            for j in range(1,int(B[i][1])+1):
                D.append([nx+j,ny])
            nx += int(B[i][1])
        elif B[i][0] == "S":
            for j in range(1,int(B[i][1])+1):
                D.append([nx,ny-j])
            ny -= int(B[i][1])
        elif B[i][0] == "W":
            for j in range(1,int(B[i][1])+1):
                D.append([nx-j,ny])
            nx -= int(B[i][1])
    f = 1
    for i in A:
        if i not in D:
            f = 0
            break
    if f:
        print('Yes')
    else:
        print('No')