#include <bits/stdc++.h>
#include "books.h"
#define int long long
const int inf = 1e18 + 10;
using namespace std;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
// books.h books.cpp grader.cpp
// in a single folder and run:
// g++ books.cpp grader.cpp
// in this folder.
//
void solve(signed n, signed k, long long A, signed s) {
vector<int> a(n); for (int i = 0; i < n; i++) a[i] = skim(i + 1);
multiset<pair<int, int>> b;
b.insert({inf, -1});
for (int i = 0; i < n; i++) b.insert({a[i], i});
for (int i = 0; i < n; i++) {
b.erase({a[i], i});
for (int j = i + 1; j < n; j++) {
b.erase({a[j], j});
int sum = a[j] + a[i];
int exp = A - sum;
auto [guy, idx] = *b.lower_bound({exp, 0});
if (A <= sum + guy && sum + guy <= 2 * A) {
vector<signed> ans;
ans.push_back(i + 1);
ans.push_back(j + 1);
ans.push_back(idx + 1);
answer(ans);
return;
}
b.insert({a[j], j});
}
b.insert({a[i], i});
}
impossible();
}