#include <bits/stdc++.h>

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

int main()
{
  rep(i, in()){
    int field[128][128] = {};
    int n = in();
    if (i != 0) puts("");
    rep(i, n + 1){
      field[0][i] = 1;
      field[n + 1][i] = 1;
      field[i][0] = 1;
      field[i][n + 1] = 1;
    }

    int x, y, d;
    x = 1;
    y = n;
    d = 0;
    while (1){
      field[y][x] = 2;
      int ny, nx;
      nx = x + dx[d];
      ny = y + dy[d];
      if (field[ny][nx] > 0){
        d = (d + 1) % 4;
        nx = x + dx[d];
        ny = y + dy[d];
        if (field[ny][nx] > 0){
          break;
        }
      }
      rep(i, 4){
        int nnx, nny;
        nnx = x + dx[i];
        nny = y + dy[i];
        if (nnx == nx && nny == ny) continue;
        if (field[nny][nnx] != 0) continue;
        field[nny][nnx] = 1;
      }
      x = nx;
      y = ny;
    }
    lep(i, n){
      lep(j, n){
        printf("%c", " #"[field[i][j] == 2]);
      }
      puts("");
    }
  }
  return 0;
}
### Prompt

Please formulate a CPP solution to the following problem:

I decided to create a program that displays a "round and round pattern". The "round and round pattern" is as follows.

* If the length of one side is n, it is displayed as a character string with n rows and n columns.
* A spiral pattern that rotates clockwise with the lower left corner as the base point.
* The part with a line is represented by # (half-width sharp), and the blank part is represented by "" (half-width blank).
* Leave a space between the lines.



Create a program that takes an integer n as an input and outputs a "round and round pattern" with a side length of n.



Input

The input is given in the following format:


d
n1
n2
::
nd


The number of datasets d (d ≤ 20) is given to the first line, and the side length ni (1 ≤ ni ≤ 100) of the i-th round pattern is given to each of the following d lines.

Output

Please output a round and round pattern for each data set. Insert a blank line between the datasets.

Example

Input

2
5
6


Output

#####
#   #
# # #
# # #
# ###

######
#    #
# ## #
# #  #
# #  #
# ####

### Response

```cpp
#include <bits/stdc++.h>

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
template<typename T> void show(T& a, char del='\n', char last='\n'){ rep(i, a.size() - 1) cout << a[i] << del; cout << a[a.size() - 1] << last; }

const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};

int main()
{
  rep(i, in()){
    int field[128][128] = {};
    int n = in();
    if (i != 0) puts("");
    rep(i, n + 1){
      field[0][i] = 1;
      field[n + 1][i] = 1;
      field[i][0] = 1;
      field[i][n + 1] = 1;
    }

    int x, y, d;
    x = 1;
    y = n;
    d = 0;
    while (1){
      field[y][x] = 2;
      int ny, nx;
      nx = x + dx[d];
      ny = y + dy[d];
      if (field[ny][nx] > 0){
        d = (d + 1) % 4;
        nx = x + dx[d];
        ny = y + dy[d];
        if (field[ny][nx] > 0){
          break;
        }
      }
      rep(i, 4){
        int nnx, nny;
        nnx = x + dx[i];
        nny = y + dy[i];
        if (nnx == nx && nny == ny) continue;
        if (field[nny][nnx] != 0) continue;
        field[nny][nnx] = 1;
      }
      x = nx;
      y = ny;
    }
    lep(i, n){
      lep(j, n){
        printf("%c", " #"[field[i][j] == 2]);
      }
      puts("");
    }
  }
  return 0;
}
```