The first line of the input contains an integer T (1<=T<=100) which means the number of test cases.
For each case:
First line two integers N, D. (1 <= N <= 100, 0 <= D <= 100)
Then several lines follow. Each line contains 2 – 5 skills separated by “ # ” which means these skills can replace each other. End by “#end#”!
Then N*2 lines follow, every two lines describe the interview information day by day.
The format is:
First: Company Name : Skill_1(the least degree D1) && Skill_2(the least degree D2) && .....Skill_k(the least degree Dk).
Second: Skill_1(the increasing degree I1) && Skill_2(the increasing degree I2) && .....Skill_m(the increasing degree Im).
(0 <= k, m <=4, 0 <= Di, Ii < 2^31)
The number of skills is not larger than 10000, the length of company name and skill name will not more than 100, Company name and skill name will not contain leading and trailing blank ,‘&’, ’(’, ’)’ and ’#’.