This week Arkady wanted to cook some pancakes (to follow ancient traditions) and make a problem about that. But then he remembered that one can't make a problem about stacking pancakes without working at a specific IT company, so he decided to bake the Napoleon cake instead.

To bake a Napoleon cake, one has to bake $n$ dry layers first, and then put them on each other in one stack, adding some cream. Arkady started with an empty plate, and performed the following steps $n$ times:

place a new cake layer on the top of the stack;

after the $i$-th layer is placed, pour $a_i$ units of cream on top of the stack.

When $x$ units of cream are poured on the top of the stack, top $x$ layers of the cake get drenched in the cream. If there are less than $x$ layers, all layers get drenched and the rest of the cream is wasted. If $x = 0$, no layer gets drenched.

The picture represents the first test case of the example.

Help Arkady determine which layers of the cake eventually get drenched when the process is over, and which don't.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 20000$). Description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of layers in the cake.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le n$) — the amount of cream poured on the cake after adding each layer.

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


-----Output-----

For each test case, print a single line with $n$ integers. The $i$-th of the integers should be equal to $1$ if the $i$-th layer from the bottom gets drenched, and $0$ otherwise.


-----Examples-----

Input
3
6
0 3 0 0 1 3
10
0 0 0 1 0 5 0 0 0 2
3
0 0 0
Output
1 1 0 1 1 1 
0 1 1 1 1 1 0 0 1 1 
0 0 0


-----Note-----

None

Difficulty: EASY
Tags: Dynamic programming

Sorting

Implementation
Skill types: Dynamic programming

Sorting

Starter code:

Solutions:
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0] + l
	for i in range(n - 1, 0, -1):
		ans[i] = max(ans[i + 1] - 1, ans[i])
	for i in range(1, n + 1):
		if ans[i] > 0:
			print('1', end=' ')
		else:
			print('0', end=' ')
	print('')


a = eval(input())
for _ in range(a):
	b = eval(input())
	c = input().split()
	c = [int(x) for x in c]
	i = len(c) - 1
	j = len(c)
	ls = [0] * b
	while i >= 0:
		t = i - c[i]
		if t < j:
			j = t
		if j < i:
			ls[i] = 1
		elif j == len(c) and c[i] != 0:
			ls[i] = 1
		i -= 1
	ls = [str(x) for x in ls]
	print(' '.join(ls))


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	v = [0] * (n + 1)
	for (i, j) in enumerate(R()):
		v[i + 1] -= 1
		v[max(0, i - j + 1)] += 1
	p = 0
	for i in v[:-1]:
		p += i
		print(1 if p else 0, end=' ')
	print()


def solve(n, arr):
	arr.reverse()
	power = 0
	s = []
	for i in arr:
		if i > power:
			power = i
		if power > 0:
			s.append('1')
			power -= 1
		else:
			s.append('0')
	s.reverse()
	return ' '.join(s)
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	print(solve(n, arr))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	curr = n - 1
	ans = ['0'] * n
	while curr >= 0:
		units = arr[curr]
		if units == 0:
			curr -= 1
		while units and curr >= 0:
			ans[curr] = '1'
			curr -= 1
			units = max(units - 1, arr[curr])
	print(' '.join(ans))


def napolean(arr, n):
	res = [0] * n
	p = 0
	for i in range(n):
		v = n - i - 1
		k = arr[v]
		p = max(p, k)
		if p >= 1:
			res[v] = 1
			p = p - 1
	return res
t = int(input())
ans = []
for i in range(t):
	p = int(input())
	a = list(map(int, input().split()))
	ans.append(napolean(a, p))
for l in ans:
	print(*l)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	g = [0] * n
	sumo = n - 1
	for j in range(n - 1, -1, -1):
		if j - a[j] < sumo:
			sumo = j - a[j]
		if j > sumo:
			g[j] = 1
	print(' '.join(map(str, g)))


from sys import stdin, stdout
stdin.readline

def mp():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(stdin.readline().strip())
from collections import defaultdict as dd, Counter as C, deque
from math import ceil, gcd, sqrt, factorial
for _ in range(it()):
	n = it()
	l = mp()
	l.reverse()
	v = [0] * n
	ma = 0
	for i in range(n):
		ma = max(ma, l[i])
		if ma > 0:
			v[i] = 1
			ma -= 1
		else:
			ma = 0
	v.reverse()
	print(*v)


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac
for xyz in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0] * (n + 1)
	for i in range(0, n):
		ans[i + 1] -= 1
		ans[max(0, i - l[i] + 1)] += 1
	for i in range(1, n + 1):
		ans[i] += ans[i - 1]
	for i in range(0, n):
		ans[i] = min(1, ans[i])
	print(*ans[:-1])


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		a = list(map(int, stdin.readline().split(' ')))
		b = []
		i = n - 1
		x = 0
		while i >= 0:
			if a[i] > x:
				x = a[i]
			if x > 0:
				b.append(1)
				x -= 1
			else:
				b.append(0)
			i -= 1
		b.reverse()
		print(*b, sep=' ')
main()


for s in [*open(0)][2::2]:
	r = []
	m = 1
	for x in s.split()[::-1]:
		m = max(m - 1, int(x))
		r += (+(m > 0),)
	print(*r[::-1])


t = int(input())
itog = []
for l in range(t):
	n = int(input())
	mass = list(map(int, input().split()))
	mass1 = []
	count = 0
	for i in range(n - 1, -1, -1):
		if mass[i] > count:
			count = mass[i]
		if count > 0:
			count -= 1
			mass1.append(1)
		else:
			mass1.append(0)
	itog.append(reversed(mass1))
for i in itog:
	print(*i)


for s in [*open(0)][2::2]:
	m = 1
	a = s.split()
	i = len(a)
	while i:
		i -= 1
		m = max(m - 1, int(a[i]))
		a[i] = +(m > 0)
	print(*a)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import *
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import *
from time import time

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for i in range(t):
	n = int(input())
	l = get_list()
	if max(l) == 1:
		print(*l)
		continue
	l.reverse()
	m = defaultdict(int)
	for i in range(n):
		m[i] += 1
		m[i + l[i]] -= 1
		m[i] += m[i - 1]
	k = [0] * n
	for i in range(n):
		if m[i]:
			k[i] = 1
	k.reverse()
	print(*k)


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, log2, sqrt
import bisect
import sys
import copy

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = get_array()
	ans = [0] * n
	for i in range(n):
		ind = max(0, i - a[i] + 1)
		if a[i] > 0:
			ans[ind] += 1
			if i != n - 1:
				ans[i + 1] -= 1
	for i in range(1, len(ans)):
		ans[i] += ans[i - 1]
	c = []
	for i in range(n):
		if ans[i] <= 0:
			c.append(0)
		else:
			c.append(1)
	print(*c)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		r = reversed(range(n))
		d = a[n - 1]
		ans = ''
		for i in r:
			d = max(d, a[i])
			if d > 0:
				ans += ' 1'
			else:
				ans += ' 0'
			if d > 0:
				d -= 1
		print(ans[::-1])
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = []
	i = n - 1
	b = 0
	current = 0
	while i >= 0:
		if l[i] > current:
			current = l[i]
		if current == 0:
			a.append(0)
		else:
			a.append(1)
			current -= 1
		i -= 1
	a.reverse()
	print(*a)


