{"problem":{"name":"Palindromic Matrix","description":{"content":"We have an $H$\\-by-$W$ matrix. Let $a_{ij}$ be the element at the $i$\\-th row from the top and $j$\\-th column from the left. In this matrix, each $a_{ij}$ is a lowercase English letter. Snuke is creat","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"code_festival_2017_quala_c"},"statements":[{"statement_type":"Markdown","content":"We have an $H$\\-by-$W$ matrix. Let $a_{ij}$ be the element at the $i$\\-th row from the top and $j$\\-th column from the left. In this matrix, each $a_{ij}$ is a lowercase English letter.\nSnuke is creating another $H$\\-by-$W$ matrix, $A'$, by freely rearranging the elements in $A$. Here, he wants to satisfy the following condition:\n\n*   Every row and column in $A'$ can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\n## Constraints\n\n*   $1 ≤ H, W ≤ 100$\n*   $a_{ij}$ is a lowercase English letter.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$\n$a_{11}$$a_{12}$$...$$a_{1W}$\n$:$\n$a_{H1}$$a_{H2}$$...$$a_{HW}$\n\n[samples]\n\n## Note\n\nA _palindrome_ is a string that reads the same forward and backward. For example, `a`, `aa`, `abba` and `abcba` are all palindromes, while `ab`, `abab` and `abcda` are not.","is_translate":false,"language":"English"}],"meta":{"iden":"code_festival_2017_quala_c","tags":[],"sample_group":[["3 4\naabb\naabb\naacc","Yes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba"],["2 2\naa\nbb","No\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in $A$."],["5 1\nt\nw\ne\ne\nt","Yes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt"],["2 5\nabxba\nabyba","No"],["1 1\nz","Yes"]],"created_at":"2026-03-03 11:01:14"}}