#include<iostream>
#include<vector>
#include<set>
using namespace std;
vector<int> syote(100);
vector<int> lista(2023, 0);
set<int> loput_luvut;
int mika;
vector<int> v;
vector<int> p(2024, 0);
int summa;
bool loytynyt;
void haku() {
if (loytynyt) return;
if (v.size() > 43) return;
if (summa > mika) return;
if (v.size() == 43) {
int etsija = 42;
while (summa < mika) {
v[etsija]++;
summa++;
if (etsija == 0) etsija = 42;
else etsija--;
}
loytynyt = true;
}
if (summa == mika && v.size() == 43) {
for (int i = 0; i < 43; i++) {
lista[i] = v[i];
loput_luvut.insert(v[i]);
}
loytynyt = true;
}
else {
for (int i = 1; i <= 2023; i++) {
if (p[i] == 1) continue;
p[i] = 1;
summa += i;
v.push_back(i);
haku();
v.pop_back();
summa -= i;
p[i] = 0;
}
}
}
int main() {
mika = 0;
summa = 0;
loytynyt = false;
for (int i = 0; i < 100; i++) cin >> syote[i];
mika = syote[0];
haku();
for (int i = 0; i < 2023; i++) {
if (lista[i] > 0) continue;
for (int j = 1; j <= 2023; j++) {
if (loput_luvut.count(j) == 0) {
lista[i] = j;
loput_luvut.insert(j);
break;
}
}
}
for (int i = 0; i < 2023; i++) {
if (i != 2022) cout << lista[i] << " ";
else cout << lista[i];
}
}