#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

char ans[110][110];
int n;

bool isSpace(int x, int y){
  if(x < 0 || y < 0) return true;
  if(x >= n|| y >=n) return true;
  return ans[y][x] == ' ';
}

int main(){
  int d; cin>>d;
  int cc = 0;
  while(d --> 0){
    cin>>n;
    if(cc++ != 0) puts("");
    if(n == 1){
      puts("#");
    }else if(n == 2){
      puts("##");
      puts("# ");
    }else{
      const int dx[4] = {0,1,0,-1};
      const int dy[4] = {-1,0,1,0};
      memset(ans, '#', sizeof(ans));
      REP(i,n) ans[i][n] = '\0';
      int i = 0;
      int x = 1;
      int y = n-1;
      ans[y][x] = ' ';
      while(true){
        if(isSpace(x + dx[i], y + dy[i]) ||
           isSpace(x + dx[i] + dx[i], y + dy[i] + dy[i]))
          break;

        while(!isSpace(x + dx[i] + dx[i], y + dy[i] + dy[i])){
          x = x + dx[i]; y = y + dy[i];
          ans[y][x] = ' ';
        }

        i = (i + 1) % 4;
      }
      REP(i,n) puts(ans[i]);
    }
  }
  return 0;
}
### Prompt

Please provide a cpp coded solution to the problem described below:

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<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

char ans[110][110];
int n;

bool isSpace(int x, int y){
  if(x < 0 || y < 0) return true;
  if(x >= n|| y >=n) return true;
  return ans[y][x] == ' ';
}

int main(){
  int d; cin>>d;
  int cc = 0;
  while(d --> 0){
    cin>>n;
    if(cc++ != 0) puts("");
    if(n == 1){
      puts("#");
    }else if(n == 2){
      puts("##");
      puts("# ");
    }else{
      const int dx[4] = {0,1,0,-1};
      const int dy[4] = {-1,0,1,0};
      memset(ans, '#', sizeof(ans));
      REP(i,n) ans[i][n] = '\0';
      int i = 0;
      int x = 1;
      int y = n-1;
      ans[y][x] = ' ';
      while(true){
        if(isSpace(x + dx[i], y + dy[i]) ||
           isSpace(x + dx[i] + dx[i], y + dy[i] + dy[i]))
          break;

        while(!isSpace(x + dx[i] + dx[i], y + dy[i] + dy[i])){
          x = x + dx[i]; y = y + dy[i];
          ans[y][x] = ' ';
        }

        i = (i + 1) % 4;
      }
      REP(i,n) puts(ans[i]);
    }
  }
  return 0;
}
```