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

original_edges = set()
for _ in range(m):
    u, v = map(int, input().split())
    original_edges.add((u, v))

new_edges = set()
for _ in range(k):
    u, v = map(int, input().split())
    new_edges.add((u, v))

deleted_edges = original_edges - new_edges

actions = []

for u, v in deleted_edges:
    for a in range(1, n+1):
        for b in range(1, n+1):
            for c in range(1, n+1):
                if a != b and a != c and b != c:
                    if ((a, b) in new_edges and (b, c) in new_edges and (a, c) not in new_edges) or \
                       ((a, b) in new_edges and (b, c) not in new_edges and (a, c) in new_edges) or \
                       ((a, b) not in new_edges and (b, c) in new_edges and (a, c) in new_edges):
                        actions.append((a, b, c))

if actions:
    print("YES")
    print(len(actions))
    for a, b, c in actions:
        print(a, b, c)
else:
    print("NO")
