import sys def solve(): input = sys.stdin.read data = input().split() if not data: return N = int(data[0]) M = int(data[1]) K = int(data[2]) path_nodes = list(range(1, K)) + [N] if K == 1: path_nodes = [1, N] else: path_nodes = [1] + list(range(2, K + 1)) + [N] must_keep = set() for i in range(K): u, v = path_nodes[i], path_nodes[i+1] must_keep.add((min(u, v), max(u, v))) path_idx = {node: i for i, node in enumerate(path_nodes)} must_remove = [] flexible = [] for u in range(1, N + 1): for v in range(u + 1, N + 1): if (u, v) in must_keep: continue if u in path_idx and v in path_idx: must_remove.append((u, v)) else: flexible.append((u, v)) if M < len(must_remove) or M > len(must_remove) + len(flexible): print("No") return remove_edges = must_remove + flexible[:M - len(must_remove)] print("Yes") for u, v in remove_edges: print(f"{u} {v}") if __name__ == '__main__': solve()