# _*_ coding.utf-8 _*_
# 开发人员 : leehm
# 开发时间 : 2020/7/18 21:45
# 文件名称 : 206.py
# 开发工具 : PyCharm
count = 0
loca = [0 for i in range(1001)]
location = [loca for j in range(1001)]
while 1:
    a1 = input()
    if a1 == '0 0':
        break
    count += 1
    a = a1.split()
    # queen
    queen = input()
    queens = queen.split()

    # knight
    knight = input()
    knights = knight.split()
    del knights[0]
    for 
    # pawn
    pawn = input()
    pawns = pawn.split()
