SP17944 MMMAGIC4 - Mickey Mouse Magic Trick v4

Description

![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP17944/1abc4ff69deb0d4f47adce39ad9fb55d6df10bc4.png)

Input Format

All integers in the same line are single-space separated (the same concerns problem output). Values n, k are constant. In this problem n=27 and k=4. There are also problems with different values: [MMMAGIC3](../../problems/MMMAGIC3/), [MMMAGIC5](../../problems/MMMAGIC5/), [MMMAGIC6](../../problems/MMMAGIC6/) The first line of input contains two integers M, D, where M is the number of test cases in which Mickey needs help, D is the number of test cases in which Donald needs help (M+D < 40000). Every of next M lines contains k distinct integers from range \[1, n\] - the values on cards given to Mickey. The order of values is casual. Every of next D lines contains k-1 distinct integers from range \[1, n\] - the cards left to Donald on the table. The order is the same, as on the table, from left to right.

Output Format

For each Mickey's query write a line with k-1 integers - the values on the cards, that Mickey have to leave on the table, from left to right. For each Donald's query write a line with one integer - the value of hidden card or (if in Your strategy such situation is impossible) any of remaining values.