#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const long long mod = 1e9 + 7;
struct node {
  int l, r, lg;
  friend bool operator<(const node &a, const node &b) {
    if (a.lg == b.lg) return a.l > b.l;
    return a.lg < b.lg;
  }
  friend bool operator>(const node &a, const node &b) {
    if (a.lg == b.lg) return a.l < b.l;
    return a.lg > b.lg;
  }
};
bool cmp(node a, node b) {
  if (a.lg == b.lg) return a.l < b.l;
  return a.lg > b.lg;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    priority_queue<node> V;
    int n;
    cin >> n;
    int cnt = 1;
    int a[n + 5];
    memset(a, 0, sizeof(a));
    node tmp;
    tmp.l = 1, tmp.lg = n, tmp.r = n;
    V.push(tmp);
    int size = 1, sizetmp = 1;
    while (1) {
      size = sizetmp;
      sizetmp = 0;
      for (long long i = 0; i < size; ++i) {
        node linshi = V.top();
        V.pop();
        int ln = linshi.l, rn = linshi.r;
        int dif = rn - ln + 1, use;
        if (1 == dif % 2) {
          use = (ln + rn) / 2;
        } else {
          use = (ln + rn - 1) / 2;
        }
        if (a[use])
          continue;
        else
          a[use] = cnt++;
        if (use - 1 >= ln) {
          node nd;
          nd.l = ln;
          nd.r = use - 1;
          nd.lg = use - ln;
          V.push(nd);
          sizetmp++;
        }
        if (use + 1 <= rn) {
          node nd;
          nd.l = use + 1;
          nd.r = rn;
          nd.lg = rn - use;
          V.push(nd);
          sizetmp++;
        }
      }
      if (0 == sizetmp) break;
    }
    ++n;
    for (long long i = 1; i < n; ++i) cout << a[i] << " ";
    cout << endl;
  }
  return 0;
}
