spoj#ARRAYSUB. subarrays

    ID: 21422 远端评测题 1000ms 1536MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>datastructuressliding-window-1data-structure-1

subarrays

Given an array and an integer k, find the maximum for each and every contiguous subarray of size k.

Input

the number n denoting number of elements in the array then after a new line we have the numbers of the array and then k in a new line

n < 10^6
k < 10^5
1 <= k <= n

and each element of the array is between 0 and 10^6

(Edited: In fact, n <= 10^5)

Output

print the output array

Example

Input:
9
1 2 3 1 4 5 2 3 6
3

Output: 3 3 4 5 5 5 6

</p>