#include <bits/stdc++.h>
using namespace std;

const int N = 1e+5;

set<int> g[N];

inline void flip(int &x, int &y) {
    if (g[x].find(y) != g[x].end()) {
        g[x].erase(y);
        g[y].erase(x);
    } else {
        g[x].insert(y);
        g[y].insert(x);
    }
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    
    int n, m, m2;
    cin >> n >> m >> m2;
    set<int> g2[n];
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].insert(y);
        g[y].insert(x);
    }
    for (int i = 0; i < m2; i++) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        g2[x].insert(y);
        g2[y].insert(x);
    }

    for (int i = 0; i < n; i++)
        if ((g[i].size() & 1) != (g2[i].size() & 1)) {
            cout << "NO\n";
            return 0;
        }

    vector<tuple<int, int, int>> ans;
    set<int>flp;
    for (int i = 0; i < n; i++) {
        flp.clear();
        for (int j : g[i])
            if (g2[i].find(j) == g2[i].end())
                flp.insert(j);
        for (int j : g2[i])
            if (g[i].find(j) == g[i].end())
                flp.insert(j);
        int fp = -1;
        for (int f : flp) {
            if (fp == -1) {
                fp = f;
                continue;
            }
            flip(f, fp);
            flip(i, fp);
            flip(i, f);
            ans.push_back({i + 1, f + 1, fp + 1});
        }
    }

    cout << "YES\n" << ans.size() << "\n";
    for (auto [x, y, z] : ans)
        cout << x << " " << y << " " << z << "\n";
}
