Family View

Time Limit: 3000/1000 MS (Java/Others)

Memory Limit: 65536/65536 K (Java/Others)


Steam is a digital distribution platform developed by Valve Corporation offering digital rights management (DRM), multiplayer gaming and social networking services. A family view can help you to prevent your children access to some content which are not suitable for them.

Take an MMORPG game as an example, given a sentence T, and a list of forbidden words {P}, your job is to use '*' to subsititute all the characters, which is a part of the substring matched with at least one forbidden word in the list (case-insensitive).

For example, T is: "I love Beijing's Tiananmen, the sun rises over Tiananmen. Our great leader Chairman Mao, he leades us marching on."

And {P} is: {"tiananmen", "eat"}

The result should be: "I love Beijing's *********, the sun rises over *********. Our gr*** leader Chairman Mao, he leades us marching on."


The first line contains the number of test cases. For each test case:
The first line contains an integer $n$, represneting the size of the forbidden words list $P$. Each line of the next $n$ lines contains a forbidden words $P_i~(1\le |P_i|\le 1000000, \sum |P_i| \le 1000000)$ where $P_i$ only contains lowercase letters.

The last line contains a string $T~(|T| \le 1000000)$.


For each case output the sentence in a line.

Sample Input

1 3 trump ri o Donald John Trump (born June 14, 1946) is an American businessman, television personality, author, politician, and the Republican Party nominee for President of the United States in the 2016 election. He is chairman of The Trump Organization, which is the principal holding company for his real estate ventures and other business interests.

Sample Output

D*nald J*hn ***** (b*rn June 14, 1946) is an Ame**can businessman, televisi*n pers*nality, auth*r, p*litician, and the Republican Party n*minee f*r President *f the United States in the 2016 electi*n. He is chairman *f The ***** *rganizati*n, which is the p**ncipal h*lding c*mpany f*r his real estate ventures and *ther business interests.




2016 ACM/ICPC Asia Regional Qingdao Online