#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int a[MAXN], b[MAXN], c[MAXN];
int tb[MAXN];
int d, n;
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)]);
  }
}
struct node {
  int p, num;
  bool operator<(const node &t) const { return num > t.num; }
};
node nd[MAXN];
int main() {
  while (cin >> n >> d >> x) {
    initAB();
    int cnt = 10000000;
    for (int i = 0; i < n; i++) {
      nd[i].num = a[i];
      nd[i].p = i;
    }
    sort(nd, nd + n);
    int l = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] == 1) {
        tb[l++] = i;
      }
    }
    memset(c, -1, sizeof(c));
    for (int i = 0; i < n; i++) {
      int p = nd[i].p;
      for (int j = 0; j < l && cnt > 0; j++) {
        if (p + tb[j] < n && c[p + tb[j]] == -1) {
          c[p + tb[j]] = a[p];
        }
        cnt--;
      }
    }
    for (int i = 0; i < n; i++) {
      if (c[i] == -1) {
        c[i] = 0;
        for (int j = 0; j < l && i - tb[j] >= 0; j++) {
          c[i] = max(c[i], a[i - tb[j]] * b[tb[j]]);
        }
      }
      printf("%d\n", c[i]);
    }
  }
  return 0;
}
