#include "redica.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 300;
const int MAXS = 90000;
const int MAX = 1e6;

int dp[MAXN + 5][MAXS + 5];

void init(int n, int k) {
    dp[0][0] = 1;
    for (int len = 1; len <= n; len++) {
        int sum = 0;
        for (int s = len; s <= len * k; s++) {
            sum += dp[len - 1][s - 1];
            if (s - 1 - k >= 0) {
                sum -= dp[len - 1][s - 1 - k];
            }
            dp[len][s] = min(MAX + 1, sum);
        }
    }
}

void rec(int len, int sum, int k, vector <int> &v) {
    if (len == 0) {
        if (sum == 0) submit(v);
        return;
    }
    for (int x = 1; x <= k; x++) {
        int nxt_sum = sum - x;
        int nxt_len = len - 1;
        if (nxt_sum < 0 || dp[nxt_len][nxt_sum] == 0) continue;
        v.push_back(x);
        rec(nxt_len, nxt_sum, k, v);
        v.pop_back();
    }
}

void solve(int n, int k, int s) {
    init(n, k);
    int sum = s;
    vector <int> ret;
    for (int i = 1; i <= n; i++) {
        int rem_len = n - i + 1;
        if (dp[rem_len][sum] <= MAX) {
            rec(rem_len, sum, k, ret);
            return;
        }
        ret.push_back(query());
        sum -= ret.back();
    }
    submit(ret);
}
