#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <bitset>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <vector>
#define fir first
#define sec second

template<typename T>
bool rMin(T& a, const T& b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool rMax(T& a, const T& b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}


using namespace std;

vector<vector<int>> gr;
vector<pair<pair<int, int>, int>> ans;

void solve(){
    int qv, qr1, qr2, v1, v2;
    cin >> qv >> qr1 >> qr2;
    gr.assign(qv + 1, {});
    while(qr1--){
        cin >> v1 >> v2;
        gr[v1].push_back(v2);
        gr[v2].push_back(v1);
    }
    while(qr2--){
        cin >> v1 >> v2;
        gr[v1].push_back(v2);
        gr[v2].push_back(v1);
    }

    for(auto &i : gr) if(i.size() % 2 != 0) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";

    for(int i = 1; i < qv; ++i){
        for(auto t : gr[i]){
            if(t != qv && t > i){
                ans.emplace_back(make_pair(i, t), qv);
            }
        }
    }
    cout << ans.size() << '\n';
    for(auto &i : ans){
        cout << i.fir.fir << ' ' << i.fir.sec << ' ' << i.sec << '\n';
    }
}

int main(){
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t = 1;

    //cin >> t;

    for(int i = 0; i < t; ++i){
        solve();
    }
}