import sequtils,strutils,algorithm,math,sugar,macros,strformat proc get(n:int): string = var res = newSeqWith(n,newSeqWith(n,0)) var dx = 1 var dy = 0 var dir = 0 const dirs = [(1,0),(0,1),(-1,0),(0,-1)] var x = 0 var y = 0 for i in 1..= 0 and ny >= 0 and nx < n and ny < n and res[nx][ny] == 0: x = nx y = ny break else: dir = (dir + 1) mod 4 (dx,dy) = dirs[dir] res[x][y] = n*n result = "" for x in 0..