#include "redica.h"
#include <vector>
using namespace std;
int N;
void rec(int i, int k, int SUM, vector<int> &v)
{
    if (SUM < 0)
        return;
    if (i == N)
    {
        submit(v);
        return;
    }
    for (int j = 1; j <= k; ++j)
    {
        v.push_back(j);
        rec(i + 1, k, SUM - j, v);
        v.pop_back();
    }
}

void solve(int n, int k, int SUM)
{
    N = n;
    std::vector<int> v;
    rec(0, k, SUM, v);
    submit(v);
}