while 1:n=input();j=0;exec 4*n*'u=" _"[j%n==n-1 and j/n<3]*n;print(" |"[j/n==1]+u+"|"+u+" |"[j/n==2]).rstrip();j+=1;'