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

vector <int> v;

void f(int i=0, int k=0, int s=0) {
    if (i==1) {
        v.push_back(s);
        submit(v);
        v.pop_back();
        return;
    }
    for (int j=max(1, s-(i-1)*k);j<=min(k, s-(i-1));j+=1) {
        v.push_back(j);
        f(i-1, k, s-j);
        v.pop_back();
    }
}

void solve(int n, int k, int s) {
    for (n;n>0&&pow(min(k, s-(n-1))-max(1, s-(n-1)*k)+1, n-1)>100000000;n-=1) {
        v.push_back(query());
        s-=v.back();
    }
    f(n, k, s);
    return;
}