#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double eps = 1e-9;   int n, m, l, r;   int main() {     int T, cas = 1, x = INF;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; ++i) {       scanf( %d%d , &l, &r);       x = min(x, r - l + 1);     }     printf( %d n , x);     for (int i = 1; i <= n; ++i) printf( %d%c , i % x, i == n ?   n  :    );     return 0;   }   