#3. Binary Search

Binary Search

Background

Welcome to DSAI 2201, ^_^

Description

You are given a sorted integer array of length nn (non-decreasing), and then nn queries. For each query value qq:

  • If qq exists in the array, output qq itself.
  • If qq does not exist in the array, output the number in the array that is closest to qq.
  • If two numbers are equally close, output the smaller one.

Format

Input

  • The first line contains one integer nn (1n1051 \leq n \leq 10^5).
  • The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (non-decreasing, 109ai109-10^9 \leq a_i \leq 10^9).
  • The third line contains nn integers q1,q2,,qnq_1, q_2, \dots, q_n (queries, 109qi109-10^9 \leq q_i \leq 10^9).

Output

Output nn integers, where the $i$-th integer is the answer to the ii-th query.

Samples

5
1 4 7 10 15
5 10 2 20 6
4 10 1 15 7

Limitation

1s, 128MiB for each test case.