#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10, MAX = 2e5 + 1e4, MOD = 1e9 + 7, MAXL = 25,
                z = 300;
void OUT(long double o, int x) {
  cout << fixed << setprecision(x) << o;
  return;
}
long long a[MAX], b[MAX], c[MAX], n, x, d;
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)]);
  }
}
vector<int> v, q;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> d >> x;
  initAB();
  for (int i = 0; i < n; i++) {
    if (a[i] > n - z) v.push_back(i);
    if (b[i] == 1) q.push_back(i);
    for (int u : v) c[i] = max(c[i], b[i - u] * a[u]);
    if (c[i] == 0)
      for (int u : q) c[i] = max(c[i], a[i - u]);
    cout << c[i] << "\n";
  }
  return 0;
}
