#include "redica.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> ve;
int n,k,s;
void dfs(int sum,int beg,int pos)
{
    /*for(auto i:ve)cout<<i<<" ";
    cout<<": ";
    cout<<sum<<" "<<beg<<" "<<pos<<endl;*/
    if(pos==n+1)
    {
        submit(ve);
        return;
    }
    if(sum<(n-pos+1)||sum>(n-pos+1)*k)return;
    if(pos==n)
    {
        if(sum>k)return;
        if(sum<0)return;
        ve.push_back(sum);
        dfs(0,sum,pos+1);
        ve.pop_back();
        return;
    }
    ve.push_back(beg);
    for(int i=1;i<=min(k,sum-beg-(n-pos+1));i++)
    {
        dfs(sum-beg,i,pos+1);
    }
    ve.pop_back();
}
void solve(int n, int k, int s)
{
    ::n=n;
    ::k=k;
    for(int i=1;i<=n-5;i++)
    {
        int ve=query();
        ::ve.push_back(ve);
        s-=ve;
    }
    for(int i=1;i<=k;i++)
    {
        if(i<=s)
        {
            dfs(s,i,max(n-4,1));
        }
    }
}
