while True:
try:
num = int(input())
for i in range(num):
if i == 0 or i == num - 1:
print("* " * num)
else:
print("*" + " " * ((num - 2)*2+1) + "*")
except:
break