{"raw_statement":[{"iden":"problem statement","content":"There is an $N \\times N$ grid. Let $(i, j)$ denote the cell at the $i$\\-th row from the top and the $j$\\-th column from the left.\nYou are to fill each cell with $0$ or $1$. Construct one method to fill the grid that satisfies all of the following conditions:\n\n*   The cells $(A_1,B_1), (A_2,B_2), \\dots, (A_M,B_M)$ contain $1$.\n*   The integers in the $i$\\-th row sum to $M$. $(1 \\le i \\le N)$\n*   The integers in the $i$\\-th column sum to $M$. $(1 \\le i \\le N)$\n\nIt can be proved that under the constraints of this problem, there is at least one method to fill the grid that satisfies the conditions."},{"iden":"constraints","content":"*   $1 \\le N \\le 10^5$\n*   $1 \\le M \\le \\min(N,10)$\n*   $1 \\le A_i, B_i \\le N$\n*   $(A_i, B_i) \\neq (A_j, B_j)$ if $i \\neq j$."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_{M}$ $B_{M}$"},{"iden":"sample input 1","content":"4 2\n1 4\n3 2"},{"iden":"sample output 1","content":"8\n1 2\n1 4\n2 1\n2 4\n3 2\n3 3\n4 1\n4 3\n\nThis output fills the grid as follows. All the conditions are satisfied, so this output is correct.\n\n0101\n1001\n0110\n1010"},{"iden":"sample input 2","content":"3 3\n3 1\n2 3\n1 3"},{"iden":"sample output 2","content":"9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"},{"iden":"sample input 3","content":"7 3\n1 7\n7 6\n6 1"},{"iden":"sample output 3","content":"21\n1 6\n2 4\n4 1\n7 3\n3 6\n4 5\n6 1\n1 7\n7 6\n3 5\n2 2\n6 3\n6 7\n5 4\n5 2\n2 5\n5 3\n1 4\n7 1\n4 7\n3 2"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}