{"raw_statement":[{"iden":"problem statement","content":"You run a web service with $N$ users.\nThe $i$\\-th user with a current handle $S_i$ wants to change it to $T_i$.  \nHere, $S_1,\\ldots$, and $S_N$ are pairwise distinct, and so are $T_1,\\ldots$, and $T_N$.\nDetermine if there is an appropriate order to change their handles to fulfill all of their requests subject to the following conditions:\n\n*   you change only one user's handle at a time;\n*   you change each user's handle only once;\n*   when changing the handle, the new handle should not be used by other users at that point."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 10^5$\n*   $S_i$ and $T_i$ are strings of length between $1$ and $8$ (inclusive) consisting of lowercase English letters.\n*   $S_i \\neq T_i$\n*   $S_i$ are pairwise distinct.\n*   $T_i$ are pairwise distinct."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$S_1$ $T_1$\n$S_2$ $T_2$\n$\\vdots$\n$S_N$ $T_N$"},{"iden":"sample input 1","content":"2\nb m\nm d"},{"iden":"sample output 1","content":"Yes\n\nThe $1$\\-st user with a current handle `b` wants to change it to `m`.  \nThe $2$\\-nd user with a current handle `m` wants to change it to `d`.\nFirst, you change the $2$\\-nd user's handle from `m` to `d`; then you change the $1$\\-st user's handle from `b` to `m`. This way, you can achieve the objective.\nNote that you cannot change the $1$\\-st user's handle to `m` at first, because it is used by the $2$\\-nd user at that point."},{"iden":"sample input 2","content":"3\na b\nb c\nc a"},{"iden":"sample output 2","content":"No\n\nThe $1$\\-st user with a current handle `a` wants to change it to `b`.  \nThe $2$\\-nd user with a current handle `b` wants to change it to `c`.  \nThe $3$\\-rd user with a current handle `c` wants to change it to `a`.\nWe cannot change their handles subject to the conditions."},{"iden":"sample input 3","content":"5\naaa bbb\nyyy zzz\nccc ddd\nxxx yyy\nbbb ccc"},{"iden":"sample output 3","content":"Yes"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}