#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int T;
  cin >> T;
  while (T--) {
    long long int t, n, i, j, x, y, m, l, d, k, x1, y1;
    cin >> n;
    vector<pair<long long, long long> > v[n];
    long long int arr[n];
    long long int ans = 1;
    v[n - 1].push_back(make_pair(0, n - 1));
    for (int i = n - 1; i >= 0; i--) {
      sort(v[i].begin(), v[i].end());
      for (int j = 0; j < v[i].size(); j++) {
        x = v[i][j].first;
        y = v[i][j].second;
        d = (x + y) / 2;
        arr[d] = ans++;
        if (x != y) {
          x1 = d - 1;
          if (x1 >= x) v[x1 - x].push_back(make_pair(x, x1));
          y1 = d + 1;
          if (y1 <= y) v[y - y1].push_back(make_pair(y1, y));
        }
      }
    }
    for (int i = 0; i < (n); ++i) cout << arr[i] << ' ';
    cout << '\n';
  }
}
