AT_past19_f ドミノ倒し
Description
You are lining up dominoes.
$ N $ clues are given: for each $ 1 \leq i \leq N $ , if domino $ S_i $ falls, then domino $ T_i $ will also fall.
Determine if the given clues imply that if domino $ X $ falls, then domino $ Y $ will also fall.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ X $ $ Y $ $ S_1 $ $ T_1 $ $ \vdots $ $ S_N $ $ T_N $
Output Format
Print `Yes` if the given clues imply that if domino $ X $ falls, then domino $ Y $ will also fall; print `No` otherwise.
Explanation/Hint
### Sample Explanation 1
The second clue states that if domino `second` falls, then domino `third` will also fall; and the third clue states that if domino `third` falls, then domino `fourth` will also fall.
Thus, we can infer that if domino `second` falls, then domino `fourth` will also fall.
### Sample Explanation 2
One cannot infer from the given clues that if domino `fourth` falls, then domino `second` will also fall.
### Constraints
- $ 1 \leq N \leq 2\times 10^5 $
- $ N $ is an integer.
- Each of $ S_i,T_i,X $ , and $ Y $ is a string of length between $ 1 $ and $ 100 $ , inclusive, consisting of lowercase English letters.
- $ X \neq Y $
- $ S_i \neq T_i $ for all $ i $ .
- $ (S_i,T_i) $ are distinct.