For a string , we define the -function as follows: Z[i] = lcp(S, S[i..|S|]), where lcp(S_1, S_2) is the length of the longest common prefix of the strings S_1 and S_2. For example, for S = abacabaa, the -function is [8, 0, 1, 0, 3, 0, 1, 1].
For a string , we define its prefix function as: pi[i] = max\{k | 0 \le k < i, S[1..k] = S[i - k + 1..i]\}. For example, for S = abacabaa, its prefix function is [0, 0, 1, 0, 1, 2, 3, 1].
Given a string , its -function was calculated, but the string itself was lost. Your task is to derive its prefix function from the given -function.
The first line of the input contains a natural number (1 \le N \le 200000), which is the length of . The second line contains the -function of the string .
Output numbers representing the desired prefix function.
Example 1