# **********
# *        *
# *        *
# *        *
# *        *
# *        *
# *        *
# *        *
# *        *
# **********
i = int(raw_input(''))
n = 0
print('*')*i
n = 0
for n in range(0, i-2):
    print (('*')+(' ')*(i-2)+('*'))
n = 0
print('*')*i
