#include <bits/stdc++.h>
using namespace std;
int x;
int a[100010];
int b[100010];
int d, n;
int getNextX() {
  x = ((long long)x * 37 + 10007) % 1000000007;
  return x;
}
void initAB() {
  int i;
  for (i = 0; i < n; i = i + 1) {
    a[i] = i + 1;
  }
  for (i = 0; i < n; i = i + 1) {
    swap(a[i], a[getNextX() % (i + 1)]);
  }
  for (i = 0; i < n; i = i + 1) {
    if (i < d)
      b[i] = 1;
    else
      b[i] = 0;
  }
  for (i = 0; i < n; i = i + 1) {
    swap(b[i], b[getNextX() % (i + 1)]);
  }
}
int main() {
  cin >> n >> d >> x;
  initAB();
  set<pair<int, int> > all;
  vector<int> v;
  for (int i = 0; i < n; i++)
    if (b[i] == 1) v.push_back(i);
  bool type = 0;
  if (d < 800) {
    type = 1;
  }
  for (int i = 0; i < n; i++) {
    all.insert(make_pair(-a[i], i));
    int tmp = 0;
    if (type) {
      for (int j = 0; j < v.size(); j++) {
        if (v[j] <= i) {
          tmp = max(tmp, a[i - v[j]]);
        }
      }
    } else {
      int k = 800;
      for (__typeof((all).begin()) it = (all).begin(); it != (all).end();
           it++) {
        if (b[i - it->second] == 1) {
          tmp = -it->first;
          break;
        }
      }
    }
    cout << tmp << "\n";
  }
  return 0;
}