counter = int(input())
for count in range(counter):
	n = int(input())
	a = list(map(int, input().split()))
	l = n
	c = [0] * n
	for i in range(n - 1, -1, -1):
		l = min(i - a[i] + 1, l)
		if i < l:
			c[i] = 0
		else:
			c[i] = 1
	for i in c:
		print(i, end=' ')
	print()


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, gcd
import bisect
import sys
import copy

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	ans = [0] * n
	till = n
	for i in range(n - 1, -1, -1):
		till = min(till, i - arr[i])
		if till < i:
			ans[i] = 1
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	nums = input().split()
	ans = [0] * n
	k = False
	for i in range(n - 1, -1, -1):
		k = max(k, int(nums[i]))
		if k:
			ans[i] = 1
			k -= 1
	print(*ans)


def calc(no_of_layers: int, pouring_sequence: list):
	layers = [0] * no_of_layers
	i = no_of_layers
	while i > 0:
		i -= 1
		start_index = max(i - pouring_sequence[i] + 1, 0)
		while i >= start_index:
			layers[i] = 1
			i -= 1
			start_index = min(start_index, max(i - pouring_sequence[i] + 1, 0))
	return layers
for _ in range(int(input())):
	n = int(input())
	pouring_sequence = list(map(int, input().split()))
	for layer in calc(n, pouring_sequence):
		print(layer, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	pan = list(map(int, input().split()))
	curr = 0
	for i in range(n - 1, -1, -1):
		if pan[i] > 0:
			curr = max(pan[i], curr) - 1
			pan[i] = 1
		elif curr > 0:
			pan[i] = 1
			curr -= 1
	print(*pan)


test = int(input())
for k in range(test - 1, -1, -1):
	n = int(input())
	a = [int(item) for item in input().split()]
	out = [0] * len(a)
	temp = a[n - 1]
	for i in range(n - 1, -1, -1):
		if temp > 0 or a[i] > 0:
			out[i] = 1
			temp = max(temp, a[i])
			temp -= 1
	print(*out, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	a = reversed(list(map(int, input().split())))
	f = []
	c = 0
	for x in a:
		if x > c:
			c = x
		if c > 0:
			f.append('1')
		else:
			f.append('0')
		c -= 1
	print(' '.join(reversed(f)))


for i in range(int(input())):
	l = int(input())
	data = [int(num) for num in input().split(' ')]
	result = []
	count = data[-1]
	for i in range(l - 1, -1, -1):
		count = max(count, data[i])
		if count > 0:
			result.append('1')
			count -= 1
		else:
			result.append('0')
	result.reverse()
	print(' '.join(result))


import sys
import math
from collections import defaultdict, Counter, deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = [0] * n
	end = n
	for j in range(n - 1, -1, -1):
		end = min(end, j + 1 - a[j])
		if end <= j:
			ans[j] = 1
	print(*ans)


t = int(input())
r = 0
A = []
while 0 <= r < t:
	r += 1
	n = int(input())
	m = [int(n) for n in input().split()]
	k = n
	d = 0
	B = []
	e = ''
	while 0 < k <= n:
		k = k - 1
		if m[k] == 0:
			if d > 0:
				d = d - 1
				B.append('1')
			else:
				B.append('0')
		elif m[k] != 0:
			if m[k] > d:
				d = m[k]
				B.append('1')
				d = d - 1
			else:
				B.append('1')
				d = d - 1
	B.reverse()
	p = -1
	while -1 <= p < n - 1:
		p = p + 1
		e += B[p] + ' '
	A.append(e)
f = -1
while -1 <= f < t - 1:
	f = f + 1
	print(A[f].rstrip())


t = int(input())
mas = [0] * (2 * 10 ** 5 + 1)
for i in range(t):
	n = int(input())
	cnt = 0
	buf = input().split()
	for j in range(n, 0, -1):
		x = int(buf[j - 1])
		cnt = max(cnt, x)
		if cnt > 0:
			mas[j] = 1
			cnt -= 1
		else:
			mas[j] = 0
	for j in range(1, n + 1):
		print(mas[j], end=' ')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = [0 for _ in range(n)]
	k = n - 1
	for i in range(n - 1, -1, -1):
		for j in range(min(k, i), max(-1, i - a[i]), -1):
			l[j] = 1
		k = min(min(k, i), max(-1, i - a[i]))
	print(*l)


NUMBER = int(input())
for NUMBERi in range(NUMBER):
	n = int(input())
	a = list(map(int, input().split(' ')))
	ba = []
	for ni in range(n):
		ba += [False]
	minai = n
	if a[0] > 0:
		ba[0] = True
	for ai in range(n - 1, 0, -1):
		if a[ai] > 0:
			for aii in range(min(minai - 1, ai), max(ai - a[ai], -1), -1):
				ba[aii] = True
				minai = aii
	for bai in ba:
		if bai:
			print(1, end=' ')
		else:
			print(0, end=' ')
	print()


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
GAP = 2
for t in [wtf[i:i + GAP] for i in range(1, len(wtf), GAP)]:
	n = int(t[0])
	A = list(map(int, t[1].split()))
	B = [0] * n
	P = 0
	i = n - 1
	while i >= 0:
		if P < A[i]:
			P = A[i]
		if P > 0:
			B[i] = 1
			P -= 1
		i -= 1
	print(' '.join(map(str, B)))


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	start = [set() for _ in range(n)]
	end = [False for _ in range(n)]
	res = [0 for _ in range(n)]
	cur = set()
	for i in range(n):
		if a[i] != 0:
			start[max(i - a[i] + 1, 0)].add(i)
			end[i] = True
	for i in range(n):
		for item in start[i]:
			cur.add(item)
		res[i] = 1 if len(cur) != 0 else 0
		if end[i]:
			cur.remove(i)
	print(*res, sep=' ')


from math import ceil
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	mx = 0
	ans = [0] * n
	for i in range(n - 1, -1, -1):
		mx = max(mx, l[i])
		if mx:
			ans[i] = 1
		mx -= 1
	print(*ans)
	t -= 1


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	c = inlt()
	cake = ''
	cream = 0
	result = ['0' for i in range(n)]
	for i in range(n - 1, -1, -1):
		if c[i]:
			cream = max(cream, c[i])
		if cream > 0:
			result[i] = '1'
			cream -= 1
	print(' '.join(result))


import itertools
import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		layers = [0] * n
		for i in range(n):
			a_i = a[i]
			if a_i > 0:
				(u, d) = (i, max(0, i - a_i + 1))
				if u < n - 1:
					layers[u + 1] -= 1
				layers[d] += 1
		ans = []
		p = 0
		for l in layers:
			p += l
			if p > 0:
				ans.append(1)
			else:
				ans.append(0)
		print(*ans)
main()


test = int(input())
for t in range(test):
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))[:n]
	out = [1] * n
	temp = 0
	flag = 0
	for i in reversed(range(n)):
		if arr[i] > temp:
			temp = arr[i]
		elif arr[i] < temp:
			temp = temp - 1
		if arr[i] == temp:
			temp = temp
		if arr[i] == 0 and temp == 0:
			out[i] = 0
	for element in out:
		print(element, end=' ')
	print()


n = int(input())
for _ in range(n):
	m = int(input())
	souce = list(map(int, input().split()))
	souce = souce[::-1]
	souce_left = 0
	current_layer = m
	ans = []
	for a in souce:
		souce_left = max(souce_left, a)
		if souce_left > 0:
			ans.append(1)
			souce_left -= 1
		else:
			ans.append(0)
	print(' '.join(map(str, ans[::-1])))


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	a = list(map(int, sys.stdin.readline().split()))
	psa = [0 for i in range(n)]
	for j in range(n - 1, -1, -1):
		if a[j] != 0:
			if j < n - 1:
				psa[j + 1] -= 1
			if j - a[j] + 1 < 0:
				psa[0] += 1
			else:
				psa[j - a[j] + 1] += 1
	for j in range(1, n):
		psa[j] += psa[j - 1]
	for j in range(n):
		if psa[j] > 0:
			print(1, end=' ')
		else:
			print(0, end=' ')
	print('')


