import java.io.*;
import java.util.*;

public class Spiral{
	
	public static void main(String[] args){
		try{
			File infile = new File("data4.txt");
			File outfile = new File("out4.txt");
			Scanner input = new Scanner(infile);
			PrintStream ps = new PrintStream(new FileOutputStream(outfile));
			int highest, arrayLength, arrayWidth, currentX, currentY, dir;
			String[][] pattern;
			boolean switchDir;
			for (int i=0; i<5;i++){
				highest = Integer.parseInt(input.nextLine());
				arrayLength = 1;
				arrayWidth = 1;
				while (arrayLength*arrayWidth<highest+1){
					if (arrayLength==arrayWidth){
						arrayLength++;
					} else {
						arrayWidth++;
					}
				}
				pattern = new String[arrayLength][arrayWidth];
				currentY = (arrayLength-1)/2;
				currentX = (arrayWidth-1)/2;
				dir=0;
				for (int j=0; j<arrayLength*arrayWidth;j++){
					if (j<=highest){
						pattern[currentY][currentX] = String.valueOf(j);
					} else {
						pattern[currentY][currentX] = ".";
					}
					if (j!=arrayLength*arrayWidth){
						switch (dir){
							case 0:
								if (currentY+1<arrayLength){
									currentY++;
									if (currentX+1<arrayWidth){
										if (pattern[currentY][currentX+1]==null){
											dir=1;
										}
									}
								}
								break;
							case 1:
								if (currentX+1<arrayWidth){
									currentX++;
									if (currentY>0){
										if (pattern[currentY-1][currentX]==null){
											dir=2;
										}
									}
								}
								break;
							case 2:
								if (currentY>0){
									currentY--;
									if (currentX>0){
										if (pattern[currentY][currentX-1]==null){
											dir=3;
										}
									}
								}
								break;
							default:
								if (currentX>0){
									currentX--;
									if (currentY+1<arrayLength){
										if (pattern[currentY+1][currentX]==null){
											dir=0;
										}
									}
								}
								break;
						}
					}
				}
				for (int a=0;a<arrayLength;a++){
					for (int b=0;b<arrayWidth;b++){
						ps.print(pattern[a][b]);
					}
					ps.println();
				}
			}
			input.close();
			ps.close();
		} catch (IOException e){
			e.printStackTrace();
		}
	}
}
