#include "redica.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> st;
void solve(int n, int k, int s)
{
    for(int i=1;i<=n-3;i++)
    {
        int v=query();
        st.push_back(v);
        s-=v;
    }
    random_device rd;
    mt19937 rng(rd());
    uniform_int_distribution <int> d(1,k);
    while(1)
    {
        vector <int> v;
        int sum=0;
        for(int i=1;i<=min(n,3);i++)
        {
            int c=d(rng);
            sum+=c;
            if(sum>s)break;
            v.push_back(c);
        }
        if(sum==s)
        {
            vector <int> r;
            r=st;
            for(auto i:v)r.push_back(i);
            submit(r);
        }
    }
}
