SP17946 MMMAGIC6 - Mickey Mouse Magic Trick v6

Description

![](https://cdn.luogu.com.cn/upload/vjudge_pic/SP17946/f7d4e975f3b49722b032f17dd0b87a76b7882723.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=725 and k=6. There are also problems with different values: [MMMAGIC3](../../problems/MMMAGIC3/), [MMMAGIC4](../../problems/MMMAGIC4/), [MMMAGIC5](../../problems/MMMAGIC5/) 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 < 10 $ ^{6} $ ). Every of next M lines contains k distinct integers from range \[1, n\] - the values on cards given to Mickey. The values are sorted in ascending order. 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.