b=input() r=range R=r(1,b) T=r(48,58)+r(65,91) for i in R:print''.join(' %c%%c'%([32]+T[1:])[i*j/b]%T[i*j%b]for j in R)