#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=1;j<=k&&s-j>=i-1;j+=1) {
        if (s-j<=(i-1)*k) {
            v.push_back(j);
            f(i-1, k, s-j);
            v.pop_back();
        }
    }
}

void solve(int n, int k, int s) {
    int d=9;
    if (n==30&&s-15<s&&s-15<30-s) d=6
    for (int i=0;i<n-d;i+=1) {
        v.push_back(query());
        s-=v.back();
    }
    f(min(n, d), k, s);
    return;
}