#include "redica.h"

/**
____    ____    ____    __________________    ____    ____    ____
||I ||  ||c ||  ||e ||  ||                ||  ||M ||  ||a ||  ||n ||
||__||  ||__||  ||__||  ||________________||  ||__||  ||__||  ||__||
|/__\|  |/__\|  |/__\|  |/________________\|  |/__\|  |/__\|  |/__\|

*/

#include <iostream>

#define maxn 200005
#define maxlog 21
#define PB push_back
#define X first
#define Y second
#define control cout<<"passed"<<endl;

typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, ll> pil;
typedef std::pair<ll, int> pli;
typedef long double ld;

//#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
//#pragma GCC target("avx2")


const ll mod = 1e9 + 7;
const ll INF = 4e18;
const double eps = 1e-12;


std::vector <int> curr;
void gen(int pos , int reml , int rems , int n , int k)
{
    if (reml == 0)
    {
        submit(curr);
        return;
    }

    for (int val = std::max(1 , rems - (reml - 1) * k); val <= std::min(k , rems - (reml - 1)); val++)
    {
        curr[pos] = val;
        gen(pos + 1 , reml - 1 , rems - val , n , k);
    }
}



void solve(int n, int k, int s)
{

    std::vector <std::vector <int>> dp(n + 1 , std::vector <int> (s + 1 , 0));
    dp[0][0] = 1;

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= std::min(s , i * k); j++)
        {
            ll pom = 0;

            for (int val = std::max(1 , j - (i - 1) * k); val <= std::min(k , j - (i - 1)); val++)
            {
                pom += dp[i - 1][j - val];
                pom = std::min(pom , (ll)(1e5 + 1));
            }

            dp[i][j] = pom;
        }

    curr.assign(n , 0);
    int reml = n , rems = s;

    for (int i = 0; i < n; i++)
    {
        if (rems >= reml && rems <= reml * k)
        {
            if (dp[reml][rems] <= (int)1e5)
            {
                gen(i , reml , rems , n , k);
                return;
            }
        }

        int pom = query();
        curr[i] = pom;
        reml--;
        rems -= pom;
    }

    submit({});
}