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

int n, k, s;
int sum; vector<int>v;
void rec(){
    if(n - v.size() == s - sum){
        vector<int> v1 = v;
        int f = n - v.size();
        while(f--)v1.push_back(1);
        submit(v1);
    }
    if((n - v.size()) * k == s - sum){
        vector<int> v1 = v;
        int f = n - v.size();
        while(f--)v1.push_back(k);
        submit(v1);
    }

    for(int i = 1; i <= k; i++){
        if(sum + i > s)continue;
        sum += i; v.push_back(i);
        rec();
        sum -= i; v.pop_back();
    }
}

void solve(int N, int K, int S) {
    n = N; k = K; s = S;
    sum = 0;
    for(int i = 0; i < n / 4 * 3; i++){
        int curr = query();
        v.push_back(curr);
        s -= curr;
    }
    //submit(v);
    rec();
}
