#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, m, n) for(int i=int(m);i> N >> M; if( M > N*(N-1)/2 || M < N - 1){ cout << "NO" << endl; return 0; } if(N % 2 == 0){ if(M > ((N-1)/2)*((N-1)/2+1) ){ cout << "NO" << endl; return 0; } if(M > ((N-1)/2)*((N-1)/2+1) + (N-1)/2){ cout << "NO" << endl; return 0; } } vector a(N); if(N % 2){ int cnt = 0; rep(i,0,(N-1)/2+1){ // a.push_back(++cnt); a[2*i] = ++cnt; } cnt = 250000; rep(i,0,(N-1)/2){ // a.push_back(++cnt); a[2*i+1] = ++cnt; } }else{ int cnt = 0; rep(i,0,N/2){ // a.push_back(++cnt); a[2*i] = ++cnt; } cnt = 250000; rep(i,0,N/2){ // a.push_back(++cnt); a[2*i+1] = ++cnt; } } vector > vp; int dist = 1; int pt = 0; while(M > 0){ M--; if(pt + dist >= N){ pt = 0; dist += 2; } vp.emplace_back(pt,pt+dist); pt += dist; } cout << "YES" << endl; rep(i,0,N){ cout << a[i]; if(i == N-1) cout << endl; else cout << " "; } rep(i,0,vp.size()){ cout << vp[i].first + 1 << " " << vp[i].second + 1 << endl; } return 0; }