#include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937_64 rnd(time(0));
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()

const ll N = 2e5 + 5;
const ll INF = 3e18;

vector<ll> a;
vector<set<ll>> g;

void dfs(ll v, ll st, ll x = 0) {
    if (g[v].empty()) {
        cout << "NO" << '\n';
        exit(0);
    }
    if (st == v && x == 1) return;

    a.push_back(v);
    ll to = *g[v].begin();
    // cout << v << " -> " << to << '\n';
    g[v].erase(to);
    g[to].erase(v);
    dfs(to, st, 1);
}
void solve() {
    ll n, m, k; cin >> n >> m >> k;
    vector<ll> cnt(n);
    map<pair<ll, ll>, ll> who;
    for (int i = 0; i < m; i++) {
        ll u, v; cin >> u >> v;
        u--; v--;
        cnt[u]++;
        cnt[v]++;
        who[{u, v}]++;
        who[{v, u}]++;
    }
    for (int i = 0; i < k; i++) {
        ll u, v; cin >> u >> v;
        u--; v--;
        cnt[u]--;
        cnt[v]--;
        who[{u, v}]++;
        who[{v, u}]++;
    }
    for (int i = 0; i < n; i++) {
        if (cnt[i] % 2 == 1) {
            cout << "NO" << '\n';
            return;
        }
    }
    cout << "YES" << '\n';
    g.resize(n);
    for (auto [x, y] : who) {
        if (y % 2 == 1) {
            g[x.first].insert(x.second);
            // cout << x.first << " " << x.second << '\n';
        }
    }
    vector<vector<ll>> ans;
    for (int i = 0; i < n; i++) {
        while (!g[i].empty()) {
            a.clear();
            dfs(i, i);
            for (int j = 1; j < (ll)a.size() - 1; j++) {
                ans.push_back({a[0] + 1, a[j] + 1, a[j + 1] + 1});
            }
        }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << '\n';
    }
}

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

    solve();

    return 0;
}