from sys import stdin
t = int(stdin.readline())
while t:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	cream = 0
	dp = ['0'] * n
	for (i, ai) in enumerate(a[::-1]):
		cream = max(cream, ai)
		if cream > 0:
			dp[i] = '1'
		cream -= 1
	print(' '.join(dp[::-1]))
	t -= 1


for _ in range(int(input())):
	(cake, layers, x) = ([0] * int(input()), [int(i) for i in input().split()], 0)
	for i in range(len(layers) - 1, -1, -1):
		x = max(x - 1, layers[i])
		if x > 0:
			cake[i] = 1
	print(*cake)


def get_result(ar, n):
	stack = []
	ans = [0] * n
	for (i, val) in enumerate(ar):
		if val == 0:
			stack.append(i)
			continue
		ans[i] = 1
		val -= 1
		prev = val
		while stack and i - stack[-1] <= prev and val:
			top = stack.pop()
			ans[top] = 1
			val -= 1
	print(*ans)

def main():
	test = int(input())
	for _ in range(test):
		n = int(input())
		arr = list(map(int, input().split(' ')))
		get_result(arr, n)
main()


t = int(input())
for i in range(0, t):
	m = int(input())
	arr = list(map(int, input().strip().split()))[:m]
	brr = [0] * m
	k = m - 1
	while k > -1:
		x = arr[k]
		ct = 0
		while x > 0 and k > -1:
			x = max(arr[k], x)
			brr[k] = 1
			k -= 1
			x -= 1
			ct = 1
		if ct == 0:
			k -= 1
	print(*brr, sep=' ')


tests = int(input())
for _ in range(tests):
	n = int(input())
	a = list(map(int, input().split()))
	answers = []
	drenched = 0
	cur_max = 0
	for value in reversed(a):
		cur_max = max(cur_max - 1, value)
		answers.append('1' if cur_max > 0 else '0')
	print(' '.join(reversed(answers)))


from sys import stdin

def main():
	MAX_N = 200000
	a = [0] * MAX_N
	drenched = [0] * MAX_N

	def solve():
		N = int(next(tokens))
		for i in range(N):
			a[i] = int(next(tokens))
		current_cream = 0
		for i in range(N - 1, -1, -1):
			current_cream = max(current_cream, a[i])
			if current_cream > 0:
				current_cream -= 1
				drenched[i] = 1
			else:
				drenched[i] = 0
		print(*drenched[:N])
	tokens = iter(stdin.read().split())
	T = int(next(tokens))
	for t in range(T):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	bread = [0 for i in range(n)]
	arr.reverse()
	add = 0
	for i in range(n):
		add = max(add, arr[i])
		if add > 0:
			bread[n - i - 1] = 1
			add -= 1
	print(*bread)


t = int(input())
for _ in range(t):
	layers = int(input())
	amount = list(map(int, input().split()))
	res = layers * [0]
	current = 0
	for i in range(layers - 1, -1, -1):
		current = max(current, amount[i])
		if current > 0:
			res[i] = 1
			current -= 1
	print(' '.join([str(x) for x in res]))


n = int(input())
anss = []
for i in range(n):
	m = int(input())
	inp = list(map(int, input().split()))
	t = m - 1
	cu = inp[t]
	ans = []
	for r in range(t, -1, -1):
		cu = max(cu, inp[r])
		if cu >= 1:
			cu -= 1
			ans.append(1)
		else:
			ans.append(0)
	anss.append(ans)
for i in anss:
	i.reverse()
	an = ' '.join(list(map(str, i)))
	print(an)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = [0] * n
	m = a[n - 1]
	for i in range(n - 1, -1, -1):
		m = max(m, a[i])
		if m > 0:
			l[i] = 1
		m -= 1
	print(*l)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	z = [0] * n
	k = 0
	n = n - 1
	while n >= 0:
		k = max(k, l[n])
		if k > 0:
			z[n] = 1
		k = k - 1
		n = n - 1
	for t in z:
		print(t, end=' ')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	l1 = [0 for i in range(n)]
	for i in range(n - 1, -1, -1):
		s = max(s, l[i])
		if s > 0:
			l1[i] = 1
			s -= 1
	print(*l1)


for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	nums.reverse()
	mx = 0
	arr = []
	for i in nums:
		mx = max(mx - 1, i)
		if mx != 0:
			arr.append('1')
		else:
			arr.append('0')
	arr.reverse()
	print(' '.join(arr))


T = int(input())

def solve(N, nums):
	ans = [str(0)] * N
	q = []
	for i in range(N):
		if nums[i] != 0:
			q.append((max(0, i + 1 - nums[i]), i))
	q.sort()
	(last_f, last_t) = (None, None)
	for (f, t) in q:
		if last_f is None:
			last_f = f
			last_t = t
			continue
		if f <= last_t:
			last_t = max(last_t, t)
		else:
			for i in range(last_f, last_t + 1, 1):
				ans[i] = str(1)
			last_f = f
			last_t = t
	if last_f is not None:
		for i in range(last_f, last_t + 1, 1):
			ans[i] = str(1)
	return ans
for _ in range(T):
	N = int(input())
	nums = list(map(int, input().split()))
	ans = solve(N, nums)
	print(' '.join(ans))


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = [0] * n
	suff = [0] * n
	if a[-1] > 0:
		suff[-1] += 1
		if n - 1 - a[-1] >= 0:
			suff[n - 1 - a[-1]] -= 1
	if suff[n - 1] > 0:
		ans[n - 1] = 1
	for i in range(n - 2, -1, -1):
		if a[i] > 0:
			suff[i] += 1
			if i - a[i] >= 0:
				suff[i - a[i]] -= 1
		suff[i] += suff[i + 1]
		if suff[i] == 0:
			continue
		ans[i] = 1
	print(*ans)


def answer(n, a):
	ans = [0] * n
	for j in range(n - 1, -1, -1):
		for i in range(a[j]):
			if j - i >= 0:
				ans[j - i] = 1
	return ' '.join(map(str, ans))

def answer2(n, a):
	ans = [0] * n
	aptr = n - 1
	ansptr = n - 1
	while aptr >= 0 and ansptr >= 0:
		d = aptr - ansptr
		if a[aptr] > d:
			for i in range(min(a[aptr] - d, ansptr + 1)):
				ans[ansptr] = 1
				ansptr -= 1
		aptr -= 1
		if aptr < ansptr:
			ansptr = aptr
	return ' '.join(map(str, ans))

def main():
	t = int(input())
	n = [0] * t
	a = [0] * t
	for j in range(t):
		n[j] = int(input())
		a[j] = [int(i) for i in input().split()]
	for j in range(t):
		print(answer2(n[j], a[j]))
main()


def napoleon_cake(num_tests):
	for _ in range(0, num_tests):
		num_layers = int(input())
		layers = list(map(int, input().split()))
		current_drizzle = layers[-1]
		for i in range(num_layers - 1, -1, -1):
			if layers[i] > current_drizzle:
				current_drizzle = layers[i]
			if current_drizzle > 0:
				layers[i] = 1
			current_drizzle -= 1
		print(' '.join([str(x) for x in layers]).strip())
