#include <bits/stdc++.h>
using namespace std;
long long po(long long a, long long x, long long m) {
  if (x == 0) {
    return 1;
  }
  long long ans = 1;
  long long k = 1;
  while (k <= x) {
    if (x & k) {
      ans = ((ans * a) % m);
    }
    k <<= 1;
    a *= a;
    a %= m;
  }
  return ans;
}
class comp {
 public:
  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.first < b.first;
    }
    return a.second.first > b.second.second;
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n == 1) {
      cout << "1\n";
      continue;
    }
    priority_queue<pair<long long, pair<long long, long long>>,
                   vector<pair<long long, pair<long long, long long>>>, comp>
        q;
    q.push(make_pair(n, make_pair(0, n - 1)));
    long long cnt = 1;
    long long a[n];
    while (!q.empty() && cnt <= n) {
      pair<long long, pair<long long, long long>> temp = q.top();
      q.pop();
      long long x = temp.second.first, y = temp.second.second;
      if ((y - x + 1) % 2 == 1) {
        a[(x + y) / 2] = cnt++;
        long long tot = (x + y) / 2;
        if (x <= tot - 1) {
          long long k = tot - 1 - x + 1;
          q.push(make_pair(k, make_pair(x, tot - 1)));
        }
        if (tot + 1 <= y) {
          long long k = y - (tot + 1) + 1;
          q.push(make_pair(k, make_pair(tot + 1, y)));
        }
      } else {
        a[(x + y - 1) / 2] = cnt++;
        long long tot = (x + y - 1) / 2;
        if (x <= tot - 1) {
          long long k = tot - 1 - x + 1;
          q.push(make_pair(k, make_pair(x, tot - 1)));
        }
        if (tot + 1 <= y) {
          long long k = y - (tot + 1) + 1;
          q.push(make_pair(k, make_pair(tot + 1, y)));
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      cout << a[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
