|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
Since Croatia is becoming a skiing superpower, we have learned all there is about skiing. Nevertheless, let’s remind what a ski race looks like. The race consists of two runs.
In the first run we have N skiers each with his own starting number between 1 and N. The skiers race one by one down the hill in the increasing order of their starting numbers. In this task, we are given the current position of each skier when reaching the finish line (i.e. in relation to the skiers who performed before him).
Only the M best placed skiers in the first run qualify for the second run. This time they go down the hill in the descending order of their finishing times of the first run (i.e. from the one ranked M-th to the one ranked first). In this task, similarly to the first run, we are also given the current position of each skier when reaching the finish line (combined, i.e. for both runs).
Write a program that will determine which skiers have won medals. We know that every skier has finished the race and that there are no skiers with the same finishing times (in both of the runs).
First line of the input file consists of 2 integers N and M separated by a whitespace, 3 ≤ M ≤ N ≤ 100.
Next N lines contain current positions of skiers competing in the first run, whilst the M lines coming after that contain current positions of skiers for both runs combined. Positions are given in the order in which skiers go down the hill.
Your program should output the starting number of the skier winning the gold medal to the first line of the output file, the starting number of the one winning silver to the second line and the starting number of the skier winning bronze to the third line.
3 3 1 2 3 1 1 1
1 2 3
4 3 1 1 2 2 1 2 1
2 3 4
5 4 1 2 1 4 3 1 1 3 2
5 3 2