#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, d;
long long x;
int a[N], b[N];
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) b[i] = (i < d);
  for (int i = 0; i < n; i = i + 1) swap(b[i], b[getNextX() % (i + 1)]);
}
const int RT = 500;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d >> x;
  initAB();
  if (d < RT) {
    vector<int> pos;
    for (int i = 0; i < n; i++) {
      if (b[i]) pos.push_back(i);
      int mx = 0;
      for (int idx : pos) mx = max(mx, a[i - idx]);
      cout << mx << " ";
    }
  } else {
    set<pair<int, int> > st;
    int cnt = 0;
    vector<int> out;
    for (int i = 0; i < n; i++) {
      st.insert(pair<int, int>(a[i], i));
      long long ans = 0;
      for (auto it = st.rbegin(); it != st.rend(); ++it) {
        int idx = it->second;
        if (b[i - idx]) {
          ans = it->first;
          break;
        }
      }
      cout << ans << " ";
    }
  }
}
