#include <bits/stdc++.h>
using namespace std;
vector<long long> x;
struct custom {
  bool operator()(pair<long long, pair<long long, long long> > a,
                  pair<long long, pair<long long, long long> > b) {
    if (a.first == b.first) {
      return a.second.first > b.second.first;
    }
    return a.first < b.first;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a;
  cin >> a;
  for (long long i = 0; i < a; i++) {
    long long b;
    cin >> b;
    priority_queue<pair<long long, pair<long long, long long> >,
                   vector<pair<long long, pair<long long, long long> > >,
                   custom>
        q;
    q.push({b, {1, b}});
    x = vector<long long>(b + 1, 0);
    long long ind = 1;
    while (!q.empty()) {
      pair<long long, pair<long long, long long> > y = q.top();
      q.pop();
      long long r = y.first;
      long long s = y.second.first;
      long long t = y.second.second;
      if (r == 0) {
        continue;
      }
      if (r == 1) {
        x[s] = ind;
      } else {
        long long mid = (s + t) / 2;
        x[mid] = ind;
        q.push({(r & 1) ? r / 2 : r / 2 - 1, {s, ((s + t) / 2) - 1}});
        q.push({r / 2, {((s + t) / 2) + 1, t}});
      }
      ind++;
    }
    for (long long i = 1; i <= b; i++) {
      cout << x[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
