Олимпиадный тренинг

Задача 37258. bomb shelters


The Civil Defense Headquarters of the Thirtieth Region decided to update the rescue plan in case of a nuclear attack. It is known that all n villages of the Thirtieth Region are located along one straight road. There are also m bomb shelters along the road, where villagers can take shelter in case of a nuclear attack.

In order for the rescue in the event of a nuclear alarm to be as efficient as possible, it is necessary to determine the nearest bomb shelter for each village.

Input data: In the first line enter the number n - the number of villages (1 <= n <= 100000). The second line contains n different integers, the i-th of these numbers specifies the distance from the beginning of the road to the i-th village. The third line of the input specifies the number m - the number of bomb shelters (1 <= m <= 100000). The fourth line contains m different integers, i-th of these integers specifies the distance from the beginning of the road to i-th bomb shelter. All distances are positive and do not exceed 109. The village and the shelter can be located at the same point.

Output: Print n numbers - for each village print the number of the bomb shelter closest to it. The bomb shelters are numbered from 1 to m in the order in which they are given in the input.

Examples
# Input Output
1 4
1 2 6 10
2
7 3
2 2 1 1