n, p, s = map(int, input().split()) for _ in range(s): cards = list(map(int, input().split()))[1:] print("KEEP" if p in cards else "REMOVE")