#include <bits/stdc++.h> using namespace std; using ll = long long; array<unordered_set<ll>, 55> adj; int main() { ll n, m; cin >> n >> m; ll a, b; for (int i = 0; i < m; i++) { cin >> a >> b; adj[a].insert(b); } vector<vector<ll>> u; for (int i = 1; i <= n; i++) { auto a = adj[i]; for (auto s: a) { if (adj[s].count(i)) { cout << "NO" << endl; return 0; } u.push_back({}); u.back().push_back(i); u.back().push_back(s); for (int j = 1; j <= n; j++) { if (j != i && j != s) u.back().push_back(j); } u.push_back({}); for (int j = n; j > 0; j--) { if (j != i && j != s) u.back().push_back(j); } u.back().push_back(i); u.back().push_back(s); } } cout << "YES" << endl << u.size() << endl; for (auto x: u) { for (auto y: x) cout << y << " "; cout << endl; } return 0; }