#include <bits/stdc++.h>
using namespace std;
using ll = long long;

using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int ,int>;
using vpii = vector<pair<int, int>>;
using pipii = pair<int, pii>;

int p[100];
void solve() {
    int n, m, a, b;
    cin >> n >> m;
    cout << "YES\n" << m * 2 << endl;
    for (int i = 1; i <= n; i++) p[i] = i;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;

        for(int j = 1; j <= n; j++) {
            if(j != a && j != b) cout << j << ' ';
        }
        cout << a << ' ' << b << ' ' << endl;
        cout << a << ' ' << b << ' ';
        for(int j = n; j >= 1; j--) {
            if(j != a && j != b) cout << j << ' ';
        }
        cout << endl;


        // for (int i = 1; i <= n; i++) cout << p[i] << ' ';
        // cout << endl;
        // swap(p[a], p[b]);
        // for (int i = n; i >= 1; i--) cout << p[i] << ' ';
        // cout << endl;
        // if (a < b) swap(p[a], p[b]);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}