napoleon_cake(int(input()))


n = int(input())
z = []
for _ in range(n):
	a = int(input())
	l = list(map(int, input().split()))
	c = l[len(l) - 1]
	r = [0] * a
	for i in range(len(l) - 1, -1, -1):
		if l[i] >= c:
			c = l[i]
		if c > 0 and l[i] <= c:
			r[i] = 1
			c -= 1
		else:
			r[i] = 0
	z.append(r)
for i in z:
	for j in i:
		print(j, end=' ')
	print()


def get_layers_status(aa):
	n = len(aa)
	intervals = []
	for i in range(n):
		if aa[i] > 0:
			intervals.append([max(0, i + 1 - aa[i]), i + 1])
	endpoints = [(s, 0) for (s, e) in intervals] + [(e, 1) for (s, e) in intervals]
	endpoints.sort(key=lambda x: x[0] - 0.1 * x[1])
	count = 0
	merged_intervals = []
	for e in endpoints:
		if e[1] == 1:
			count -= 1
			if count == 0:
				end = e[0]
				merged_intervals.append((start, end))
		else:
			if count == 0:
				start = e[0]
			count += 1
	assert count == 0
	result = [0] * n
	for (start, end) in merged_intervals:
		for x in range(start, end):
			result[x] = 1
	return result
n_t = int(input())
for t in range(n_t):
	n = int(input())
	aa = list(map(int, input().split(' ')))
	assert len(aa) == n
	result = get_layers_status(aa)
	print(' '.join(map(str, result)))


t = int(input())
for _ in range(t):
	n = int(input())
	li = [int(i) for i in input().split()]
	cnt = 0
	for i in range(len(li) - 1, -1, -1):
		if li[i] > cnt:
			cnt = li[i]
		if cnt > 0:
			li[i] = 1
			cnt -= 1
	print(' '.join(map(str, li)))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	k = 0
	for j in range(n - 1, -1, -1):
		k = max(k, a[j])
		if k > 0:
			a[j] = 1
			k -= 1
	print(' '.join(map(str, a)))


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	a = inl()
	ans = [0] * n
	count = 0
	for i in range(n - 1, -1, -1):
		count = max(count, a[i])
		if count > 0:
			ans[i] = 1
			count -= 1
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	o = [0] * n
	remain = 0
	for i in range(n - 1, -1, -1):
		if l[i] > 0 or remain > 0:
			o[i] = 1
		remain = max(remain - 1, l[i] - 1)
	print(*o, sep=' ')


for _ in range(int(input())):
	layers = int(input())
	a = list(map(int, input().split()))
	temp = 0
	b = []
	for i in range(layers - 1, -1, -1):
		temp = max(temp, a[i])
		if temp > 0:
			b.append(1)
		else:
			b.append(0)
		temp -= 1
	for i in range(len(b) - 1, -1, -1):
		print(b[i], end=' ')


import math

def solve():
	n = int(input())
	dr = list(map(int, input().split()))
	i = n - 1
	av = dr[i]
	res = []
	while i >= 0:
		if dr[i] > av:
			av = dr[i]
		if av > 0:
			res.append('1')
			av -= 1
		else:
			res.append('0')
		i -= 1
	return ' '.join(list(reversed(res)))
tc = int(input())
for _ in range(tc):
	print(solve())


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = []
	ans = [0] * n
	for i in range(n):
		l1.append(i)
		if l[i]:
			while len(l1) and l1[-1] >= i - l[i] + 1:
				ans[l1[-1]] = 1
				l1.pop()
	print(*ans)


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	sol = [0 for i in range(n)]
	x = 0
	for i in range(n - 1, -1, -1):
		x = max(x, l[i])
		if x > 0:
			x -= 1
			sol[i] = 1
	print(*sol)


try:
	test = int(input())
	while test != 0:
		n = int(input())
		lst = list(map(int, input().split()))
		i = len(lst) - 1
		count = 0
		for i in range(len(lst) - 1, -1, -1):
			count = max(count, lst[i])
			lst[i] = 1 if count > 0 else 0
			count -= 1
		print(*lst)
		test -= 1
except EOFError:
	print(' ')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a = a[::-1]
	for i in range(n - 1):
		if a[i] > 1:
			p = a[i] - 1
			if p > a[i + 1]:
				a[i + 1] = p
			a[i] = 1
	if a[-1] > 1:
		a[-1] = 1
	print(*a[::-1])


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	A = list(map(int, sys.stdin.readline().split()))
	zeros = []
	for (i, a) in enumerate(A):
		if a == 0:
			zeros.append(i)
			continue
		while zeros and a > i - zeros[-1]:
			del zeros[-1]
	ans = ['1'] * n
	for i in zeros:
		ans[i] = '0'
	print(' '.join(ans))


from io import BytesIO, IOBase
import sys, os
inpl = lambda : list(map(int, input().split()))
inpm = lambda : map(int, input().split())
inpi = lambda : int(input())
inp = lambda : input()
(rev, ra, l) = (reversed, range, len)
P = print
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_left as bl
from bisect import bisect_right as br
import sys, operator, math, operator
from collections import Counter
tc = inpi()
while tc:
	tc -= 1
	n = inpi()
	li = inpl()
	dp = [0] * n
	prev = n - 2
	for i in reversed(ra(n)):
		if li[i] != 0:
			dp[i] = 1
			if i <= prev:
				prev = i - 1
			rem = li[i] - (i - prev)
			while rem > 0 and prev >= 0:
				dp[prev] = 1
				prev -= 1
				rem -= 1
	for i in ra(n):
		if dp[i]:
			P('1', end=' ')
		else:
			P('0', end=' ')
	P()


for _ in range(int(input())):
	n = int(input())
	w = list(map(int, input().split()))
	for i in range(n - 2, -1, -1):
		w[i] = max(w[i], w[i + 1] - 1)
	print(' '.join(['1' if x > 0 else '0' for x in w]))


import sys
YES = 'YES'
NO = 'NO'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def solve():
	n = input_int()
	a = input_list_int()
	b = [0] * n
	cur = 0
	for i in range(n - 1, -1, -1):
		if a[i] > 0:
			b[i] = 1
			cur = max(cur - 1, a[i] - 1)
		elif cur > 0:
			b[i] = 1
			cur -= 1
		else:
			b[i] = 0
	print(' '.join((str(x) for x in b)))
query_count = input_int()
while query_count:
	query_count -= 1
	solve()


t = int(input())
g = []
for i in range(t):
	x = int(input())
	p = input().split()
	d = 0
	k = x - 1
	l = []
	while k >= 0:
		a = int(p[k])
		d = max(d, a)
		if d == 0:
			l.append(0)
		else:
			l.append(1)
			d += -1
		k += -1
	l.reverse()
	g.append(l)
for h in g:
	for s in h:
		print(s, end=' ')
	print()


import math

def getint():
	return [int(i) for i in input().split()]

def getstr():
	return [str(i) for i in input().split()]

def solve():
	n = int(input())
	a = getint()
	ans = ''
	l = 0
	for i in range(n - 1, -1, -1):
		if a[i] == 0:
			if l <= n - 1 - i:
				ans += '0'
				l += 1
		else:
			leng = min(a[i] - l + n - 1 - i, n - l)
			if leng < 0:
				leng = 0
			l += leng
			ans += '1' * leng
	print(' '.join(ans[::-1]))
