#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

//@formatter:off
template<typename T> istream &operator>>(istream &is, vector<T> &vec);
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec);
//@formatter:on

struct hash_pair {
	template<class T1, class T2>
	size_t operator()(const pair<T1, T2> &p) const {
		auto hash1 = hash<T1>{}(p.first);
		auto hash2 = hash<T2>{}(p.second);

		if (hash1 != hash2) {
			return hash1 ^ hash2;
		}

		return hash1;
	}
};

const int N = 1e5 + 5;
set<int> g[N];

void k(int a, int b) {
	if (g[a].count(b)) g[a].erase(b);
	else g[a].insert(b);

}

void d(int a, int b, int c) {
	k(a, b);
	k(a, c);
	k(b, a);
	k(b, c);
	k(c, a);
	k(c, b);
}

signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#endif
	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<int, int> > g1, g2;
	for (int i = m; i--; ) {
		int u, v;
		cin >> u >> v;

		if (u > v) swap(u, v);

		g1.push_back({u, v});
	}

	for (int i = k; i--; ) {
		int u, v;
		cin >> u >> v;

		if (u > v) swap(u, v);

		g2.push_back({u, v});
	}

	std::sort(g1.begin(), g1.end());
	std::sort(g2.begin(), g2.end());

	vector<pair<int, int> > eng;
	set_symmetric_difference(g1.begin(), g1.end(), g2.begin(), g2.end(), back_inserter(eng));

	if (n == 3 and eng.size() % 3 != 0) {
		cout << "NO\n";
		return 0;
	}

	//    for (auto [x, y]: eng) cout << x << ' ' << y << '\n';

	for (auto [u, v]: eng) {

		g[u].insert(v);
		g[v].insert(u);
	}

	vector<tuple<int, int, int> > res;

	for (int i = 1; i <= n; ++i) {
		while (g[i].size() > 1) {
			int a = i;
			int b = *g[i].begin();
			g[i].erase(b);
			int c = *g[i].begin();
			g[i].insert(b);
			d(a, b, c);

			res.push_back({a, b, c});
		}

		if (g[i].size() == 1) {
			int a = i;
			int b = i + 1, c = i + 2;
			if (c > n) {
				cout << "NO\n";
				return 0;
			}
			d(a, b, c);
			res.push_back({a, b, c});
		}
	}

	cout << "YES\n";
	сout << res.size() << '\n';
	for (auto [x, y, z]: res) {
		cout << x << ' ' << y << ' ' << z << '\n';
	}
}

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
	for_each(vec.begin(), vec.end(), [&](auto &i) { is >> i; });
	return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for_each(vec.begin(), vec.end(), [&](auto &i) { os << i << ' '; });
	return (os << '\n');
}