{"problem":{"name":"Well-defined Abbreviation","description":{"content":"You are given $N$ srings $S_i\\ (1\\le i \\le N)$ consisting of `A`, `B`, `C`, `D`. Consider the operation below on a string $T$ consisting of `A`, `B`, `C`, `D`. *   Repeat the following until $T$ cont","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":8000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc141_f"},"statements":[{"statement_type":"Markdown","content":"You are given $N$ srings $S_i\\ (1\\le i \\le N)$ consisting of `A`, `B`, `C`, `D`.\nConsider the operation below on a string $T$ consisting of `A`, `B`, `C`, `D`.\n\n*   Repeat the following until $T$ contains none of the strings $S_i$ as a substring.\n    *   Choose an $S_i$ and one of its occurrences in $T$, remove that occurrence from $T$, and concatenate the remaining parts.\n\nWhat is a substring? A substring of a string is its contiguous subsequence. For example, `A`, `AB`, and `BC` are substrings of `ABC`, while `BA` and `AC` are not.We say that the string $T$ is _bad_ when multiple strings can result from the operation above.\nDetermine whether a bad string exists.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^6$\n*   $1 \\leq |S_i| \\leq 2 \\times 10^6$\n*   $|S_1|+|S_2|+\\dots +|S_N| \\leq 2 \\times 10^6$\n*   $S_i \\neq S_j$ if $i\\neq j$.\n*   $S_i$ is a string consisting of `A`, `B`, `C`, `D`.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$S_1$\n$S_2$\n$\\vdots$\n$S_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc141_f","tags":[],"sample_group":[["3\nA\nB\nC","No\n\nThe only string we can get from $T$ is what remains after removing all occurrences of `A`, `B`, `C` from $T$."],["1\nABA","Yes\n\nFor example, from $T=$ `ABABA`, we can get two strings: `AB` and `BA`, so $T$ is a bad string."],["4\nCBA\nACB\nAD\nCAB","Yes"]],"created_at":"2026-03-03 11:01:14"}}