Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Can IUTPC Resist the Coders?

Limits: 500ms, 256 MB

IUT CSE’16 batch students have completed their C Programming Course. As they are so dexterous programmer, they can solve almost all the problems which are assigned to them.

Now, IUT Programming Community (IUTPC) have been informed regarding the awesome programming skills of these young coders. IUTPC have arranged an immediate meeting about how to tackle these first year students by giving them a challenging problem to solve.

In the meeting, IUTPC have proposed the following problem . As first year students are quite new, so IUTPC have not proposed any stopper problem either. Also, 2nd and 3rd students are very hungry (As there are some AWESOME and INCREDIBLE programmers in CSE’14 and CSE’15) and whenever they see a problem, they start solving it.

Being a student of xth year, can you solve the following problem?

Given a number n, you have to print the first n*n prime numbers in the following pattern (See the sample output for details).

Input

Take a single number n (0 < n ≤ 800) as input.

Output

See the sample output for details.

Samples

InputOutput
1
2
3
2 3 5
19 23 7
17 13 11
2
2 3
7 5
5
2 3 5 7 11
53 59 61 67 13
47 89 97 71 17
43 83 79 73 19
41 37 31 29 23

Discussion