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

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

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

actions = []

for a in range(1, n + 1):
    for b in range(a + 1, n + 1):
        for c in range(b + 1, n + 1):
            if ((a, b) in original_edges and (b, c) in original_edges and (a, c) not in original_edges) or \
               ((a, b) not in original_edges and (b, c) in original_edges and (a, c) in original_edges) or \
               ((a, b) in original_edges and (b, c) not in original_edges and (a, c) in original_edges):
                actions.append((a, b, c))

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