for _ in range(int(input())):
	solve()


def main():
	from sys import stdin, stdout
	rl = stdin.readline
	wl = stdout.write
	for _ in range(int(rl())):
		n = int(rl())
		a = [int(x) for x in rl().split()]
		drenched = [0] * n
		layers = 0
		for i in range(n - 1, -1, -1):
			layers = max(a[i], layers - 1)
			if layers:
				drenched[i] = 1
		wl(' '.join((str(x) for x in drenched)) + '\n')
main()


def napoleon_cake_2(arr, layers):
	min_level = arr[layers - 1]
	for a in range(layers - 1, -1, -1):
		min_level = max(arr[a], min_level)
		if min_level != 0:
			arr[a] = 1
			min_level -= 1
	arr = [str(i) for i in arr]
	return ' '.join(arr)
n = int(input())
for i in range(0, n):
	layers = int(input())
	lst = input().split(' ')
	lst = [int(i) for i in lst]
	print(napoleon_cake_2(lst, layers))


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0 for i in range(n)]
	t = 0
	for i in range(n - 1, -1, -1):
		if l[i] != 0:
			if t < l[i]:
				t = l[i]
		if t > 0:
			ans[i] = 1
		t -= 1
	print(*ans)


for i in range(int(input())):
	n = int(input())
	a = [int(g) for g in input().split()]
	cake = [0] * n
	spoon = 0
	for g in range(n - 1, -1, -1):
		spoon = max(spoon, a[g])
		if spoon != 0:
			spoon -= 1
			cake[g] = 1
	print(' '.join([str(h) for h in cake]))


import math
import sys
import collections
import bisect
import string
import time

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	n = int(input())
	arr = get_list()
	ans = [0] * n
	pos = n
	for i in range(n - 1, -1, -1):
		pos = min(i - arr[i], pos)
		if i > pos:
			ans[i] = 1
	print(*ans)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	cur = n - 1
	for i in reversed(range(n)):
		if a[i]:
			m = i - a[i]
			if m < cur:
				cur = m
		if cur < i:
			a[i] = '1 '
		else:
			a[i] = '0 '
	ans.append(''.join(a))
print('\n'.join(ans))


import os, sys, math
from io import BytesIO, IOBase
read = lambda : map(int, input().split(' '))

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(read())
		notdrench = [0] * n
		reach = [0] * n
		for i in range(n):
			reach[i] = i - a[i] + 2
		reachfrom = [reach[-1]] * n
		m = reach[-1]
		for i in range(1, n):
			if m > reach[n - i - 1]:
				m = reach[n - i - 1]
			reachfrom[n - i - 1] = m
		for i in range(n):
			if reachfrom[i] <= i + 1:
				notdrench[i] = 1
		print(*notdrench)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def napolean(n, arr):
	l = []
	k = 0
	for i in range(n):
		v = arr[n - i - 1]
		k = max(v, k)
		if k >= 1:
			l.append(1)
			k = k - 1
		else:
			l.append(0)
	l = reversed(l)
	return l
t = int(input())
res = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	l = napolean(n, arr)
	res.append(l)
for i in res:
	print(*i, sep=' ')


def solve(arr):
	arr.reverse()
	res = []
	n = 0
	for i in arr:
		if i:
			n = max(n, i)
		if n > 0:
			res.append(1)
			n -= 1
		else:
			res.append(0)
	return res[::-1]
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	ans.append(solve(arr))
for i in ans:
	print(*i)


from math import *
from collections import defaultdict as dt
from sys import stdin
inp = lambda : stdin.readline().strip()
I = lambda : int(inp())
M = lambda : map(int, stdin.readline().split())
L = lambda : list(map(int, stdin.readline().split()))
mod = 1000000009
inf = 100000000000000000000
ss = 'abcdefghijklmnopqrstuvwxyz'

def solve():
	n = I()
	a = L()
	c = 0
	b = [0 for i in range(n)]
	e = []
	for i in range(n):
		if a[i] > 0:
			e.append([max(0, i - a[i] + 1), i + 1])
			c = i + 1
	e = sorted(e, key=lambda x: x[0])
	c = 0
	for i in e:
		for j in range(max(i[0], c), max(c, i[1])):
			b[j] = 1
		c = max(c, i[1])
	print(*b)
tt = 1
tt = I()
for _ in range(tt):
	solve()


count = int(input())
for x in range(count):
	count_layers = int(input())
	array_cream = [int(x) for x in input().split(' ')]
	result_array = []
	count_cream = 0
	x = 1
	while x != len(array_cream) + 1:
		if array_cream[-x] > count_cream:
			count_cream = array_cream[-x] - 1
			result_array.append('1')
		elif count_cream > 0:
			result_array.append('1')
			count_cream -= 1
		elif count_cream == 0 and array_cream[-x] == 0:
			result_array.append('0')
		else:
			count_cream = array_cream[-x] - 1
			result_array.append('1')
		x += 1
	print(' '.join(result_array[::-1]))


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	dip = 0
	ans = []
	for i in range(n - 1, -1, -1):
		dip = max(lst[i], dip)
		if dip > 0:
			dip -= 1
			ans.append(1)
		else:
			ans.append(0)
	for i in range(n - 1, -1, -1):
		print(ans[i], end=' ')
	print()
t = int(input())
for i in range(t):
	solve()


import sys
from math import ceil
from _collections import deque
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	for (i, v) in enumerate(a):
		if v:
			id = max(0, i - v + 1)
			b[id] = i + 1
	ans = [0] * n
	ck = 0
	i = 0
	while i < n:
		if b[i]:
			ck = b[i]
			while i < n and i < ck:
				ans[i] = 1
				ck = max(ck, b[i])
				i += 1
		else:
			i += 1
	for i in ans:
		print(i, end=' ')
	print()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
ans = []
tests = inp()
for _ in range(tests):
	n = inp()
	a = inlt()
	cur = 0
	res = []
	for s in reversed(a):
		cur = max(cur, s)
		if cur > 0:
			res.append('1')
		else:
			res.append('0')
		cur -= 1
	ans.append(reversed(res))
for a in ans:
	print(' '.join(a))


t = int(input())
n = []
a = []
for i in range(t):
	n.append(int(input()))
	temp = list(map(int, input().split()))
	a.append(temp)
for ai in range(len(a)):
	l = 0
	for aii in range(len(a[ai]) - 1, -1, -1):
		l = max(l, a[ai][aii])
		if l != 0:
			a[ai][aii] = 1
		l -= 1
for aa in a:
	print(*aa, sep=' ')


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		cream = list(map(int, input().split(' ')))
		cream.reverse()
		mx = 0
		for i in range(len(cream)):
			mx = max(mx, i + cream[i])
			cream[i] = i < mx
		cream.reverse()
		print(' '.join(map(lambda x: str(int(x)), cream)))
main()


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	otv = [0] * n
	uk = 0
	for i in range(n - 1, -1, -1):
		uk = max(uk, a[i])
		if uk > 0:
			otv[i] = 1
		uk -= 1
	ans.append(otv)
for i in ans:
	print(*i)


from sys import stdin
input = stdin.readline

def ceil(c):
	if int(c) == c:
		return int(c)
	return int(c) + 1

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def floor(f):
	return int(f)

def sqrt(s):
	return s ** 0.5

def max(a, b):
	return a if a > b else b

def abs(a):
	return a if a >= 0 else -1 * a

def min(a, b):
	return a if a < b else b

