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: import sys
f = sys.stdin



func = {
'N':lambda x, y:(x, y + 1),
'S':lambda x, y:(x, y - 1),
'E':lambda x, y:(x + 1, y),
'W':lambda x, y:(x - 1, y)}

while True:
    n = int(f.readline())
    if n == 0:
        break
    gems = {tuple(map(int, f.readline().split())):False for _ in range(n)}
    m = int(f.readline())
    pos = (10, 10)
    for way, step in [f.readline().split() for _ in range(m)]:
        for i in range(int(step)):
            pos = func[way](*pos)
            try:
                gems[pos] = True
            except KeyError:
                pass

    print('Yes' if all(gems.values()) else 'No')

Python: def solve(N, xy, M, diredist):
    now = (10, 10)
    field = [[0]*21 for i in range(21)]
    field[now[0]][now[1]] = 1
    direction = {"N":(1, 0), "W":(0,-1), "S":(-1, 0), "E":(0, 1)}
    for i in range(M):
        dire = direction[diredist[i][0]]
        dist = int(diredist[i][1])
        for j in range(dist):
            field[now[0]+dire[0]][now[1]+dire[1]] = 1
            now = (now[0]+dire[0], now[1]+dire[1])
        
    for xi, yi in xy:
        if field[yi][xi]:
            continue
        else:
            return False
    
    return True
    

def main():
    ans = []
    while True:
        N = int(input())
        if (not N):
            break
        xy = [list(map(int, input().split())) for i in range(N)]
        M = int(input())
        diredist = [input().split() for i in range(M)]
        ans.append(solve(N, xy, M, diredist))
    
    for i in ans:
        print("Yes" if i else "No")


main()

Python: def between(sx,sy,mx,my,ex,ey):
    # y軸方向への移動
    if sx == mx and mx == ex:
        if sy <= my and my <= ey:
            return True
        elif ey <= my and my <= sy:
            return True
    elif sy == my and my == ey:
        if sx <= mx and mx <= ex:
            return True
        elif ex <= mx and mx <= sx:
            return True
    return False

while True:
    n = int(input())
    if n == 0: break
    stones = []
    picked = [False for i in range(n)]
    for i in range(n):
        tx, ty = map(int, input().split())
        stones.append([tx, ty])

    """
    print("stones::")
    for i in range(n):
        print(stones[i])
    print("------------")
    """
    m = int(input())

    cx = 10
    cy = 10
    for i in range(m):
        hoge, foo = map(str, input().split())
        drc = hoge
        dist = int(foo)

        if drc == 'N':
            ex = cx
            ey = cy + dist
        elif drc == 'E':
            ex = cx + dist
            ey = cy
        elif drc == 'W':
            ex = cx - dist
            ey = cy
        else:
            ex = cx
            ey = cy - dist

        #print("moving from {},{} to {},{}".format(cx, cy, ex, ey))

        for j in range(len(stones)):
            if between(cx, cy, stones[j][0], stones[j][1], ex, ey):
                picked[j] = True
                #print("stone {} picked".format(j))

        cx = ex
        cy = ey

    """
    print("picked???")
    for i in picked:
        print(i)
    print("----------")
    """
        
    for i in picked:
        if i == False:
            print("No")
            break
    else:
        print("Yes")

Python: while True:
  N=int(input())
  if N==0:
    break
  houseki=[]
  for i in range(N):
    a=list(map(int,input().split()))
    houseki.append(a)
  
  M=int(input())
  houkou=[]
  kyori=[]
  for i in range(M):
    d,l=map(str,input().split())
    houkou.append(d)
    kyori.append(int(l))
  
  x=10
  y=10
  get=0
  robo=[]
  for i in range(len(houkou)):
    if houkou[i]=="N":
      for j in range(kyori[i]):
        y+=1
        robo.append([x,y])
    elif houkou[i]=="E":
      for j in range(kyori[i]):
        x+=1
        robo.append([x,y])
    elif houkou[i]=="S":
      for j in range(kyori[i]):
        y-=1
        robo.append([x,y])
    elif houkou[i]=="W":
      for j in range(kyori[i]):
        x-=1
        robo.append([x,y])
  for i in range(len(houseki)):
    for j in range(len(robo)):
      if robo[j]==houseki[i]:
        get+=1
        break
  #print(houseki)
  #print(robo)
  if get==N:
    print("Yes")
  else:
    print("No")

Python: #!/usr/bin/python3

while True:
    n = int(input())
    if n == 0 : break

    gems = []
    for i in range(n):
        gem = tuple(map(int, input().split()))
        gems.append(gem)
    
    m = int(input())
    bot = [10, 10]
    history = [(10, 10)]
    for j in range(m):
        move = list(input().split())
        move[1] = int(move[1])
        if move[0] == 'N':
            index = 1 #y
            direc = 1 # pos
        elif move[0] == 'S':
            index = 1
            direc = -1 # neg
        elif move[0] == 'E':
            index = 0 #x
            direc = 1
        else: #W
            index = 0
            direc = -1
        for j in range(abs(move[1])):
            bot[index] += direc
            history.append(tuple(bot))
    f = True
    for g in gems:
        if g not in history:
            f = False
            break
    print("Yes" if f else "No")

Python: N=int (input())
while N != 0:
    Jcou = 0
    JUE=[]
    for i in range(N):
        JUE.append(list(map(int, input().split())))
    M=int(input())
    RO=[10,10]
    for j in range(M):
        m1=list(map( str,input().split()))
        if(m1[0]=="N"):
            for k in range(int(m1[1])):
                RO[1]+=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="S"):
            for k in range(int(m1[1])):
                RO[1]-=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="E"):
            for k in range(int(m1[1])):
                RO[0]+=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
        elif(m1[0]=="W"):
            for k in range(int(m1[1])):
                RO[0]-=1
                if RO in JUE:
                    JUE.remove(RO)
                    Jcou+=1
    if (Jcou == N):
        print("Yes")
    else :
        print("No")


    
    N=int(input())