#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(auto i = (a); i < (b); ++i)
#define REP(i,n) rep(i,0,n)
#define sz(v) ((int) (v).size())
#define rs resize
#define all(v) begin(v), end(v)

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(20);
    ll n, m;
    cin >> n >> m;
    vi a = vi(m), b = vi(m);
    bool kan = true;
    set<ll> gehad;
    for(ll i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        ll nu = a[i] * n + b[i];
        gehad.emplace(nu);
        nu = b[i] * n + a[i];
        if(gehad.count(nu) > 0)
            kan = false;
    }
    if(!kan)
    {
        cout <<  "NO" <<endl;
        return 0;
    }
    cout << "YES" << endl;
    cout << (2 * m) << endl;
    for(ll i = 0; i < m; i++){
        cout << (a[i] + 1) << " " <<(b[i] + 1);
        for(ll j = 0; j < n; j++) {
            if (j != a[i] && j != b[i])
                cout << " " << (j + 1);
        }
        cout << endl;
        for(ll j = n - 1; j >= 0; j--){
            if(j!= a[i] && j!= b[i])
                cout << (j + 1) << " ";
        }
        cout << (a[i] + 1) << " " << (b[i] + 1) <<endl;
    }
    return 0;
}