#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
#include<unordered_set>
#include<unordered_map>
#include<queue>
#include<stack>
#include<deque>
using namespace std;
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()

int n, k, m, x;

struct Node {
	int l, r;
	Node() {}
	Node(int _l, int _r) : l(_l), r(_r) {}
	bool operator<(const Node& other) const {
		if (r < l) return false;
		if (other.r < other.l) return true;
		int len1 = (r - l) / 2;
		int len2 = (other.r - other.l) / 2;
		if (l == 1 || r == n) {
			len1 = r - l;
		}
		if (other.l == 1 || other.r == n) {
			len2 = other.r - other.l;
		}
		return  len1 > len2 || (len1 == len2 && l < other.l);
	}
	pair<Node, Node> split() const {
		if (l == 1) {
			return { Node(2, 0), Node(2, r) };
		}
		if (r == n) {
			return{ Node(n, n - 1), Node(l, n - 1)};
		}
		int len = (r - l) / 2;
		int m = l + len;
		return{ Node(l, m - 1), Node(m + 1, r) };
	}
};

void add(int x, set<int>& s) {
	if (s.find(x) != s.end()) {
		s.erase(x);
	}
	else {
		s.insert(x);
	}
}

void solve() {
	int n, m, k;
	cin >> n >> m >> k;
	vector<vector<int>> g1(n);
	vector<vector<int>> g2(n);
	for (int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		g1[u].push_back(v);
		g1[v].push_back(u);
	}
	for (int i = 0; i < k; ++i) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		g2[u].push_back(v);
		g2[v].push_back(u);
	}
	for (int i = 0; i < n; ++i) {
		if (g1[i].size() % 2 != g2[i].size() % 2) {
			cout << "NO\n";
			return;
		}
	}
	vector<set<int>> s(n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < g1[i].size(); ++j) {
			add(g1[i][j], s[i]);
		}
	}
	vector<vector<int>> ans;
	set<int> tmp;
	for (int i = 0; i < n; ++i) {
		tmp = s[i];
		for (int j = 0; j < g2[i].size(); ++j) {
			add(g2[i][j], tmp);
		}
		while (!tmp.empty()) {
			int v1 = *tmp.begin();
			tmp.erase(tmp.begin());
			int v2 = *tmp.begin();
			tmp.erase(tmp.begin());
			ans.push_back({ i, v1, v2 });
			add(v1, s[v2]);
			add(i, s[v2]);
			add(v2, s[v1]);
			add(i, s[v1]);
		}
	}
	cout << "YES\n";
	cout << ans.size() << "\n";
	for (auto& i : ans) {
		for (int& j : i) {
			cout << j + 1 << " ";
		}
		cout << "\n";
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}