#include<iostream>
#include<algorithm>
using namespace std;
void Print(int b,int t) {
if (b % 2) {
int i = b / 2;
while (i >= 1) {
cout << t - i<<" ";
i--;
}
i = 1;
cout << t << " ";
while (i <= b / 2)
{
cout << t + i << " ";
i++;
}
cout << endl;
}
if (t % 2 && b - t / 2 > 0) {
int i = t / 2;
while (i>=1){
cout << b - i << " ";
i--;
}
i = 1;
cout << b << " ";
while (i<=t/2)
{
cout << b + i << " ";
i++;
}
cout << endl;
}
}
void Find(int s) {
int t = 2;
while (t<=sqrt(s))
{
if (s%t==0) {
int b = s / t;
Print(t,b);
}
t++;
}
}
int main() {
Find(24);
return 0;
}