#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin>>n;
switch(n) {
case 3: cout<<1<<" "<<2<<endl<<2; break;
case 4: cout<<1<<" "<<3<<endl<<3; break;
default:
int i, j;
vector<int> res;
for(j = 2, i = 2; j <= n; i++, j += i)
res.push_back(i);
int num = n - j + i;
i = 0;
while(num > 0) {
if(i == res.size() - 1) {
res[i]++;
num--;
i = 0;
}
else if(res[i] + 1 != res[i + 1]) {
res[i]++;
num--;
}
else i++;
}
vector<int> ans = {res[0]};
for(i = 1; i < res.size(); ++i) {
for(j = 0; j < ans.size(); ++j)
ans[j] *= res[i];
for(j = 0; j < ans.size(); ++j) {
if(j == ans.size() - 1 && ans[j] >= 10) ans.push_back(0);
ans[j + 1] += ans[j] / 10;
ans[j] %= 10;
}
}
for(auto e: res) cout<<e<<" ";
cout<<endl;
for(i = ans.size() - 1; i >= 0; --i) cout<<ans[i];
}
return 0;
}