{"problem":{"name":"I. Searching","description":{"content":"You have a simple system in which you want to have a search function. You decided to implement it for searching email addresses. There is a bunch of email addresses in your program. User enters an em","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10048I"},"statements":[{"statement_type":"Markdown","content":"You have a simple system in which you want to have a search function. You decided to implement it for searching email addresses. There is a bunch of email addresses in your program.\n\nUser enters an email address. And the function detects if there is one. If yes, then its answer is “yes”, otherwise it tries to change one symbol in the entered address (the error detection). Then, if it matches only one address, the answer is still “yes”. But if it detects more than one address or does not detect anything, the answer is “no“.\n\nThe first line contains the number of test cases _T_ (T ≤ 100). The first line of each test case contains the number of email addresses in the program _n_ and the number of queries _m_ (1 ≤ n, m ≤ 10). The following _n_ lines contain email addresses (only lowercase letters, digits and symbols “@”, “.”). The following m lines contain an email address, which is searched (only lowercase letters, digits and symbols “@”, “.”).\n\nNote: the length of email addresses doesn’t exceed 100.\n\nFor each test case output one line containing “_Case #tc:_”, where _tc_ is the number of the test case (starting from 1). Then output _m_ lines containing answers to the queries (“_yes_” or “_no_”).\n\n## Input\n\nThe first line contains the number of test cases _T_ (T ≤ 100). The first line of each test case contains the number of email addresses in the program _n_ and the number of queries _m_ (1 ≤ n, m ≤ 10). The following _n_ lines contain email addresses (only lowercase letters, digits and symbols “@”, “.”). The following m lines contain an email address, which is searched (only lowercase letters, digits and symbols “@”, “.”).Note: the length of email addresses doesn’t exceed 100.\n\n## Output\n\nFor each test case output one line containing “_Case #tc:_”, where _tc_ is the number of the test case (starting from 1). Then output _m_ lines containing answers to the queries (“_yes_” or “_no_”).\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ tc \\in \\{1, \\dots, T\\} $:  \n- Let $ n, m \\in \\mathbb{Z} $ denote the number of stored email addresses and queries, respectively.  \n- Let $ E = \\{e_1, e_2, \\dots, e_n\\} $ be the set of stored email addresses, where each $ e_i $ is a string over the alphabet $ \\Sigma = \\{ \\text{lowercase letters}, \\text{digits}, @, . \\} $.  \n- Let $ Q = \\{q_1, q_2, \\dots, q_m\\} $ be the set of query email addresses, each $ q_j \\in \\Sigma^* $.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 100 $  \n2. For each test case:  \n   - $ 1 \\le n \\le 10 $, $ 1 \\le m \\le 10 $  \n   - $ |e_i| \\le 100 $, $ |q_j| \\le 100 $ for all $ i,j $  \n   - All strings contain only characters from $ \\Sigma $  \n\n**Objective**  \nFor each query $ q_j $:  \n- If $ q_j \\in E $, output “yes”.  \n- Else, let $ D(q_j) = \\{ e \\in E \\mid \\text{Hamming distance}(q_j, e) = 1 \\} $.  \n  - If $ |D(q_j)| = 1 $, output “yes”.  \n  - Otherwise (i.e., $ |D(q_j)| \\ne 1 $), output “no”.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10048I","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}