{"problem":{"name":"Unique Nicknames","description":{"content":"There are $N$ people numbered Person $1$, Person $2$, $\\dots$, and Person $N$. Person $i$ has a family name $s_i$ and a given name $t_i$. Consider giving a nickname to each of the $N$ people. Person $","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc247_b"},"statements":[{"statement_type":"Markdown","content":"There are $N$ people numbered Person $1$, Person $2$, $\\dots$, and Person $N$. Person $i$ has a family name $s_i$ and a given name $t_i$.\nConsider giving a nickname to each of the $N$ people. Person $i$'s nickname $a_i$ should satisfy all the conditions below.\n\n*   $a_i$ coincides with Person $i$'s family name or given name. In other words, $a_i = s_i$ and/or $a_i = t_i$ holds.\n*   $a_i$ does not coincide with the family name and the given name of any other person. In other words, for all integer $j$ such that $1 \\leq j \\leq N$ and $i \\neq j$, it holds that $a_i \\neq s_j$ and $a_i \\neq t_j$.\n\nIs it possible to give nicknames to all the $N$ people? If it is possible, print `Yes`; otherwise, print `No`.\n\n## Constraints\n\n*   $2 \\leq N \\leq 100$\n*   $N$ is an integer.\n*   $s_i$ and $t_i$ are strings of lengths between $1$ and $10$ (inclusive) consisting of lowercase English alphabets.\n\n## Input\n\nInput 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$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc247_b","tags":[],"sample_group":[["3\ntanaka taro\ntanaka jiro\nsuzuki hanako","Yes\n\nThe following assignment satisfies the conditions of nicknames described in the Problem Statement: $a_1 =$ `taro`, $a_2 =$ `jiro`, $a_3 =$ `hanako`. ($a_3$ may be `suzuki`, too.)  \nHowever, note that we cannot let $a_1 =$ `tanaka`, which violates the second condition of nicknames, since Person $2$'s family name $s_2$ is `tanaka` too."],["3\naaa bbb\nxxx aaa\nbbb yyy","No\n\nThere is no way to give nicknames satisfying the conditions in the Problem Statement."],["2\ntanaka taro\ntanaka taro","No\n\nThere may be a pair of people with the same family name and the same given name."],["3\ntakahashi chokudai\naoki kensho\nsnu ke","Yes\n\nWe can let $a_1 =$ `chokudai`, $a_2 =$ `kensho`, and $a_3 =$ `ke`."]],"created_at":"2026-03-03 11:01:13"}}