public class Test11 {
	public static void main(String[] args) {
		int i, j, k, nmg;
		int a[][] = new int[5][5];
		i = k = 0;
		j = 5 / 2;
		do
		{
			k++;
			a[i][j] = k;
			nmg = k - k / 5 * 5;
			if (nmg == 0)
				i++;
			else
			{
				i--;
				j++;
				if (i < 0)
					i = 4;
				if (j > 4)
					j = 0;
			}
		} while (k < 25);
		for (int x = 0; x <= 4; x++)
		{
			for (int y = 0; y <= 4; y++)
				System.out.printf("%3d", a[x][y]);
			System.out.printf("\n");
		}
	}
}
