#include <bits/stdc++.h>
using namespace std;
const int SZ = 100005;
int a[SZ], b[SZ];
int n, d;
long long x;
long long getNextX() {
  x = (x * 37 + 10007) % 1000000007;
  return x;
}
void initAB() {
  for (int i = 0; i < n; i = i + 1) {
    a[i] = i + 1;
  }
  for (int i = 0; i < n; i = i + 1) {
    swap(a[i], a[getNextX() % (i + 1)]);
  }
  for (int i = 0; i < n; i = i + 1) {
    if (i < d)
      b[i] = 1;
    else
      b[i] = 0;
  }
  for (int i = 0; i < n; i = i + 1) {
    swap(b[i], b[getNextX() % (i + 1)]);
  }
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> d >> x;
  initAB();
  set<pair<int, int> > s;
  vector<int> zz;
  for (int i = 0; i < n; i++) {
    s.insert({-a[i], i});
    if (b[i] == 1) zz.push_back(i);
    int ans = 0;
    bool flg = false;
    int cnt = 0;
    for (auto xx : s) {
      cnt++;
      if (b[i - xx.second]) {
        ans = -xx.first;
        flg = true;
        break;
      }
      if (flg || cnt >= 30) break;
    }
    if (!flg)
      for (int z : zz) ans = max(ans, a[i - z]);
    cout << ans << '\n';
  }
  return 0;
}
