Bob is admiring a beautiful postmodern exhibit at the local art gallery. The exhibit consists of colourful neon lamps in a line, labelled to , and each lamp can be one of two colours: a vibrant fuchsia or a soothing aquamarine.
The exhibit also happens to be interactive. There are buttons that the visitors can press, labelled to . Pressing button will simultaneously change the colours of lamps and (from fuchsia to aquamarine or aquamarine to fuchsia), but only if those lamps are the same colour. Obviously, this represents the profound fragility and changeable nature of the human condition.
Bob notices that the colours of the lamps currently form pattern . He thinks they would look good in pattern , so he wants to know if it is possible to get to from by a sequence of zero or more button presses.
Constraints
Subtask 1 [20%]
Subtask 2 [20%]
Subtask 3 [60%]
Input Specification
The first line will contain one integer, .
The second line will contain a string of characters, either F
(fuchsia) or A
(aquamarine), pattern .
The third and final line will contain a string of characters, either F
or A
, pattern .
Output Specification
Output YES
if it is possible to get to from and NO
otherwise.
Sample Input 1
6
FAAFFF
FFAAFF
Sample Output 1
YES
Sample Input 2
6
FAFAFA
AFAFAF
Sample Output 2
NO
Comments