#include "redica.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>V;
vector<int>ot;
int n,k,s,sum;
long long int fast(long long int base,long long int step)
{
    long long int w=base,lamp=0;
    base=1;
    for(int i=0;i<30;i++)
    {
        if(i&step)
        {
            if(lamp)return 1e18;
            base=base*w;
            if(base>=1e9)return 1e18;
        }
        w*=w;
        if(w>=1e9)lamp=1;
    }
    return base;
}
bool check()
{
    if((s-sum)-(n-ot.size())>=25&&n-ot.size()>=25)return false;
    if((s-sum)-(n-ot.size())<=25&&n-ot.size()<=25)
    {
        //cout<<22222<<endl;
        return true;
    }
    if(n-ot.size()<=3)return true;
    if(fast(n-ot.size(),k)<=1e8)
    {
        //cout<<1111<<endl;
        return true;
    }
    return false;
}
void rec(int step,int cur)
{
    if(step==n+1)
    {
        submit(V);
        return;
    }
    for(int i=max(1,s-cur-(n-step)*k);i<=k;i++)
    {
        if(cur+i+n-step>s)return;
        V.push_back(i);
        rec(step+1,cur+i);
        V.pop_back();
    }
}
void solve(int N, int K, int S)
{
    n=N;
    k=K;
    s=S;
    while(!check())
    {
        V.push_back(query());
        ot.push_back(V.back());
        sum+=ot.back();
    }
    //cout<<ot.size()<<endl;
    rec(ot.size()+1,sum);
}
