#include <bits/stdc++.h>
using namespace std;
ifstream fin("ambuscada2.in");
ofstream fout("ambuscada2.out");
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<int> p(n);
    iota(p.begin(), p.end(), 1);
    bool isGood = false;
    while (!isGood) {
      isGood = true;
      for (int i = 0; isGood && i < n; ++i) {
        for (int j = i; isGood && j < n; ++j) {
          int ors = 0;
          for (int k = i; isGood && k <= j; ++k) {
            ors = ors | p[k];
          }
          if (ors >= j - i + 1) {
          } else {
            isGood = false;
            swap(p[i], p[n - 1 - j]);
          }
        }
      }
      for (int elem : p) {
        cout << elem << ' ';
      }
      cout << '\n';
    }
  }
  return 0;
}
