def check(l, n, m, k): for i in range(n): if str(k) in set(l[i]): return 'Yes' return 'No' while True: try: n, m, k = map(int, input().split()) l = [] for _ in range(n): l.append(input().split()) print(check(l, n, m, k)) ...