#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define endl '\n'
#define N 1000005
#define fi first
#define se second
#define pb push_back
using namespace std;
const int inf=0x3f3f3f3f;
const double ex=1e-7;
const int mod=1e9+7;
int gcd(int a ,int b){ return b ? gcd(b,a%b) : a ;}
typedef pair<int,int>PII;
priority_queue<int,vector<int>,greater<int> > q;
int a[N];
void solve()
{
int n;
cin >>n;
vector<int>v;
int len=ceil(sqrt(n));
int k=n;
for(int i=1;i<=n;i++)
{
v.pb(k--);
if((int)v.size()==len)
{
reverse(v.begin(),v.end());
for(auto it : v) cout <<it<<" ";
v.clear();
}
}
reverse(v.begin(),v.end());
for(auto it : v) cout <<it<<" ";
cout <<endl;
}
signed main()
{ios
int t;
cin >>t;
while(t--)
{
solve();
}
return 0;
}