intfind(int x){ return f[x] ? f[x] = find(f[x]) : x; } intmain(){ cin >> n >> m >> p >> q; for(int i = m; i >= 1; --i) { int l = (i * p + q) % n + 1, r = (i * q + p) % n + 1; if(l > r) swap(l, r); l = find(l); while (l <= r) col[l] = i, l = f[l] = find(l + 1); } for(int i = 1; i <= n; ++i) printf("%d\n", col[i]); return0; }