Bob is admiring a beautiful postmodern exhibit at the local art gallery. The exhibit consists of
The exhibit also happens to be interactive. There are
Bob notices that the colours of the lamps currently form pattern
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 F
(fuchsia) or A
(aquamarine), pattern
The third and final line will contain a string of F
or A
, pattern
Output Specification
Output YES
if it is possible to get to NO
otherwise.
Sample Input 1
6
FAAFFF
FFAAFF
Sample Output 1
YES
Sample Input 2
6
FAFAFA
AFAFAF
Sample Output 2
NO
Comments