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

int n, k, s;
vector<int> v;
int cs;

void Rec()
{
    if (v.size() == n)
    {
        submit(v);
        return;
    }
    for (int i = 1; i <= k; i++)
    {
        if (cs + i > s)
            break;
        cs += i;
        v.push_back(i);
        Rec();
        cs -= i;
        v.pop_back();
    }
}

void solve(int nn, int kk, int ss)
{
    n = nn;
    k = kk;
    s = ss;
    for (int i = 0; i < min(n, 6); i++)
    {
        v.push_back(query());
        cs += v.back();
    }
    Rec();
}