dico = {}

nb_floors, width, nb_rounds, exit_floor, exit_pos, nb_total_clones,
nb_additional_elevators, nb_elevators = [int(i) for i in raw_input().split()]
for i in range(nb_elevators):
    elevator_floor, elevator_pos = [int(j) for j in raw_input().split()]
    dico[elevator_floor] = elevator_pos

while True:
    clone_floor, clone_pos, direction = raw_input().split()
    clone_floor = int(clone_floor)
    clone_pos = int(clone_pos)

    if clone_pos == width - 1 or clone_pos == 0:
        instruction = "BLOCK"
    else:
        instruction = "WAIT"

    try:
        valeur = dico[clone_floor]
    except:
        valeur = exit_pos

    if clone_pos < valeur and direction == "LEFT":
        instruction = "BLOCK"
    elif clone_pos > valeur and direction == "RIGHT":
        instruction = "BLOCK"
    else:
        instruction = "WAIT"

    print(instruction)

448f2d9d65a39e4d63a0a68b68376dee63ebc63f
<mask token>

<mask token>
nb_floors, width, nb_rounds, exit_floor, exit_pos, nb_total_clones
<mask token>
for i in range(nb_elevators):
    elevator_floor, elevator_pos = [int(j) for j in raw_input().split()]
    dico[elevator_floor] = elevator_pos
while True:
    clone_floor, clone_pos, direction = raw_input().split()
    clone_floor = int(clone_floor)
    clone_pos = int(clone_pos)
    if clone_pos == width - 1 or clone_pos == 0:
        instruction = 'BLOCK'
    else:
        instruction = 'WAIT'
    try:
        valeur = dico[clone_floor]
    except:
        valeur = exit_pos
    if clone_pos < valeur and direction == 'LEFT':
        instruction = 'BLOCK'
    elif clone_pos > valeur and direction == 'RIGHT':
        instruction = 'BLOCK'
    else:
        instruction = 'WAIT'
    print(instruction)

dico = {}
nb_floors, width, nb_rounds, exit_floor, exit_pos, nb_total_clones
nb_additional_elevators, nb_elevators = [int(i) for i in raw_input().split()]
for i in range(nb_elevators):
    elevator_floor, elevator_pos = [int(j) for j in raw_input().split()]
    dico[elevator_floor] = elevator_pos
while True:
    clone_floor, clone_pos, direction = raw_input().split()
    clone_floor = int(clone_floor)
    clone_pos = int(clone_pos)
    if clone_pos == width - 1 or clone_pos == 0:
        instruction = 'BLOCK'
    else:
        instruction = 'WAIT'
    try:
        valeur = dico[clone_floor]
    except:
        valeur = exit_pos
    if clone_pos < valeur and direction == 'LEFT':
        instruction = 'BLOCK'
    elif clone_pos > valeur and direction == 'RIGHT':
        instruction = 'BLOCK'
    else:
        instruction = 'WAIT'
    print(instruction)

dico = {}

nb_floors, width, nb_rounds, exit_floor, exit_pos, nb_total_clones,
nb_additional_elevators, nb_elevators = [int(i) for i in raw_input().split()]
for i in range(nb_elevators):
    elevator_floor, elevator_pos = [int(j) for j in raw_input().split()]
    dico[elevator_floor] = elevator_pos

while True:
    clone_floor, clone_pos, direction = raw_input().split()
    clone_floor = int(clone_floor)
    clone_pos = int(clone_pos)

    if clone_pos == width - 1 or clone_pos == 0:
        instruction = "BLOCK"
    else:
        instruction = "WAIT"

    try:
        valeur = dico[clone_floor]
    except:
        valeur = exit_pos

    if clone_pos < valeur and direction == "LEFT":
        instruction = "BLOCK"
    elif clone_pos > valeur and direction == "RIGHT":
        instruction = "BLOCK"
    else:
        instruction = "WAIT"

    print(instruction)
