//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define ent "\n"
#define int long long
#define f first
#define s second

const int maxn = 2e5 + 100;
const int inf = (int)1e9 + 100;
const ll INF = (ll)1e18;
const int MOD = 1e9 + 7;
const int maxl = 20;
const ll P = 31;

int n, m, k;
set<int> g[maxn];
int used[maxn];
int p[maxn];
int cnt;
vector<tuple<int, int, int>> ans;

void del(int a, int b){
    g[a].erase(b);
    g[b].erase(a);
}

void dfs(int v){
    used[v] = 1;
    while(g[v].size()){
        int to = *g[v].begin();
        del(to, v);
        if(!used[to]){
            p[to] = v;
            dfs(to);
        } else{
            vector<int> ord;
            ord.push_back(to);
            int u=v;
            while(v != to){
                if(!v) exit(0);
                ord.push_back(v);
                v = p[v];
                cnt++;
            }
            cnt++;
            del(to, v);
            while(ord.size() > 3){
                ans.push_back({ord[ord.size()-2], ord[0], ord.back()});
                ord.pop_back();
            }
            ans.push_back({ord[0], ord[1], ord[2]});
            v=u;
        }
    }
}

void test(){
    cin >> n >> m >> k;
    set<pii> s;
    for(int i = 1; i <= m; i++){
        int a, b;
        cin >> a >> b;
        if(a > b) swap(a, b);
        s.insert({a, b});
    }
    for(int i = 1; i <= k; i++){
        int a, b;
        cin >> a >> b;
        if(a > b) swap(a, b);
        if(s.count({a, b})) s.erase({a, b});
        else s.insert({a, b});
    }
    for(auto [a, b]: s){
        g[a].insert(b);
        g[b].insert(a);
    }
    for(int i = 1; i <= n; i++){
        if(!used[i]) dfs(i);
    }
    if(cnt != s.size()){
        cout << "NO\n";
        return;
    }
    cout << "YES\n"; cout << ans.size() << ent;
    for(auto [a, b, c]: ans) cout << a << ' ' << b << ' ' << c << ent;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t; t = 1;
    while(t--) test();
}
