{"raw_statement":[{"iden":"problem statement","content":"Given are an $N \\times N$ matrix and an integer $K$. The entry in the $i$\\-th row and $j$\\-th column of this matrix is denoted as $a_{i, j}$. This matrix contains each of $1, 2, \\dots, N^2$ exactly once.\nSigma can repeat the following two kinds of operation **arbitrarily** many times in any order.\n\n*   Pick two integers $x, y (1 \\leq x < y \\leq N)$ that satisfy $a_{i, x} + a_{i, y} \\leq K$ for all $i$ ($1 \\leq i \\leq N$) and swap the $x$\\-th and the $y$\\-th columns.\n*   Pick two integers $x, y (1 \\leq x < y \\leq N)$ that satisfy $a_{x, i} + a_{y, i} \\leq K$ for all $i$ ($1 \\leq i \\leq N$) and swap the $x$\\-th and the $y$\\-th rows.\n\nHow many matrices can he obtain by these operations? Find it modulo $998244353$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 50$\n*   $1 \\leq K \\leq 2 \\times N^2$\n*   $a_{i, j}$'s are a rearrangement of $1, 2, \\dots, N^2$.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$a_{1, 1}$ $a_{1, 2}$ $...$ $a_{1, N}$\n$a_{2, 1}$ $a_{2, 2}$ $...$ $a_{2, N}$\n$:$\n$a_{N, 1}$ $a_{N, 2}$ $...$ $a_{N, N}$"},{"iden":"sample input 1","content":"3 13\n3 2 7\n4 8 9\n1 6 5"},{"iden":"sample output 1","content":"12\n\nFor example, Sigma can swap two columns, by setting $x = 1, y = 2$. After that, the resulting matrix will be:\n\n2 3 7\n8 4 9\n6 1 5\n\nAfter that, he can swap two row vectors by setting $x = 1, y = 3$, resulting in the following matrix:\n\n6 1 5\n8 4 9\n2 3 7"},{"iden":"sample input 2","content":"10 165\n82 94 21 65 28 22 61 80 81 79\n93 35 59 85 96 1 78 72 43 5\n12 15 97 49 69 53 18 73 6 58\n60 14 23 19 44 99 64 17 29 67\n24 39 56 92 88 7 48 75 36 91\n74 16 26 10 40 63 45 76 86 3\n9 66 42 84 38 51 25 2 33 41\n87 54 57 62 47 31 68 11 83 8\n46 27 55 70 52 98 20 77 89 34\n32 71 30 50 90 4 37 95 13 100"},{"iden":"sample output 2","content":"348179577"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}