v = int(input()) n = int(input()) for _ in range(n): s, k = input().strip().split() print(f"{s} {'opin' if int(k) >= v else 'lokud'}")