Team selection
Two team leaders get to assemble their teams by choosing team members among a set of players that are numbered from to . The leaders take turns, each picking the -th player among the remaining ones, according to their ideas of which one of the remaining players would be the best addition to their teams.
Given the choices of the two leaders (the first team leader starts first), please compute the list of players in each team.
Input
Consists of three lines.
The first line contains the single integer , is a multiple of ).
The second line contains integers representing the choices of the first team leader: during the -th turn, the first leader chose the -th remaining player.
The third line contains integers representing the choices of the second team leader: during the -th turn, the second leader chose the -th remaining player.
The choices of the team leaders are valid: at each step, they are between and the number of remaining players (inclusive).
Output
Print two lines, each containing integers.
The first line should contain the list of the players chosen to become members of the first team, in the order they were chosen: the player was chosen during the -th turn.
The second line should contain the list of the players chosen to become members of the second team, in the order they were chosen: the player was chosen during the -th turn.