#B3671. Lunch Meal Parameter Distribution

    ID: 11330 Type: Default 1000ms 256MiB

Lunch Meal Parameter Distribution

Lunch Meal Parameter Distribution

At lunch time, in Meow Meow Kindergarten, \( n \) children are lined up from left to right and are numbered from \(1\) to \(n\). The teacher has already arranged all the lunch meals in a line. The teacher holds a sequence \(r_1, r_2, \dots, r_n\) where \(r_i\) (with \(1 \le r_i \le n\) and all \(r_i\) distinct) indicates that the child numbered \(i\) should receive the meal which is the \(r_i\)-th from the left.

After this distribution, the teacher obtains another sequence \(a_1, a_2, \dots, a_n\), where \(a_i\) represents a specific parameter associated with the \(i\)-th meal (from left). Your task is to determine, for each child, the parameter of the meal they received.

Note: All formulas must be formatted in \(\LaTeX\) format as shown above.

inputFormat

The input consists of three lines:

  • The first line contains an integer \( n \), representing the number of children (and meals).
  • The second line contains \( n \) space-separated integers \( r_1, r_2, \dots, r_n \) which denote the distribution order.
  • The third line contains \( n \) space-separated integers \( a_1, a_2, \dots, a_n \) representing the parameter for each meal in order.

outputFormat

Output a single line containing \( n \) integers. The \( i \)-th integer should be the parameter of the meal received by the child numbered \( i \). The values should be separated by a single space.

sample

3
3 1 2
2 4 8
8 2 4