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

const long long MAXN = 307, MAXS = MAXN*MAXN, THR = 1;
long long n, k, s, a[MAXN];
vector<int> v;
long long dp[MAXN][MAXS];

void brute(long long pos, long long sum)
{
    if(sum > s)return;
    if(pos == n+1)
    {
        if(sum == s) submit(v);
        return;
    }
    for(long long i = 1; i <= k && i+sum <= s; i++)
    {
        v.push_back(i);
        brute(pos+1, sum+i);
        v.pop_back();
    }
    return;
}

void solve(int N, int K, int S)
{
    n = N;
    k = K;
    s = S;
    for(long long j = max(0LL, s-k); j <= min(k, s-1); j++)
    {
        dp[n][j] = 1;
    }
    for(long long i = n-1; i >= 1; i--)
    {
        for(long long j = 0; j <= s; j++)
        {
            for(long long jj = j+1; jj <= min(s, j+k); jj++)
            {
                dp[i][j] += dp[i+1][jj];
            }
        }
    }
    long long sum = 0;
    for(long long i = 0; i <= n; i++)
    {
        if(i == n)
        {
            for(int j = 1; j <= n; j++)
            {
                v.push_back(a[i]);
                submit(v);
                return;
            }
        }
        if(dp[i+1][sum] < 0) assert(false);
        if(dp[i+1][sum] <= THR)
        {
            brute(i+1, sum);
            break;
        }
        a[i+1] = query();
        sum += a[i+1];
    }
    return;
}
