#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
const int N = 1e5 + 3;
int n, d, x, c[N], a[N], b[N];
int getX() {
  x = (x * 37LL + 10007) % 1000000007;
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> d >> x;
  for (int i = (0); i <= (n - 1); ++i)
    a[i] = i + 1, swap(a[i], a[getX() % (i + 1)]);
  for (int i = (0); i <= (n - 1); ++i) {
    if (i < d) b[i] = 1;
    swap(b[i], b[getX() % (i + 1)]);
  }
  set<pair<int, int> > s;
  s.insert({-a[0], 0});
  vector<int> pos;
  c[0] = a[0] * b[0];
  if (b[0]) pos.emplace_back(0);
  for (int i = (1); i <= (n - 1); ++i) {
    if (b[i]) pos.emplace_back(i);
    s.insert({-a[i], i});
    if (((int)(pos).size()) > 100) {
      for (auto &v : s)
        if (b[i - v.second]) {
          c[i] = -v.first;
          break;
        }
    } else {
      for (int v : pos) c[i] = max(c[i], a[i - v]);
    }
  }
  for (int i = (0); i <= (n - 1); ++i) cout << c[i] << '\n';
  return 0;
}
