#include <bits/stdc++.h>
using namespace std;
struct cmp {
  bool operator()(const pair<int, int> &a, const pair<int, int> &b) const {
    int la = a.second - a.first;
    int lb = b.second - b.first;
    if (la == lb)
      return a.first < b.first;
    else
      return la > lb;
  }
};
void solve() {
  int n;
  cin >> n;
  set<pair<int, int>, cmp> st;
  vector<int> ans(n + 1);
  int cnt = 1;
  st.insert(make_pair(1, n));
  while (cnt < n) {
    pair<int, int> cur = *st.begin();
    st.erase(st.begin());
    int id = cur.second - cur.first;
    int nid;
    if (id & 1) {
      nid = (cur.first + cur.second - 1) / 2;
      ans[nid] = cnt;
    } else {
      nid = (cur.first + cur.second) / 2;
      ans[nid] = cnt;
    }
    if (cur.first < nid) st.insert(make_pair(cur.first, nid - 1));
    if (cur.second > nid) st.insert(make_pair(nid + 1, cur.second));
    cnt++;
  }
  for (auto i = ans.begin() + 1; i != ans.end(); i++) {
    if (*i == 0)
      cout << n << " ";
    else
      cout << *i << " ";
  }
  cout << "\n";
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
