#abc279c. [abc279_c]RANDOM
[abc279_c]RANDOM
Problem Statement
You are given patterns and consisting of #
and .
, each with rows and columns.
The pattern is given as strings, and the -th character of represents the element at the -th row and -th column. The same goes for .
Determine whether can be made equal to by rearranging the columns of .
Here, rearranging the columns of a pattern is done as follows.
- Choose a permutation of .
- Then, for every integer such that , simultaneously do the following.
- For every integer such that , simultaneously replace the element at the -th row and -th column of with the element at the -th row and -th column.
Constraints
- and are integers.
- and are strings of length consisting of
#
and.
.
Input
The input is given from Standard Input in the following format:
Output
If can be made equal to , print Yes
; otherwise, print No
.
Sample Input 1
3 4
##.#
##..
#...
.###
..##
...#
Sample Output 1
Yes
If you, for instance, arrange the -rd, -th, -nd, and -st columns of in this order from left to right, will be equal to .
Sample Input 2
3 3
#.#
.#.
#.#
##.
##.
.#.
Sample Output 2
No
In this input, cannot be made equal to .
Sample Input 3
2 1
#
.
#
.
Sample Output 3
Yes
It is possible that .
Sample Input 4
8 7
#..#..#
.##.##.
#..#..#
.##.##.
#..#..#
.##.##.
#..#..#
.##.##.
....###
####...
....###
####...
....###
####...
....###
####...
Sample Output 4
Yes