p00141 Spiral Pattern
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

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

######
#    #
# ## #
# #  #
# #  #
# ####
```python
vector = ((0, -1), (1, 0), (0, 1), (-1, 0))

def make_guruguru(d):
  lst = [["#"] * (d + 4)]
  for _ in range(d + 2):
    lst.append(["#"] + [" "] * (d + 2) + ["#"])
  lst.append(["#"] * (d + 4))
  x, y = 2, d + 1
  lst[y][x] = "#"
  direct = 0
  vx, vy = vector[0]
  cnt = 1
  while True:
    while lst[y + vy * 2][x + vx * 2] == " ":
      lst[y + vy][x + vx] = "#"
      y += vy
      x += vx
      cnt += 1
    if cnt <= 1:
      break
    direct = (direct + 1) % 4
    vx, vy = vector[direct]
    cnt = 0
  for y in range(2, d + 2):
    print("".join(lst[y][2:-2]))

n = int(input())
make_guruguru(int(input()))
for _ in range(n - 1):
  print()
  make_guruguru(int(input()))

```