fun main(){
val x = readLine()!!.toInt()
var i = 0
while (i < x) {
var j = 0
while (j < x) {
if (i == 0 || i == x-1){
print("*")
}
else{
if (j == 0 || j == x - 1){
print("*")
}
else
print(" ")
}
j++
}
println()
i++
}
}