#include <bits/stdc++.h>
using namespace std;
int n, d;
long long x;
const int temp = 100;
int a[100005], b[100005];
long long getNextX() {
  x = (x * 37 + 10007) % 1000000007;
  return x;
}
void initAB() {
  int i;
  int k = 0;
  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 big[300], b1[1000005];
void compute() {
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > n - temp) big[n - a[i]] = i;
    if (b[i] == 1) b1[count++] = i;
  }
  for (int i = 0; i < n; i++) {
    int ans = 0;
    for (int j = 0; j < temp; j++)
      if (big[j] <= i && b[i - big[j]]) {
        ans = a[big[j]];
        break;
      }
    if (!ans) {
      int j;
      for (int k = 0; k < count && b1[k] <= i; k++) {
        j = b1[k];
        ans = max(ans, a[i - j] * b[j]);
      }
    }
    cout << ans << endl;
  }
}
int main() {
  while (cin >> n >> d >> x) {
    initAB();
    int MAX = 0;
    if (n > temp)
      compute();
    else {
      for (int i = 0; i < n; i++) {
        int ans = 0;
        for (int j = 0; j <= i; j++) ans = max(ans, a[j] * b[i - j]);
        cout << ans << endl;
      }
    }
  }
  return 0;
}
