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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    ll n, m;
    cin >> n >> m;
    vector<vi> edges(n);
    rep(i, 0, m) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        edges[x].push_back(y);
        bool t = false;
        for (auto z : edges[y]) t |= z == x;
        if (t) {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    printf("%lld\n", 2 * m);
    rep(x, 0, n) for (ll y : edges[x]) {
        printf("%d %lld ", x + 1, y + 1);
        rep(i, 0, n) if (i != x && i != y) printf("%d ", i + 1);
        printf("\n");
        for (int i = n - 1; i >= 0; i--) if (i != x && i != y) printf("%d ", i + 1);
        printf("%d %lld ", x + 1, y + 1);
        printf("\n");
    }
}