#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<iomanip>
using namespace std;
using ll = long long;
using db = double;

vector<set<int>> gm, gk, gd;
vector<tuple<int, int, int>> ans;
vector<bool> used;

bool dfs(int v)
{
    used[v] = true;
    if (gd[v].size() % 2 == 1)
    {
        return false;
    }
    while (!gd[v].empty())
    {
        int u1 = *gd[v].begin();
        gd[v].erase(gd[v].begin());
        int u2 = *gd[v].begin();
        gd[v].erase(gd[v].begin());

        gd[u1].erase(v);
        gd[u2].erase(v);


        if (gm[v].find(u1) == gm[v].end())
        {
            gm[v].insert(u1);
            gm[u1].insert(v);
        }
        else
        {
            gm[v].erase(u1);
            gm[u1].erase(v);
        }

        if (gm[v].find(u2) == gm[v].end())
        {
            gm[v].insert(u2);
            gm[u2].insert(v);
        }
        else
        {
            gm[v].erase(u2);
            gm[u2].erase(v);
        }

        if (gm[u1].find(u2) == gm[u1].end())
        {
            gm[u1].insert(u2);
            gm[u2].insert(u1);
        }
        else
        {
            gm[u1].erase(u2);
            gm[u2].erase(u1);
        }

        if (gd[u1].find(u2) == gd[u1].end())
        {
            gd[u1].insert(u2);
            gd[u2].insert(u1);
        }
        else
        {
            gd[u1].erase(u2);
            gd[u2].erase(u1);
        }

        ans.push_back({ v,u1,u2 });
    }

    for (int u : gm[v])
    {
        if (!used[u] && !dfs(u)) return false;
    }
    return true;
}

void solve()
{
    int n, m, k;
    cin >> n >> m >> k;
    gm.resize(n);
    gk.resize(n);
    gd.resize(n);
    for (int i = 0; i < m; i++)
    {
        int v, u;
        cin >> v >> u;
        v--; u--;
        gm[v].insert(u);
        gm[u].insert(v);
    }
    for (int i = 0; i < k; i++)
    {
        int v, u;
        cin >> v >> u;
        v--; u--;
        gk[v].insert(u);
        gk[u].insert(v);
        if (gm[v].find(u) == gm[v].end())
        {
            gd[v].insert(u);
            gd[u].insert(v);
        }
    }
    for (int v = 0; v < n; v++)
    {
        for (auto u : gm[v])
        {
            if (gk[v].find(u) == gk[v].end())
            {
                gd[v].insert(u);
                gd[u].insert(v);
            }
        }
    }

    used.resize(n);
    ans.reserve(1e5 + 1);

    if (dfs(0))
    {
        cout << "YES\n";
        cout << ans.size() << '\n';
        for (auto [v, u1, u2] : ans)
        {
            cout << v + 1 << ' ' << u1 + 1 << ' ' << u2 + 1 << '\n';
        }
    }
    else
    {
        cout << "NO\n";
    }
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0)->sync_with_stdio(0);
    int t = 1;
    //cin>>t;
    while (t--) {
        solve();
    }
}