atcoder#ABC244D. [ABC244D] Swap Hats
[ABC244D] Swap Hats
Score : points
Problem Statement
There are three Takahashis numbered , and , and three hats colored red, green, and blue. Each Takahashi is wearing one hat. The color of the hat that Takahashi is currently wearing is represented by a character . Here, R
corresponds to red, G
to green, and B
to blue. Now, they will do the following operation exactly times.
Operation
- Choose two out of the three Takahashis. The two exchange the hats they are wearing.
Is it possible to make Takahashi wearing the hat of color corresponding to character after the repetitions?
Constraints
- are a permutation of
R
,G
,B
. - are a permutation of
R
,G
,B
.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to make Takahashi wearing the hat of color corresponding to character after the repetitions, print Yes
; otherwise, print No
.
R G B
R G B
Yes
For example, the objective can be achieved by repeating times the operation of swapping the hats of Takahashi and Takahashi .