Under construction

Still being built. Things may change

Snowman

Interview

Time limit1sMemory limit1024 MB

Summary
Given two rankings of the same players, find the bib numbers that rose the most places, listed in their final rank order.
Level

Easy2 of 10

Topics
Hash map, Implementation
Solved
No attempts yet

Problem

The snowman-making event at the Pyeongchang Winter Olympics has started! In this event, the person who builds the biggest snowman within the given time wins.

Ari turned on the broadcast when the event had only just started. The broadcast was showing the leaderboard, a table that lists each player's bib number in rank order. Ari memorized the bib numbers on the leaderboard in order.

Ari stepped away for a moment, and the event ended. Given the leaderboard at the end of the event, find the bib numbers of the players whose rank rose the most compared to the ranks Ari remembered.

Input

The first line contains the number of players NN.

The second line contains NN integers A1,⋯ ,ANA_1, \cdots, A_N, the bib numbers of each player in rank order when Ari turned on the broadcast, separated by spaces.

The third line contains NN integers B1,⋯ ,BNB_1, \cdots, B_N, the bib numbers of each player in rank order at the end of the event, separated by spaces.

Output

Print the bib numbers of the players whose rank rose the most, in the order of their rank at the end of the event, separated by spaces.

Constraints

  • 1≤N≤100 0001 \le N \le 100\,000
  • 1≤Ai≤1 000 000 0001 \le A_i \le 1\,000\,000\,000
  • 1≤Bi≤1 000 000 0001 \le B_i \le 1\,000\,000\,000
  • All AiA_i are distinct. (i≠j→Ai≠Aji \neq j \rightarrow A_i \neq A_j)
  • All BiB_i are distinct. (i≠j→Bi≠Bji \neq j \rightarrow B_i \neq B_j)
  • The set of elements of array AA is the same as the set of elements of array BB.

Examples2

  1. Example 1

    Input
    4
    411 101 1023 1030
    1023 1030 101 411
    
    Expected output
    1023 1030
    
  2. Example 2

    Input
    5
    304 513 711 206 1030
    304 513 711 206 1030
    
    Expected output
    304 513 711 206 1030