#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;

    cout << "YES\n";
    cout << (2 * m) << '\n';
    for(int i = 0; i < m; ++ i) {
        int a, b;
        cin >> a >> b;

        // ab...
        cout << a << " " << b;
        for(int u = 1; u <= n; ++ u) {
            if(u != a && u != b) {
                cout << " " << u;
            }
        }
        cout << '\n';
        // ...[rev]ab
        for(int u = n; u >= 1; -- u) {
            if(u != a && u != b) {
                cout << u << " ";
            }
        }
        cout << a << " " << b << '\n';
    }
}