def primeInRange(n):
	l = [True] * n
	for i in range(2, int(sqrt(n)) + 1):
		if l[i - 1]:
			for j in range(i + i, n + 1, i):
				l[j - 1] = False
	return l

def solve(n):
	cream = list(map(int, input().split()))
	a = [0] * n
	temp = 0
	for i in range(n - 1, -1, -1):
		temp = max(temp, cream[i])
		if temp > 0:
			a[i] = 1
			temp -= 1
	return a
for u in range(int(input())):
	print(*solve(int(input())))


from sys import stdin
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	dp = [0] * n
	nl = 0
	for i in range(n - 1, -1, -1):
		nl = max(nl, a[i])
		dp[i] = int(nl > 0)
		nl -= 1
	print(*dp)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = [0] * n
	temp = 0
	for i in range(n - 1, -1, -1):
		temp = max(arr[i], temp)
		ans[i] = min(temp, 1)
		temp = max(temp - 1, 0)
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ali = list(map(int, input().split()))
	ans = [0] * n
	max1 = -1
	for i in range(n - 1, -1, -1):
		if ali[i] > 0:
			if ali[i] > max1:
				max1 = ali[i]
		if max1 > 0:
			ans[i] = 1
			max1 -= 1
	print(*ans)


import sys, os.path
from math import ceil

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(II()):
	n = II()
	a = LI()
	l = [0] * n
	i = n - 1
	nc = 0
	c = 0
	while i >= 0:
		nc = a[i]
		if nc >= c:
			c = a[i]
			nc = c
		if c > 0:
			l[i] = 1
			c -= 1
		i -= 1
	print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = 1000000
	visited = [0] * n
	for i in range(n - 1, -1, -1):
		m = min(m, i - a[i])
		if i > m:
			visited[i] = 1
	print(*visited)


t = int(input())
l = []
for z in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	for i in range(n - 1, -1, -1):
		x = max(x, a[i])
		if x > 0:
			a[i] = 1
		x -= 1
	a = map(str, a)
	a = ' '.join(a)
	l.append(a)
for i in l:
	print(i)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	b = [0] * n
	if a[n - 1] >= n:
		for i in range(n):
			print('1', end=' ')
		print()
	else:
		i = n - 1
		c = -1
		while i >= 0:
			if a[i] > c:
				c = a[i]
			if c > 0:
				b[i] = 1
			c -= 1
			i -= 1
		for i in range(n):
			print(b[i], end=' ')
		print()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	a = arr[::-1]
	for i in range(n):
		if a[i] > 0:
			x = a[i]
			a[i] = 1
			if i < n - 1:
				a[i + 1] = max(x - 1, a[i + 1])
	sys.stdout.write(' '.join(map(str, a[::-1])) + '\n')


r = []
for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		if d[i] > i:
			d[i] = i + 1
		if d[i] > 0:
			d[i - 1] = max(d[i] - 1, d[i - 1])
			d[i] = 1
	r.append(d)
for i in r:
	print(*i)


def solve():
	global n, a
	ans = [0] * n
	amt = 0
	for i in range(n - 1, -1, -1):
		if a[i] > amt:
			amt = a[i]
		if amt > 0:
			ans[i] = 1
		amt -= 1
	for x in range(n):
		print(ans[x], end=' ')
	print()
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	s = [0] * n
	a.reverse()
	ans = []
	curr = -1
	for i in range(0, n):
		if a[i] >= curr:
			curr = a[i]
		if curr > 0:
			ans.append(1)
			curr -= 1
		else:
			ans.append(0)
	ans.reverse()
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	tmp = [0] * n
	curr = 0
	for i in range(n - 1, -1, -1):
		curr = max(curr, s[i])
		if curr > 0:
			tmp[i] = 1
			curr -= 1
	print(*tmp)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	diff = [0] * (n + 1)
	for i in range(n):
		if arr[i] == 0:
			continue
		r = i
		l = max(0, i - arr[i] + 1)
		diff[l] += 1
		diff[r + 1] -= 1
	for i in range(1, n):
		diff[i] += diff[i - 1]
	for i in range(n):
		if diff[i] > 0:
			diff[i] = 1
	diff.pop()
	print(*diff)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	ans = [0] * n
	dec = 0
	for i in range(n - 1, -1, -1):
		dec = max(dec, lis[i])
		if dec > 0:
			dec -= 1
			ans[i] = 1
	print(*ans)


def main():
	t = int(input())
	for _ in range(t):
		l = int(input())
		layers = [int(i) for i in input().split()]
		layers = layers[::-1]
		results = [0] * l
		k = 0
		for i in range(l):
			if layers[i] > k:
				k = layers[i]
			if k > 0:
				results[i] = '1'
				k -= 1
			else:
				results[i] = '0'
		print(' '.join(results[::-1]))
main()


t = int(input())
for i in range(t):
	n = int(input())
	lst = [int(x) for x in input().split()]
	res = [0] * n
	k = lst[-1]
	for i in range(n - 1, -1, -1):
		k = max(lst[i], k)
		if k >= 1:
			res[i] = 1
		k -= 1
	res_str = ' '.join(map(str, res))
	print(res_str)


t = int(input())
for i in range(t):
	n = int(input())
	b = [0] * n
	a = [int(j) for j in input().split()]
	c = n - a[n - 1]
	for j in range(n - 1, -1, -1):
		c = min(j + 1 - a[j], c)
		if c < j + 1:
			b[j] = 1
	for i in b:
		print(i, end=' ')
	print()


t = int(input())

def solution():
	n = int(input())
	cream = list(map(int, input().split(' ')))
	pie = [0 for _ in range(n)]
	i = n - 1
	mn = n + 1
	while i >= 0:
		mn = min(mn, i + 1 - cream[i])
		if mn <= i:
			pie[i] = 1
		i -= 1
	print(' '.join(map(str, pie)))
for _ in range(t):
	solution()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	j = n - 1
	while j >= 0:
		while j >= 0 and a[j] == 0:
			b[j] = 0
			j -= 1
		if j < 0:
			break
		m = a[j]
		while j > 0 and a[j - 1] < m:
			b[j] = 1
			j -= 1
			m -= 1
		if m > 0:
			b[j] = 1
			j -= 1
	ans = ''
	j = n - 1
	print(' '.join(map(str, b)))


import random

def a(b):
	fuel = 0
	res = []
	for item in b:
		if item > fuel:
			fuel = item
		if not fuel and item == 1:
			fuel = 1
		if fuel:
			res.append('1')
			fuel -= 1
		else:
			res.append('0')
	return ' '.join(res[::-1])
for _ in range(int(input())):
	n = int(input())
	res = a(map(int, input().split()[::-1]))
	print(res)


