Pruefsumme

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

We are surrounded by long numeric identifiers: bank account numbers, book ISBN codes, product barcodes, and so on. Most of those identifiers are or were often written and typed in by people, and in order to avoid mistakes have some sort of error detection built in.

The error detection usually comes in form of a checksum. For example, the ISBN-10 book codes are 10-digit sequences a_1a\_1, a_2a\_2, \dots, a_10a\_{10} with the following checksum:

10×a_1+9×a_2+8×a_3++2×a_9+1×a_10(mod11)10\times a\_1 + 9 \times a\_2 + 8 \times a\_3 + \dots + 2 \times a\_9 + 1 \times a\_{10} \pmod{11}

The checksum is a number between 0 and 10, and for valid book codes it is always 0. As it was designed for error detection, it has the following important properties:

  1. If we change any single digit while keeping the others the same, the checksum changes.
  2. If we swap two different adjacent digits while keeping the rest the same, the checksum changes.

However, it is not very beautiful because it has 11 possible values, while the individual digits have only 10 possible values, and so it seems a bit excessive.

We introduce the concept of a beautiful checksum as follows: suppose our identifiers are sequences of nn integers, each being between 0 and m1m-1, inclusive: a_1a\_1, a_2a\_2, \dots, a_na\_n. A checksum algorithm is defined by two matrices p_ijp\_{ij} (0i,jm10 \le i, j \le m-1) and q_kiq\_{ki} (1kn1 \le k \le n, 0im10 \le i \le m-1) with values between 0 and m1m-1, inclusive. The checksum is then computed like this:

  1. Set s_0=0s\_0 = 0.

  2. For each kk from 11 to nn:

    1. Set t_k=q_k,a_kt\_k = q\_{k,a\_k}.
    2. Set s_k=p_s_k1,t_ks\_k = p\_{s\_{k-1},t\_k}.
  3. Return the value of s_ns\_n as the checksum.

In other words, the matrix qq defines a transformation of numbers for each position, and the matrix pp tells how to combine transformed numbers. The two matrices pp and qq define a beautiful checksum for the given nn and mm if the checksum value satisfies the two properties listed above for any sequence aa: it must be sensitive to changing a single number, and to swapping two different adjacent numbers (a_ka_k+1a\_k \ne a\_{k+1} for some kk).

For example, ISBN-10 defined as p_ij=i+j(mod11)p\_{ij}=i + j \pmod{11}, q_ki=(11k)×i(mod11)q\_{ki} = (11 - k) \times i \pmod{11} is a beautiful checksum for n=10n=10, m=11m=11.

Can you come up with a beautiful checksum for the given nn and mm?

입력

The only line of the input file contains two numbers: nn and mm, 2n1002 \le n \le 100, 2m92 \le m \le 9.

출력

If there is a beautiful checksum for the given values of nn and mm, print Ja on the first line of the output file, otherwise print Nein.

In case you printed Ja, print the description of the checksum afterwards. On the next mm lines print the matrix pp, with mm space-separated integers per line: the jj-th (0-based) value in the ii-th (0-based) of those mm lines should contain the value p_ijp\_{ij}. On the next nn lines print the matrix qq, with mm space-separated integers per line: the ii-th (0-based) value in the kk-th (1-based) of those nn lines should contain the value q_kiq\_{ki}.

All numbers you print must be between 0 and m1m-1, inclusive. In case there are multiple possible solutions, you may output any of them.