#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pp pair<ll,ll>
template<class T> istream& operator>>(istream& is, vector<T>& arr) { for(auto& i:arr) is>>i; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& arr) { for(auto& i:arr) os<<i<<" "; return os;}


ll rec(ll w,ll h){
ll s = w*h;if(w<h) swap(w,h);if(w==1) return s;
return s+rec(w/2,h)+rec(w-w/2,h);
}


signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.precision(20);
map<pair<int, int>, bool>is_edge_1, is_edge_2;
vector<pair<int, int>>rev;
set<pair<int, int>>edges;
int n, m, k;
cin >> n >> m >> k;
for(int i = 0;i < m;i++)
{
    int v, u;
    cin>>v>>u;
    v--;u--;
    if(v > u){
        swap(v, u);
    }
    is_edge_1[{v, u}] = true;
    edges.insert({v, u});
}
for(int i = 0; i < k;i++){
    int v, u;
    cin>>v>>u;
    v--;u--;
    if(v > u){
        swap(v, u);
    }
    is_edge_2[{v, u}] = true;
    edges.insert({v, u});
}
for(auto e:edges){
    if(is_edge_1[e]^is_edge_2[e]){
        rev.push_back(e);
    }
}
vector<set<int>>gr(n);
vector<vector<int>>oper;
for(auto el:rev){
    int v = el.first;
    int u = el.second;
    gr[v].insert(u);
    gr[u].insert(v);
}
for(int i = 0;i < n;i++){
    if(gr[i].size() % 2 != 0){
        cout << "NO";
        return 0;
    }
}
for(int i = 0;i < n;i++){
    for(int it = 0;it < gr[i].size() / 2; it++){
            int a = i;
            int b = *gr[i].begin();
            gr[i].erase(gr[i].begin());
            int c = *gr[i].begin();
            gr[i].erase(gr[i].begin());
            oper.push_back({a + 1, b + 1, c + 1});
            gr[b].erase(a);
            gr[c].erase(a);
            if(gr[b].find(c) == gr[b].end()){
                gr[b].insert(c);
                gr[c].insert(b);
            }
            else{
                gr[b].erase(c);
                gr[c].erase(b);
            }
    }
}
cout << "YES" << '\n';
cout << oper.size() << '\n';
for(auto& el:oper){
    cout << el[0] << ' ' << el[1] << ' ' << el[2] << '\n';
}
return 0;
}
