{"raw_statement":[{"iden":"problem statement","content":"You are given patterns $S$ and $T$ consisting of `#` and `.`, each with $H$ rows and $W$ columns.  \nThe pattern $S$ is given as $H$ strings, and the $j$\\-th character of $S_i$ represents the element at the $i$\\-th row and $j$\\-th column. The same goes for $T$.\nDetermine whether $S$ can be made equal to $T$ by rearranging the columns of $S$.\nHere, rearranging the columns of a pattern $X$ is done as follows.\n\n*   Choose a permutation $P=(P_1,P_2,\\dots,P_W)$ of $(1,2,\\dots,W)$.\n*   Then, for every integer $i$ such that $1 \\le i \\le H$, simultaneously do the following.\n    *   For every integer $j$ such that $1 \\le j \\le W$, simultaneously replace the element at the $i$\\-th row and $j$\\-th column of $X$ with the element at the $i$\\-th row and $P_j$\\-th column."},{"iden":"constraints","content":"*   $H$ and $W$ are integers.\n*   $1 \\le H,W$\n*   $1 \\le H \\times W \\le 4 \\times 10^5$\n*   $S_i$ and $T_i$ are strings of length $W$ consisting of `#` and `.`."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$H$ $W$\n$S_1$\n$S_2$\n$\\vdots$\n$S_H$\n$T_1$\n$T_2$\n$\\vdots$\n$T_H$"},{"iden":"sample input 1","content":"3 4\n##.#\n##..\n#...\n.###\n..##\n...#"},{"iden":"sample output 1","content":"Yes\n\nIf you, for instance, arrange the $3$\\-rd, $4$\\-th, $2$\\-nd, and $1$\\-st columns of $S$ in this order from left to right, $S$ will be equal to $T$."},{"iden":"sample input 2","content":"3 3\n#.#\n.#.\n#.#\n##.\n##.\n.#."},{"iden":"sample output 2","content":"No\n\nIn this input, $S$ cannot be made equal to $T$."},{"iden":"sample input 3","content":"2 1\n#\n.\n#\n."},{"iden":"sample output 3","content":"Yes\n\nIt is possible that $S=T$."},{"iden":"sample input 4","content":"8 7\n#..#..#\n.##.##.\n#..#..#\n.##.##.\n#..#..#\n.##.##.\n#..#..#\n.##.##.\n....###\n####...\n....###\n####...\n....###\n####...\n....###\n####..."},{"iden":"sample output 4","content":"Yes"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}