n, m, k = map(int, input().split())

edges_original = set()
edges_changed = set()

for i in range(m):
    a, b = map(int, input().split())
    edges_original.add((a, b))
    edges_original.add((b, a))

for i in range(k):
    a, b = map(int, input().split())
    edges_changed.add((a, b))
    edges_changed.add((b, a))

if n != n or len(edges_original) != len(edges_changed) or len(edges_original.intersection(edges_changed)) != len(edges_original):
    print("NO")
else:
    actions = []

    for edge in edges_original:
        if edge not in edges_changed:
            a, b = edge
            for c in range(1, n + 1):
                if c != a and c != b:
                    actions.append((a, b, c))
                    actions.append((b, c, a))
    
    print("YES")
    print(len(actions))
    for action in actions:
        print(action[0], action[1], action[2])
