{"raw_statement":[{"iden":"problem statement","content":"You are given two permutations $P=(P_1,P_2,\\dots,P_N)$ and $Q=(Q_1,Q_2,\\dots,Q_N)$ of $(1,2,\\dots,N)$.\nWrite one of the characters `0` and `1` in each cell of an $N$\\-by-$N$ grid so that all of the following conditions are satisfied:\n\n*   Let $S_i$ be the string obtained by concatenating the characters in the $i$\\-th row from the $1$\\-st to the $N$\\-th column. Then, $S_{P_1} < S_{P_2} < \\dots < S_{P_N}$ in lexicographical order.\n*   Let $T_i$ be the string obtained by concatenating the characters in the $i$\\-th column from the $1$\\-st to the $N$\\-th row. Then, $T_{Q_1} < T_{Q_2} < \\dots < T_{Q_N}$ in lexicographical order.\n\nIt can be proved that for any $P$ and $Q$, there is at least one way to write the characters that satisfies all the conditions.\nWhat does \"$X < Y$ in lexicographical order\" mean?For strings $X=X_1X_2\\dots X_{|X|}$ and $Y = Y_1Y_2\\dots Y_{|Y|}$, \"**$X < Y$ in lexicographical order**\" means that 1. or 2. below holds. Here, $|X|$ and $|Y|$ denote the lengths of $X$ and $Y$, respectively.\n\n1.  $|X| \\lt |Y|$ and $X_1X_2\\ldots X_{|X|} = Y_1Y_2\\ldots Y_{|X|}$.\n2.  There exists an integer $1 \\leq i \\leq \\min\\lbrace |X|, |Y| \\rbrace$ such that both of the following are true:\n    *   $X_1X_2\\ldots X_{i-1} = Y_1Y_2\\ldots Y_{i-1}$\n    *   $X_i$ is less than $Y_i$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 500$\n*   $P$ and $Q$ are permutations of $(1,2,\\dots,N)$.\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$P_1$ $P_2$ $\\dots$ $P_N$\n$Q_1$ $Q_2$ $\\dots$ $Q_N$"},{"iden":"sample input 1","content":"3\n1 2 3\n2 1 3"},{"iden":"sample output 1","content":"001\n101\n110\n\nIn this sample, $S_1=$`001`, $S_2=$`101`, $S_3=$`110`, and $T_1=$`011`, $T_2=$`001`, $T_3=$`110`. Therefore, $S_1 < S_2 < S_3$ and $T_2 < T_1 < T_3$ hold, satisfying the conditions."},{"iden":"sample input 2","content":"15\n8 15 10 2 4 3 1 13 5 12 9 6 14 11 7\n4 1 5 14 3 12 13 7 11 8 6 2 9 15 10"},{"iden":"sample output 2","content":"010001111110101\n001000000101001\n010001001100010\n010000011110010\n010011101101101\n100101110100000\n111100011001000\n000001001100000\n100011011000101\n000111101011110\n101010101010101\n011010101011110\n010011000010011\n100110010110101\n000101101100100"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}