for _ in range(int(input())):
	drenched_cake_layer = [0] * int(input())
	flowing_cream = 0
	for (cake_layer_index, cream_units) in enumerate(map(int, reversed(input().split())), 1):
		flowing_cream = max(flowing_cream, cream_units) - 1
		if flowing_cream >= 0:
			drenched_cake_layer[-cake_layer_index] = 1
	print(' '.join(map(str, drenched_cake_layer)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cake = [0] * n
	for (i, l) in enumerate(a):
		if l > 0:
			if i - l + 1 > 0:
				cake[i - l + 1] += 1
			else:
				cake[0] += 1
			if i + 1 < n:
				cake[i + 1] -= 1
	for i in range(1, n):
		cake[i] = cake[i - 1] + cake[i]
	for i in range(n):
		if cake[i] > 1:
			cake[i] = 1
	print(*cake)


res = ''
for _ in range(int(input())):
	n = int(input())
	arr = tuple(map(int, input().split()))
	curr_amount = 0
	ans = ''
	for i in arr[::-1]:
		if curr_amount == i == 0:
			ans += ' 0'
		elif curr_amount != 0 and i == 0:
			ans += ' 1'
			curr_amount -= 1
		else:
			ans += ' 1'
			curr_amount = max(i - 1, curr_amount - 1)
	res += ans[::-1] + '\n'
print(res)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	temp = 0
	result = ''
	for g in range(n - 1, -1, -1):
		temp = max(a[g], temp)
		if temp > 0:
			result += ' 1'
			temp -= 1
		else:
			result += ' 0'
	print(result[::-1])


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	b[n - 1] = a[n - 1]
	for i in range(n - 2, -1, -1):
		b[i] = max(b[i + 1] - 1, a[i])
	print(' '.join([('0', '1')[e > 0] for e in b]))


import sys

def pripitka(massivl, lowers):
	pr = []
	pr = ['0' for i in range(0, lowers)]
	edgel = lowers + 1
	for i in range(lowers, 0, -1):
		koll = massivl[i - 1]
		end = i - koll + 1
		if end <= 0:
			end = 1
		for j in range(edgel - 1, end - 1, -1):
			pr[j - 1] = '1'
			edgel = j
		if i < edgel:
			edgel = i
	stdout_fileno = sys.stdout
	if num > 1:
		stdout_fileno.write('\n')
	stdout_fileno.write(' '.join(pr))
f = sys.stdin
contfishka = int(f.readline())
num = 0
while num < contfishka:
	lowers = int(f.readline())
	massivl = f.readline().split()
	massivl = [int(i) for i in massivl]
	num += 1
	pripitka(massivl, lowers)
f.close()


def layers(n, a):
	cake = []
	c = a[n - 1]
	for i in range(n - 1, -1, -1):
		if a[i] >= c:
			c = a[i]
		if c > 0 and c >= a[i]:
			cake.append('1')
			c -= 1
		else:
			cake.append('0')
	return reversed(cake)
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = layers(n, a)
	print(' '.join(ans))


def f(gp, x):
	k = 0
	for i in range(gp - 1, -1, -1):
		k = max(x[i], k)
		if k > 0:
			k -= 1
			arr2[i] = '1'
n = int(input())
for i in range(n):
	gp = int(input())
	arr2 = ['0'] * gp
	arr = list(map(int, input().split()))
	f(gp, arr)
	print(' '.join(arr2))


import math
t = int(input())
while t:
	t = t - 1
	n = int(input())
	l = list(map(int, input().split()))
	m = 0
	ans = [0] * n
	for i in range(n - 1, -1, -1):
		if l[i] > m:
			m = l[i]
		if m > 0:
			ans[i] = 1
		m = m - 1
	print(*ans)


for s1 in [*open(0)][2::2]:
	r1 = []
	m = 1
	for x1 in s1.split()[::-1]:
		m = max(m - 1, int(x1))
		r1 += (+(m > 0),)
	print(*r1[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	res = [0] * n
	m = n - 1
	vr = l[n - 1]
	while m >= 0:
		if l[m] > vr:
			vr = l[m]
		if vr > 0:
			res[m] = 1
		vr -= 1
		m -= 1
	for j in range(n):
		print(res[j], end=' ')
	print()


import sys
from math import ceil

def read_to_int():
	return int(sys.stdin.readline().rstrip())

def read_to_ints():
	return tuple(map(int, sys.stdin.readline().rstrip().split(' ')))
for t in range(read_to_int()):
	layer_count = read_to_int()
	dosage = read_to_ints()
	d_prev = 0
	cream = []
	for d in reversed(dosage):
		d = max(d, d_prev)
		c = int(d > 0)
		d_prev = d - 1
		cream.append(str(c))
	print(' '.join(cream[::-1]))


for _ in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	t = 0
	for i in range(n - 1, -1, -1):
		if t < m[i]:
			t = m[i]
		if t > 0:
			m[i] = 1
		else:
			m[i] = 0
		t -= 1
	print(*m)


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)

def number_to_list(a):
	b = []
	while a >= 1:
		c = a % 10
		a = int(a / 10)
		b.append(c)
	return list(reversed(b))

def str_list_to_int_list(a):
	a = list(map(int, a))
	return a

def make_1d_array(n, inti=0):
	a = [inti for _ in range(n)]
	return a

def make_2d_array(n, m, inti=0):
	a = [[inti for _ in range(m)] for _ in range(n)]
	return a

def make_3d_array(n, m, k, inti=0):
	a = [[[inti for _ in range(k)] for _ in range(m)] for _ in range(n)]
	return a

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
(t,) = I()
for t1 in range(t):
	(n,) = I()
	a = I()
	max1 = 0
	dp = [0] * n
	for i in range(n - 1, -1, -1):
		max1 = max(max1, a[i])
		if max1 > 0:
			dp[i] = 1
			max1 -= 1
		else:
			dp[i] = 0
	print(*dp)


x = int(input())
odg = []
for i in range(0, x):
	n = int(input())
	l = input().split(' ')
	l = list(map(lambda a: int(a), l))
	l.reverse()
	cream = 0
	layers = ['0'] * n
	for j in range(0, n):
		if l[j] > cream:
			cream = l[j]
		if cream > 0:
			layers[j] = '1'
			cream -= 1
	layers.reverse()
	odg.append(layers)
for e in odg:
	print(' '.join(e))


from sys import stdin, stdout
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))
for _ in range(nmbr()):
	n = nmbr()
	a = lst()
	dp = [0] * (2 * n + 2)
	for i in range(n):
		layer = n - i
		rnge = a[i]
		if rnge > 0:
			dp[layer] += 1
			dp[layer + rnge] -= 1
	for i in range(1, n + 2):
		dp[i] += dp[i - 1]
	for i in range(n - 1, -1, -1):
		stdout.write(str(int(dp[i + 1] > 0)) + ' ')
	print()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	cream = a[-1]
	ans = []
	for i in range(0, len(a)):
		j = len(a) - i - 1
		cream = max(cream, a[j])
		if cream > 0:
			cream -= 1
			ans.append('1')
		else:
			ans.append('0')
	ans.reverse()
	ans = ' '.join(ans)
	print(ans)


import os
import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

def nninp():
	return map(int, input().split())

def llinp():
	return list(map(int, input().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
from collections import OrderedDict
for __ in range(iinp()):
	n = iinp()
	a = llinp()
	nos = 234892893424
	ans = []
	for i in range(n - 1, -1, -1):
		nos = min(nos, i + 1 - a[i])
		if i >= nos:
			ans.append(1)
		else:
			ans.append(0)
	ans.reverse()
	print(*ans)


for _ in range(int(input())):
	i = int(input())
	arr = list(map(int, input().split()))
	return_list = [0] * i
	drip = 0
	for (idx, a) in enumerate(reversed(arr)):
		drip = max(drip, a)
		if drip > 0:
			return_list[i - idx - 1] = 1
			drip -= 1
	print(*return_list)


t = int(input())
for i in range(t):
	n = int(input())
	m = [int(j) for j in input().split()]
	res = []
	c = 0
	q = m[::-1]
	for i in q:
		c = max(i, c)
		if c > 0:
			res.append('1')
			c -= 1
		else:
			res.append('0')
	print(' '.join(res)[::-1])


for _ in range(int(input())):
	n = int(input())
	x = [int(i) for i in input().split()]
	y = [1] * n
	z = 0
	for i in range(n - 1, -1, -1):
		if x[i] != 0:
			z = max(z, x[i]) - 1
		elif z == 0:
			y[i] = 0
		else:
			z = z - 1
	print(*y)


for test_case in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	ans = []
	mx = 0
	for i in a:
		mx = max(mx - 1, i)
		if mx > 0:
			ans.append(1)
		else:
			ans.append(0)
	ans.reverse()
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	q = []
	x = 1
	for i in range(n):
		x = max(x - 1, a[-i - 1])
		q.append(int(x > 0))
	print(*q[::-1])


def sol():
	n = int(input())
	d = list(map(int, input().split()))
	st = n * [10 ** 6]
	m = 10 ** 6
	for j in range(len(d) - 1, -1, -1):
		m = min(m, j - d[j] + 1)
		st[j] = m
	wynik = []
	for i in range(n):
		if i < st[i]:
			wynik.append('0')
		else:
			wynik.append('1')
	return ' '.join(wynik)

def main():
	for i in range(int(input())):
		print(sol())
main()


try:
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		r = [0] * n
		mn = a[n - 1]
		for i in range(n - 1, -1, -1):
			if a[i] >= mn:
				mn = a[i]
			if mn > 0 and mn >= a[i]:
				r[i] = 1
				mn -= 1
		for i in r:
			print(i, end=' ')
		print(end='\n')
except EOFError as e:
	print(end='')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n - 2, -1, -1):
		a[i] = max(a[i], a[i + 1] - 1)
	print(' '.join(['1' if x > 0 else '0' for x in a]))
t = int(input())
for i in range(t):
	solve()


def answer():
	ans = [0 for i in range(n)]
	for i in range(n):
		ans[i] = max(a[i], ans[i])
	inc = 0
	for i in range(n - 1, -1, -1):
		if inc + ans[i]:
			inc = max(ans[i], inc)
			ans[i] = 1
		else:
			ans[i] = 0
			inc += 1
		inc -= 1
	return ans
for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*answer())


import sys

def inpu():
	return sys.stdin.readline()
T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	done = False
	d = [0] * n
	k = 1
	for i in range(n - 1, -1, -1):
		k = max(a[i], k - 1)
		if k > 0:
			d[i] = '1'
		else:
			d[i] = '0'
	print(' '.join(d))


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	cur = n - 1
	for i in reversed(range(n)):
		if a[i]:
			m = i - a[i]
			if m < cur:
				cur = m
		if cur < i:
			a[i] = 1
	ans.append(' '.join(map(str, a)))
print('\n'.join(ans))


def fain(n, listi):
	cumply = 0
	frr = [0] * n
	for x in range(n - 1, -1, -1):
		if cumply > 0:
			frr[x] = 1
			cumply -= 1
		if listi[x] > 0:
			frr[x] = 1
			listi[x] -= 1
			cumply = max(cumply, listi[x])
	return frr

def main():
	t = int(input())
	while t > 0:
		n = int(input())
		num_list = list(map(int, input().strip().split()))[:n]
		fg = fain(n, num_list)
		print(*fg)
		t -= 1
main()


t = int(input())
for test in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	o = [0 for i in range(0, n)]
	top = n - 1
	i = n - 1
	while i >= 0:
		d = a[i]
		top = min(i, top)
		f = i - d + 1
		while top >= f and top >= 0:
			o[top] = 1
			top -= 1
		i -= 1
	for e in o:
		print(e, end=' ')
	print()


t = int(input())
for _t in range(t):
	n = int(input())
	a = [int(e) for e in input().strip().split()]
	mn = n - 1 - a[n - 1]
	ans = ['0' if a[-1] == 0 else '1']
	for i in range(n - 2, -1, -1):
		mn = min(mn, i - a[i])
		if mn < i:
			ans.append('1')
		else:
			ans.append('0')
	print(' '.join(ans[::-1]))


test_cases = int(input())
for i in range(test_cases):
	layers = int(input())
	cream = list(map(int, input().split()))
	covered = [0] * layers
	last = cream[layers - 1]
	covered = ''
	for j in range(layers - 1, -1, -1):
		if cream[j] >= last:
			last = cream[j]
		if last > 0 and last >= cream[j]:
			covered += '1 '
			last -= 1
		else:
			covered += '0 '
	print(covered[::-1].strip())


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	k = []
	p = [0] * (n + 1)
	for i in range(0, len(a)):
		if a[i] >= 1:
			kl = max(0, i - a[i] + 1)
			p[kl] += 1
			p[i + 1] -= 1
	for i in range(0, len(p)):
		if i != 0:
			p[i] += p[i - 1]
	for i in range(0, len(p)):
		if p[i] >= 1:
			p[i] = 1
	p.pop()
	print(*p)


import math
import operator as op
from functools import reduce
from collections import defaultdict
from math import comb
from sys import stdout
NO = 'NO'
YES = 'YES'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def z_func(s):
	n = len(s)
	z = [0] * n
	l = r = 0
	for i in range(1, n):
		if r >= i:
			z[i] = min(z[i - l], r - i + 1)
		while z[i] + i < n and s[z[i]] == s[z[i] + i]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
global_ans = []

def pr(a):
	global_ans.append(a)

def solve():
	n = input_int()
	a = input_list_int()
	a.reverse()
	ans = []
	x = 0
	for i in a:
		x = max(x, i)
		ans.append('1' if x > 0 else '0')
		x -= 1
	ans.reverse()
	pr(' '.join(ans))
query_count = 1
query_count = input_int()
while query_count:
	query_count -= 1
	solve()
for global_ans_line in global_ans:
	print(global_ans_line)


t = int(input())
for _t in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0 for i in range(n)]
	x = 0
	for j in range(n - 1, -1, -1):
		if a[j] > x:
			x = a[j]
		if x > 0:
			b[j] = 1
			x -= 1
	for i in range(n):
		print(b[i], end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	for i in range(n - 1, -1, -1):
		if l[i] > c:
			c = l[i] - 1
			l[i] = 1
		elif c > 0:
			l[i] = 1
			c -= 1
	print(*l)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	ans = [0] * n
	cur = 0
	for i in reversed(range(n)):
		cur = max(cur, a[i])
		if cur > 0:
			ans[i] = 1
			cur -= 1
	print(*ans)
t = int(input())
for _ in range(t):
	solve()


import math

def solve(arr, n):
	res = [0 for i in range(n)]
	st = []
	for i in range(n):
		if arr[i] == 0:
			st.append(i)
		else:
			res[i] = 1
			val = arr[i] - 1
			reachidx = i - val
			while val > 0 and len(st) and (reachidx <= st[-1]):
				idx = st.pop()
				val -= 1
				res[idx] = 1
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = solve(arr, n)
	print(*res)


num_of_tests = int(input())
ans_list = []
for i in range(num_of_tests):
	layers = int(input())
	(*cream,) = map(int, input().split())
	for i in range(layers - 1, 0, -1):
		if cream[i] > cream[i - 1] and cream[i] != 1:
			cream[i - 1] = cream[i] - 1
			cream[i] = 1
	for (i, j) in enumerate(cream):
		if j > 0:
			cream[i] = 1
	ans_list.append(cream)
for i in ans_list:
	print(*i)


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = [0] * n
	d = 0
	for i in range(n - 1, -1, -1):
		d = max(d, arr[i])
		if d > 0:
			ans[i] = 1
			d -= 1
	print(*ans)