import sys from collections import deque def main(): data = sys.stdin.buffer.read().split() idx = 0 N = int(data[idx]); idx += 1 M = int(data[idx]); idx += 1 K = int(data[idx]); idx += 1 adj = [[] for _ in range(N+1)] radj = [[] for _ in range(N+1)] for _ in range(M): u = int(data[idx]); idx += 1 v = int(data[idx]); idx += 1 adj[u].append(v) radj[v].append(u) R = [False]*(N+1) R[1] = True stk = [1] while stk: u = stk.pop() for v in adj[u]: if not R[v]: R[v] = True stk.append(v) order = [] visited = [False]*(N+1) visited[1] = True node_stack = [1] it_stack = [iter(adj[1])] while node_stack: found = False for v in it_stack[-1]: if R[v] and not visited[v]: visited[v] = True node_stack.append(v) it_stack.append(iter(adj[v])) found = True break if not found: order.append(node_stack.pop()) it_stack.pop() comp = [0]*(N+1) c = 0 for u in reversed(order): if comp[u] == 0: c += 1 stk = [u] comp[u] = c while stk: x = stk.pop() for y in radj[x]: if R[y] and comp[y] == 0: comp[y] = c stk.append(y) num_scc = c has_next = [False]*(num_scc+2) for u in range(1, N+1): if not R[u]: continue cu = comp[u] for v in adj[u]: if not R[v]: continue cv = comp[v] if cv == cu + 1: has_next[cu] = True for i in range(1, num_scc): if not has_next[i]: print("No"); return scc1 = comp[1] color = [-1]*(N+1) color[1] = 0 q = deque([1]) odd = False while q: u = q.popleft() cc = color[u] for v in adj[u]: if comp[v] != scc1: continue if color[v] == -1: color[v] = 1 - cc q.append(v) elif color[v] == cc: odd = True print("Yes" if odd else "No") main()