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

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

void Rec()
{
    if (cs + (n - sz) * k < s)
        return;
    if (sz == n)
    {
        submit(v);
        return;
    }
    for (int i = 1; i <= k; i++)
    {
        if (cs + i > s)
            break;
        cs += i;
        v[sz++] = i;
        Rec();
        cs -= i;
        sz--;
    }
}

void solve(int nn, int kk, int ss)
{
    n = nn;
    k = kk;
    s = ss;
    sz = cs = 0;
    v.resize(n);
    int op = 0;
    if (n <= 7)
        op = 0;
    if (n > 7 && n <= 15)
    {
        op = 7;
        if (k <= 10)
            op = 5;
    }
    if (n > 15 && n <= 30)
    {
        op = 25;
        if (k <= 66)
            op = 25;
        if (k == 2)
            op = 3;
    }
    if (n > 30 && n <= 67)
        op = n - 4;
    if (n > 67 && n <= 300)
    {
        op = n - 4;
    }
    for (int i = 0; i < min(n, op); i++)
    {
        v[sz++] = query();
        cs += v[sz - 1];
    }
    Rec();
}