Hnelpig Arnde

Did you konw taht, if we mses up all the letetrs of a wrod, ecxlundig the fisrt and lsat oens, the wrod rmeanis prefcelty unedrsantdbale? Yep. Since researchers at UFPE found that out, it became common in the internet to write every- thing messed up. LifeInvader posts, chatting rooms, blogs, professional e-mails, academic works, every kind of text became victim of this modern trend. Everybody got used to write with messed letters and understand what is written. Except Andre. Andre is kind of a dumb guy. Andre isn’t inside all the internet trends. Andre has no clue. Andre can’t read messed texts, and because of that he has problems to study, communicate at League of Legends and even chat with the chicks. Fortunately, Andre has a programmer friend to help him with that problem: you! He asked you to create a program to fix the messed texts using a set of words. It’s up to you to help him live his life normally. Help him and he will call a friend to get you an ACC! Input The first line contains T (T ≤ 100) — the number of test cases, after this line T test cases follows. The first line of a test case contains two integers N (N ≤ 100) and M (M ≤ 20) — the number of words in the set and the number of lines of text Andre wants to fix, correspondingly. The next line of a test case will contain N space-separated words — the words in the set. The next M lines of a test case will contain the text lines to be fixed, with at least one and at most 50 messed up words, and every word will be separated by a single space. Every word in the input will have at most 40 letters and will contain only lowercase letters. It’s guaranteed that every word of the input has exactly one corresponding word in the set. Output For each test case print a line containing ‘Case #X:’, where X is the case number, starting at 1. Then, for every line of text, print it with the words fixed according to the set. Sample Input 2 92 andre copy exam free gimme lemme plox stuff yo ardne lmeme cpoy yo eaxm polx adnre gmime fere sfutf polx 41 abacabadabacaba abacaba aba a a aba acbbaaa adccbbbbaaaaaaa Sample Output Case #1: andre lemme copy yo exam plox andre gimme free stuff plox

2/2 Case #2: a aba abacaba abacabadabacaba