#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>

using namespace std;

#define inf (int)1e9
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")

#define N (int)2e5

vector<vector<int>> g, secondg;
vector<vector<int>> cycles;
bitset<N> red, black;
void delEdge(int from, int to) {
    for (auto &elem : g[from]) {
        if (elem == to) elem = -1;
    }
}

int dosmt(int from, int to) {
    delEdge(from, to);
    delEdge(to, from);
}
bool ans = true;

int globalStart;
int dfs(int start, int prev = -1) {
    if (red[start]) {
        return start;
    }
    red[start] = true;
    for (auto &elem : g[start]) {
//        cout << "going from " << start << " to " << elem << endl;
        if (elem == -1 || elem == prev) continue;
        int response = dfs(elem, start);
        if (!ans) return 0;
        delEdge(elem, start);
        elem = -1;

//        cout << "resp " << response << endl;
        cycles[response].push_back(start);
        if (start == response) continue;
        red[start] = false;
        return response;
    }
    if (globalStart != start) ans = false;
    return 0;
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n, m, k;
    cin >> n >> m >> k;
    int a, b;
    g.assign(n, {});
    cycles.assign(n, {});
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < k; i++) {
        cin >> a >> b;
        a--;
        b--;
        bool flag = true;
        for (auto &elem : g[a]) {
            if (elem == b) {
                elem = -1;
                flag = false;
            }
        }
        if (flag) g[a].push_back(b);
        swap(a, b);
        flag = true;
        for (auto &elem : g[a]) {
            if (elem == b) {
                elem = -1;
                flag = false;
            }
        }
        if (flag) g[a].push_back(b);
    }
////    cout << endl;
////    for (int i = 0; i < n; i++) {
//        cout << i << ": ";
//        for (auto elem : g[i]) cout << elem << ' ';
//        cout << endl;
//    }
    for (int i = 0; i < n && ans; i++) {
        if (black[i]) continue;
        black[i] = true;
        globalStart = i;
        dfs(i);
    }
    if (!ans) {
        cout << "NO";
        return 0;
    }
    cout << "YES" << endl;
    int fix;
    int cnt = 0;
    for (auto  v : cycles) if (!v.empty()) cnt++;
    cout << cnt << endl;
    for (auto &v : cycles) {
        if (v.empty()) continue;
        for (int i = 0; i < v.size()-1; i++) {
            if (i == 0) fix = v[0];
            else {
                cout << fix + 1 << ' ' << v[i] + 1 << ' ' << v[i+1] + 1 << endl;
            }
        }
    }

    return 0;
}
