#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v;
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
int n;cin>>n;
int k = sqrt(n);
if(k*k<n)k++;
vector<int> tmp;
for(int i = 1;i<=n;i++) {
tmp.push_back(i);
if(i%k==0){
v.push_back(tmp);
tmp.clear();
}
}
if(tmp.size())v.push_back(tmp);
reverse(v.begin(),v.end());
for(int i = 0;i<v.size();i++) {
for(int j = 0;j<v[i].size();j++)cout<<v[i][j]<<" ";
}
}