n, m, k = map(int, input('n, m, k: ').split())
o_g = {}
ch_g = {}
for i in range(m):
    u, v = map(int, input('u, v: ').split())
    o_g[(u, v)] = True
for i in range(k):
     u, v = map(int, input('u, v: ').split())
     ch_g[(u, v)] = True
a = []
for (u, v) in o_g:
    if (u, v) not in ch_g:
        a.append((u, v, u))
for (u, v) in ch_g:
    if (u, v) not in o_g:
        a.append((u, v, u))
        ch_g[(u, v)] = True
if len(a) > 2 * 10 ** 5:
    print('No')
else:
    print('Yes')
    print(len(a))
    for i in a:
        print(i[0], i[1], i[2])
