for(i in(n=scan("stdin")):1)cat(rep(c(" ","Z"),"if"(i%%n<2,c(0,n),c(i-1,1)))," ",sep="")