#BS0000008. Tinh tinh đào hoa (The Playboy Chimp)

Tinh tinh đào hoa (The Playboy Chimp)

The Playboy Chimp

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

You are given nn heights in non-decreasing order. For each query height xx, find:

  • the greatest height strictly smaller than xx;
  • the smallest height strictly greater than xx.

Heights equal to xx must not be selected. Print X whenever one side does not exist.

Input

The first line contains nn.

The second line contains the nn heights in non-decreasing order.

The third line contains qq.

The fourth line contains the qq query heights.

Output

For each query, print the nearest strictly smaller height and the nearest strictly greater height. Use X if one of them does not exist.

Subtasks

  • Subtask 1 — 20%: 1≤n,q≤1001\le n,q\le100.
  • Subtask 2 — 30%: 1≤n≤50001\le n\le5000, 1≤q≤50001\le q\le5000.
  • Subtask 3 — 50%: 1≤n≤500001\le n\le50000, 1≤q≤250001\le q\le25000, 1≤hi,x≤231−11\le h_i,x\le2^{31}-1.

Examples

Input

4
1 4 5 7
4
4 6 8 10

Output

1 5
5 7
7 X
7 X

Explanation

For x=4x=4, the greatest height below 44 is 11, and the smallest height above 44 is 55. A height equal to 44 is excluded.