#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'

using namespace std;

const int N = 3e5 + 3;

int n, m, x, y;
bool used[51][51];
vector<vector<int> > ans;

void solve() {
    cin >> n >> m;
    bool f = true;
    for(int i = 1; i <= m; ++i) {
        cin >> x >> y;
        if(used[y][x]) {
            f = false;
        }
        used[x][y] = true;
        vector<int> p;
        p.pb(x);
        p.pb(y);
        for(int j = 1; j <= n; ++j) {
            if(j != x && j != y) {
                p.pb(j);
            }
        }
        ans.pb(p);
        p.clear();

        for(int j = n; j >= 1; --j) {
            if(j != x && j != y) {
                p.pb(j);
            }
        }
        p.pb(x);
        p.pb(y);
        ans.pb(p);
    }
    if(!f) {
        cout << "NO" << endl;
        return;
    }
    cout << "YES" << endl;
    cout << ans.size() << endl;
    for(int i = 0; i < ans.size(); ++i) {
        for(int j = 0; j < ans[i].size(); ++j) {
            cout << ans[i][j] << ' ';
        }
        cout << endl;
    }

}

main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    solve();
}