{"problem":{"name":"A. Mystical Mosaic","description":{"content":"There is a rectangular grid of _n_ rows of _m_ initially-white cells each. Arkady performed a certain number (possibly zero) of operations on it. In the _i_\\-th operation, a non-empty subset of rows ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF956A"},"statements":[{"statement_type":"Markdown","content":"There is a rectangular grid of _n_ rows of _m_ initially-white cells each.\n\nArkady performed a certain number (possibly zero) of operations on it. In the _i_\\-th operation, a non-empty subset of rows _R__i_ and a non-empty subset of columns _C__i_ are chosen. For each row _r_ in _R__i_ and each column _c_ in _C__i_, the intersection of row _r_ and column _c_ is coloured black.\n\nThere's another constraint: a row or a column can only be chosen at most once among all operations. In other words, it means that no pair of (_i_, _j_) (_i_ < _j_) exists such that or , where denotes intersection of sets, and denotes the empty set.\n\nYou are to determine whether a valid sequence of operations exists that produces a given final grid.\n\n## Input\n\nThe first line contains two space-separated integers _n_ and _m_ (1 ≤ _n_, _m_ ≤ 50) — the number of rows and columns of the grid, respectively.\n\nEach of the following _n_ lines contains a string of _m_ characters, each being either '_._' (denoting a white cell) or '_#_' (denoting a black cell), representing the desired setup.\n\n## Output\n\nIf the given grid can be achieved by any valid sequence of operations, output \"_Yes_\"; otherwise output \"_No_\" (both without quotes).\n\nYou can print each character in any case (upper or lower).\n\n[samples]\n\n## Note\n\nFor the first example, the desired setup can be produced by 3 operations, as is shown below.\n\n<center>![image](https://espresso.codeforces.com/315d10362486a9b3b11c3ef50bde291d03a6dfd8.png)</center>For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence it won't be possible to colour the other cells in the center column.","is_translate":false,"language":"English"}],"meta":{"iden":"CF956A","tags":["greedy","implementation"],"sample_group":[["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..","Yes"],["5 5\n..#..\n..#..\n#####\n..#..\n..#..","No"],["5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#","No"]],"created_at":"2026-03-03 11:00:39"}}