import sys

def move():
	global stavy, score
	d = 0
	while d < 4:
		novy = score ^ stavy[d]
		if novy < stavy[d]:
			print(n2d[d], stavy[d]-novy)
			stavy[d] = novy
			score = 0
			break
		d += 1

N, M, K = tuple(int(vec) for vec in input().split(" "))

first = input().split(" ")
maxy = [int(first[0]), int(first[1]), int(first[0]), int(first[1])] # top, right, bottom, left

k = 1
while k < K:
	a, b = tuple(int(vec) for vec in input().split(" "))
	if a < maxy[0]:
		maxy[0] = a
	elif a > maxy[2]:
		maxy[2] = a
	if b < maxy[3]:
		maxy[3] = b
	elif b > maxy[1]:
		maxy[1] = b
	k += 1

stavy = [maxy[0]-1, M-maxy[1], N-maxy[2], maxy[3]-1]
score = stavy[0]^stavy[1]^stavy[2]^stavy[3]

n2d = ["top", "right", "bottom", "left"]
d2n = {n2d[i]:i for i in range(4)}

#print(stavy)

if score == 0:
	print("pass")
else:
	move()
sys.stdout.flush()

while True:
	inp = input()
	if inp == "yuck!":
		break
	r, x = inp.split(" ")
	r = d2n[r]
	x = int(x)
	score = stavy[r] # doted byla nula!
	stavy[r] -= x
	score ^= stavy[r]
	move()
	sys.stdout.flush()

