PROGRAMMING:I don't know the name, so I call it a!
As we all know, stream is a financial product. It's no mercy to promote sales. It often makes you feel like you can make money (bah, illusion). Christmas is coming, and big promotion will come again. Let's make money
Just at this time, the care for single Dog Association is going to give lfq a gift, and members of the association want to buy him a game.
The number of members ranges from 1 to n. Everyone has their own preferences * * they only buy the games they like for lfq**
Game numbers range from 1 to M. Every game has a price.
We will discuss with each other before buying the game
1. * *, so there will be no purchase of the same game**
2 * * everyone will only buy one (poor)**
3 * * everyone has to buy one (you will get angry if you don't buy lfq)**
**The members of the association are very poor, so please help them to calculate how cheap the most expensive game is. Please output this value. If there is no solution, please output - 1**
###Input format:
The first line is a positive integer $$t $, indicating the number of test cases
Two numbers in the second line
In the next N lines, $$I $$line, the first number $$k $$indicates that the $$I $$individual likes K games, and the next number $$k $$indicates the game that the $$I $$individual likes
Finally, the $$M $$line represents the price of the game.
###Output format:
For each case, output an integer to represent the answer, separated by spaces
$$k<=n,m<=200 $$
$$T<=10$$
Guaranteed price will not exceed 10000
###Input example:
```in
two
3 4
2 1 2
2 2 3
2 1 4
10 20 30 40
4 5
1 1
1 2
1 3
2 4 5
4 4 4 3 5
```
###Output example:
```out
thirty
four
```
answer:If there is no answer, please comment
Just at this time, the care for single Dog Association is going to give lfq a gift, and members of the association want to buy him a game.
The number of members ranges from 1 to n. Everyone has their own preferences * * they only buy the games they like for lfq**
Game numbers range from 1 to M. Every game has a price.
We will discuss with each other before buying the game
1. * *, so there will be no purchase of the same game**
2 * * everyone will only buy one (poor)**
3 * * everyone has to buy one (you will get angry if you don't buy lfq)**
**The members of the association are very poor, so please help them to calculate how cheap the most expensive game is. Please output this value. If there is no solution, please output - 1**
###Input format:
The first line is a positive integer $$t $, indicating the number of test cases
Two numbers in the second line
In the next N lines, $$I $$line, the first number $$k $$indicates that the $$I $$individual likes K games, and the next number $$k $$indicates the game that the $$I $$individual likes
Finally, the $$M $$line represents the price of the game.
###Output format:
For each case, output an integer to represent the answer, separated by spaces
$$k<=n,m<=200 $$
$$T<=10$$
Guaranteed price will not exceed 10000
###Input example:
```in
two
3 4
2 1 2
2 2 3
2 1 4
10 20 30 40
4 5
1 1
1 2
1 3
2 4 5
4 4 4 3 5
```
###Output example:
```out
thirty
four
```
answer:If there is no answer, please comment