n = int(input()) answers = [[0 for i in range(n)] for j in range(n)] def loop(value, index, size): global answers for i in range(index, index + size): answers[index][i] = value value += 1 for j in range(index + 1, index + size): answers[j][index + size - 1] = value value += 1 for i in range(index + size - 2, index - 1, -1): answers[index + size - 1][i] = value value += 1 for j in range(index + size - 2, index, -1): answers[j][index] = value value += 1 return value size = n value = 1 index = 0 while size >= 1: value = loop(value, index, size) index += 1 size -= 2 for answer in answers: answerStringList = list(map(lambda x: str(x).zfill(3), answer)) print(" ".join(answerStringList))