You are given an array $a$ consisting of $n$ integers numbered from $1$ to $n$.

Let's define the $k$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $k$ (recall that a subsegment of $a$ of length $k$ is a contiguous part of $a$ containing exactly $k$ elements). If there is no integer occuring in all subsegments of length $k$ for some value of $k$, then the $k$-amazing number is $-1$.

For each $k$ from $1$ to $n$ calculate the $k$-amazing number of the array $a$.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then $t$ test cases follow.

The first line of each test case contains one integer $n$ ($1 \le n \le 3 \cdot 10^5$) — the number of elements in the array. The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le n$) — the elements of the array. 

It is guaranteed that the sum of $n$ over all test cases does not exceed $3 \cdot 10^5$.


-----Output-----

For each test case print $n$ integers, where the $i$-th integer is equal to the $i$-amazing number of the array.


-----Example-----
Input
3
5
1 2 3 4 5
5
4 4 4 4 2
6
1 3 1 5 3 1

Output
-1 -1 3 2 1 
-1 4 4 4 2 
-1 -1 1 1 1 1

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import sys\n\n    \ndef main():\n    #n = iinput()\n    #k = iinput() \n    #m = iinput() \n    n = int(sys.stdin.readline().strip()) \n    #n, k = rinput()\n    #n, m = rinput()\n    #m, k = rinput()\n    #n, k, m = rinput()\n    #n, m, k = rinput()\n    #k, n, m = rinput()\n    #k, m, n = rinput() \n    #m, k, n = rinput()\n    #m, n, k = rinput()\n    q = list(map(int, sys.stdin.readline().split()))\n    #q = linput()\n    clovar, p, x = {}, [], 1e9\n    for i in range(n):\n        if q[i] in clovar:\n            clovar[q[i]].append(i)\n        else:\n            clovar[q[i]] = [i]\n    for o in clovar:\n        t = clovar[o]\n        ma = max(t[0] + 1, n - t[-1])\n        dlinat = len(t) - 1\n        for i in range(dlinat): \n            ma = max(t[i + 1] - t[i], ma)\n        p.append([ma, o])\n    p.sort()\n    ans = [p[0]]\n    dlinap = len(p)\n    for i in range(1, dlinap):\n        if ans[-1][0] != p[i][0]:\n            ans.append(p[i])\n    ans.append([n + 1, 1e9])\n    dlina_1 = ans[0][0] - 1\n    print(*[-1 for i in range(dlina_1)], end=" ")\n    dlinaans = len(ans) - 1\n    for i in range(dlinaans):\n        x = min(x, ans[i][1])\n        dlinax = ans[i + 1][0] - ans[i][0]\n        print(*[x for o in range(dlinax)], end=" ")\n    print()\n           \n        \n            \n    \n    \n    \n    \n    \n    \n            \n                \n        \n    \n            \n        \n\n            \n        \n    \n                \n    \n    \n    \n            \n    \n        \n    \n\nfor i in range(int(sys.stdin.readline().strip()) ):\n    main()\n    \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13109