PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000240. Sushi băng chuyền (Kaiten Sushi)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Sushi băng chuyền (Kaiten Sushi)

Kaiten Sushi

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN customers in order from 11 to NN. Customer ii accepts sushi whose tastiness is at least AiA_i. Each of the MM pieces, with tastiness BjB_j for piece jj, passes the customers in increasing index order until the first customer willing to eat it takes it. Later customers cannot take that piece. Customers may eat multiple pieces. Determine the recipient of each piece, or report that no one takes it.

Input

The first line contains integers N,MN,M. The second contains NN integers A1,…,ANA_1,\ldots,A_N. The third contains MM integers B1,…,BMB_1,\ldots,B_M.

Output

Print MM lines: the recipient index for piece jj, or -1 if nobody takes it.

Subtasks

  • Subtask 1 (20 points): 1≤N,M≤801\le N,M\le 80; 1≤Ai,Bj≤2⋅1051\le A_i,B_j\le 2\cdot10^5 for every 1≤i≤N,1≤j≤M1\le i\le N,1\le j\le M.
  • Subtask 2 (30 points): 1≤N,M≤2⋅1051\le N,M\le 2\cdot10^5; 1≤Ai,Bj≤2⋅1051\le A_i,B_j\le 2\cdot10^5 for all i,ji,j; Ai≥Ai+1A_i\ge A_{i+1} for 1≤i<N1\le i<N.
  • Subtask 3 (50 points): 1≤N,M≤2⋅1051\le N,M\le 2\cdot10^5; 1≤Ai,Bj≤2⋅1051\le A_i,B_j\le 2\cdot10^5 for every 1≤i≤N,1≤j≤M1\le i\le N,1\le j\le M.

Examples

Input

4 4
6 9 3 1
9 3 2 1

Output

1
3
4
4

Explanation

The piece of tastiness 9 goes to customer 1. The piece of tastiness 3 passes customers 1 and 2 and goes to 3. Both remaining pieces pass the first three customers and go to 4.