The most popular feature on snapchat is *Snapchat Streak*.  
A *streak* is maintained between two people if both of them send at least one snap to each other daily.  
If, on any day, either person forgets to send at least one snap, the streak breaks and the streak count is set to 0.

Chef and Chefina like maintaining their snapchat streak. You observed the snap count of both of them for N consecutive days.  
On the i^{th} day, Chef sent A_{i} snaps to Chefina while Chefina sent B_{i} snaps to Chef. 

Find the maximum streak count they achieved in those N days.

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of multiple lines of input.
- The first line of each test case contains an integer N — the number of days you observed.
- The second lines contains N space-separated integers — A_{1}, A_{2}, \ldots, A_{N}, the number of snaps Chef sent to Chefina on the i^{th} day.
- The third lines contains N space-separated integers — B_{1}, B_{2}, \ldots, B_{N}, the number of snaps Chefina sent to Chef on the i^{th} day.

------ Output Format ------ 

For each test case, output on a new line, the maximum streak count they achieved in those N days.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 1000$
$0 ≤ A_{i}, B_{i} ≤ 100$

----- Sample Input 1 ------ 
4
3
3 1 2
2 4 1
2
0 0
10 10
4
5 4 0 2
3 1 1 0
5
0 1 1 2 0
1 1 0 0 3

----- Sample Output 1 ------ 
3
0
2
1

----- explanation 1 ------ 
Test case $1$: For all $3$ days, both Chef and Chefina sent at least one snap per day. Thus, at the end of third day, the streak count is $3$.

Test case $2$: Chef did not send any snap to Chefina. Thus, at the streak count remains $0$ on both days.

Test case $3$: For the first two days, both Chef and Chefina send at least one snap per day. Thus, at the end of second day, the streak count is $2$.  
On the end of third day, since Chef did not send any snap, the streak count becomes $0$.  
On the end of fourth day, since Chefina did not send any snap, the streak count remains $0$.  

Test case $4$: 
- On the end of first day, since Chef did not send any snap, the streak count remains $0$.
- On second day, both Chef and Chefina sent at least one snap. Thus, the streak count becomes $1$.
- On the end of third day, since Chefina did not send any snap, the streak count becomes $0$.  
- On the end of fourth day, since Chefina did not send any snap, the streak count remains $0$.  
- On the end of fifth day, since Chef did not send any snap, the streak count remains $0$.  

The maximum streak count over $5$ days is $1$.

Source: codechef | Difficulty: EASY


Solutions:
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	strk = maxstrk = 0
	for i in range(len(B)):
		if A[i] == 0 or B[i] == 0:
			strk = 0
		else:
			strk += 1
		if maxstrk < strk:
			maxstrk = strk
	print(maxstrk)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	streak = 0
	max_streak = 0
	for j in range(n):
		if a[j] != 0 and b[j] != 0:
			streak += 1
		else:
			streak = 0
		max_streak = max(max_streak, streak)
	print(max_streak)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	current_streak = 0
	max_streak = 0
	for i in range(N):
		if A[i] == 0 or B[i] == 0:
			current_streak = 0
		else:
			current_streak += 1
		max_streak = max(max_streak, current_streak)
	print(max_streak)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	d = 0
	for (i, j) in zip(a, b):
		if i and j != 0:
			c = c + 1
		else:
			d = max(c, d)
			c = 0
	d = max(c, d)
	print(d)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	st = 0
	maxst = 0
	for i in range(n):
		if a[i] != 0 and b[i] != 0:
			st += 1
		elif a[i] == 0 or b[i] == 0:
			maxst = max(maxst, st)
			st = 0
	maxst = max(maxst, st)
	print(maxst)


for t in range(int(input())):
	days = int(input())
	chef = list(map(int, input().split()))[:days]
	chefina = list(map(int, input().split()))[:days]
	streak = 0
	MAX = 0
	for snap in range(days):
		if chef[snap] and chefina[snap]:
			streak += 1
			if streak > MAX:
				MAX = streak
		else:
			streak = 0
	print(MAX)


n = int(input())
for i in range(n):
	c = 0
	max = 0
	a = int(input())
	x = input()
	x = list(map(int, x.split()))
	y = input()
	y = list(map(int, y.split()))
	for j in range(a):
		if x[j] == 0 or y[j] == 0:
			c = 0
		else:
			c = c + 1
		if c > max:
			max = c
	print(max)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(input().split())
	b = list(input().split())
	lst = []
	c = 0
	for i in range(n):
		if a[i] != '0' and b[i] != '0':
			c += 1
		else:
			c = 0
		lst.append(c)
	lst.sort()
	print(lst[-1])


T = int(input())
li = []
for i in range(T):
	c = 0
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for j in range(n):
		if a[j] != 0 and b[j] != 0:
			c = c + 1
			li.append(c)
		else:
			c = 0
			li.append(c)
	li.sort(reverse=True)
	print(li[0])
	li = []


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = m = 0
	for i in range(n):
		if a[i] != 0 and b[i] != 0:
			c += 1
			m = max(m, c)
		else:
			c = 0
	print(m)


t = int(input())
for i in range(t):
	d = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	count = 0
	max_streak = 0
	for j in range(d):
		if l1[j] > 0 and l2[j] > 0:
			count = count + 1
		else:
			count = 0
		max_streak = max(count, max_streak)
	print(max_streak)


for i in range(int(input())):
	n = int(input())
	chef = list(map(int, input().split(' ')))
	ina = list(map(int, input().split(' ')))
	count = 0
	max_count = 0
	for (x, y) in zip(chef, ina):
		if x == 0 or y == 0:
			count = 0
		else:
			count += 1
		if max_count < count:
			max_count = count
	print(max_count)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	dev = shiv = 0
	for i in range(n):
		if a[i] == 0 or b[i] == 0:
			dev = max(dev, shiv)
			shiv = 0
		else:
			shiv += 1
	dev = max(dev, shiv)
	print(dev)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(count, mx) = (0, 0)
	for i in range(n):
		if a[i] == 0 or b[i] == 0:
			count = 0
		else:
			count += 1
			mx = max(count, mx)
	print(mx)


T = int(input())
for tc in range(T):
	n = int(input())
	arrA = list(map(int, input().split()))
	arrB = list(map(int, input().split()))
	streak = 0
	maxstreak = 0
	for i in range(n):
		if arrA[i] > 0 and arrB[i] > 0:
			streak += 1
		else:
			streak = 0
		if streak > maxstreak:
			maxstreak = streak
	print(maxstreak)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l3 = []
	l = []
	c = 0
	for i in range(n):
		l3.append(l1[i] * l2[i])
	if all(l3) == True:
		print(n)
	else:
		for i in range(n):
			if l3[i] > 0:
				c = c + 1
				if i == n - 1:
					l.append(c)
			else:
				l.append(c)
				c = 0
		print(max(l))


T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cout = 0
	s = 0
	for j in range(n):
		if a[j] != 0 and b[j] != 0:
			cout += 1
		else:
			s = max(s, cout)
			cout = 0
	s = max(s, cout)
	print(s)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	brr = list(map(int, input().split()))
	mx = 0
	lo = 0
	for i in range(n):
		if arr[i] and brr[i]:
			lo += 1
		else:
			mx = max(mx, lo)
			lo = 0
	mx = max(mx, lo)
	print(mx)


for _ in range(int(input())):
	n = int(input())
	s = 0
	sm = 0
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	i = 0
	for i in range(n):
		if x[i] == 0 or y[i] == 0:
			s = 0
		else:
			s = s + 1
		if s >= sm:
			sm = s
	print(sm)


def max_streak(n, chef_snaps, chefina_snaps):
	max_streak_count = 0
	current_streak_count = 0
	current_streak_start = 0
	for i in range(n):
		if chef_snaps[i] > 0 and chefina_snaps[i] > 0:
			current_streak_count += 1
			if current_streak_count > max_streak_count:
				max_streak_count = current_streak_count
		else:
			current_streak_count = 0
		if current_streak_start == i - max_streak_count + 1 and current_streak_count == max_streak_count:
			current_streak_start += 1
	return max_streak_count
t = int(input())
for _ in range(t):
	n = int(input())
	chef_snaps = list(map(int, input().split()))
	chefina_snaps = list(map(int, input().split()))
	print(max_streak(n, chef_snaps, chefina_snaps))


test_case = int(input())
for i in range(test_case):
	n = int(input())
	snaps_of_chef = list(map(int, input().split()))
	snaps_of_chefina = list(map(int, input().split()))
	streak = 0
	temp = 0
	for j in range(n):
		if snaps_of_chef[j] > 0 and snaps_of_chefina[j] > 0:
			temp += 1
		else:
			temp = 0
			streak = max(streak, temp)
		streak = max(streak, temp)
	print(streak)


t = int(input())
for i in range(t):
	count = 0
	streak = 0
	d = int(input())
	k = list(map(int, input().split()))
	q = list(map(int, input().split()))
	for i in range(d):
		if k[i] != 0 and q[i] != 0:
			count = count + 1
			if streak <= count:
				streak = count
		elif k[i] == 0 or q[i] == 0:
			if streak <= count:
				streak = count
				count = 0
			else:
				streak = streak
				count = 0
	print(streak)


for _ in range(int(input())):
	n = int(input())
	c = 0
	max_count = 0
	a_list = list(map(int, input().split()))
	b_list = list(map(int, input().split()))
	for i in range(n):
		if a_list[i] == 0 or b_list[i] == 0:
			c = 0
		else:
			c += 1
		if max_count < c:
			max_count = c
	print(max_count)


n = int(input())
for i in range(n):
	w = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	st = 0
	maxs = 0
	for j in range(w):
		if a[j] > 0 and b[j] > 0:
			st = st + 1
		elif a[j] == 0 or b[j] == 0:
			st = 0
		maxs = max(maxs, st)
	print(maxs)


for _ in range(int(input())):
	s = 0
	sm = 0
	t = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	i = 0
	for i in range(t):
		if a[i] == 0 or b[i] == 0:
			s = 0
		else:
			s += 1
		if s >= sm:
			sm = s
	print(sm)


while True:
	try:
		t = int(input())
	except:
		break
	while t > 0:
		n = int(input())
		arr = list(map(int, input().split()))
		brr = list(map(int, input().split()))
		m = 0
		c = 0
		for j in range(n):
			if arr[j] > 0 and brr[j] > 0:
				c += 1
			else:
				c = 0
			if m < c:
				m = c
		print(m)
		t -= 1


t = int(input())
for x in range(t):
	count = 0
	maxcount = 0
	n = int(input())
	streak1 = list(map(int, input().split()))
	streak2 = list(map(int, input().split()))
	for i in range(n):
		if streak1[i] >= 1 and streak2[i] >= 1:
			count += 1
			if count > maxcount:
				maxcount = count
		elif streak1[i] == 0 or streak2[i] == 0:
			count = 0
	print(maxcount)


t = int(input())
for _ in range(t):
	n = int(input())
	chef_snaps = list(map(int, input().split()))
	chefina_snaps = list(map(int, input().split()))
	current_streak = 0
	max_streak = 0
	for i in range(n):
		if chef_snaps[i] > 0 and chefina_snaps[i] > 0:
			current_streak += 1
		else:
			current_streak = 0
		max_streak = max(max_streak, current_streak)
	print(max_streak)


def max_snap_streak(n, chef_snaps, chefina_snaps):
	streak = 0
	max_streak = 0
	for i in range(n):
		if chef_snaps[i] > 0 and chefina_snaps[i] > 0:
			streak += 1
		else:
			streak = 0
		max_streak = max(max_streak, streak)
	return max_streak
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	c = max_snap_streak(n, A, B)
	print(c)


t = int(input())
for x in range(t):
	C = 0
	K = 0
	N = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(N):
		if a[i] != 0 and b[i] != 0:
			C += 1
		elif a[i] == 0 or b[i] == 0:
			K = max(K, C)
			C = 0
	K = max(K, C)
	print(K)


for i in range(int(input())):
	t = int(input())
	l = list(map(int, input().split()))
	x = list(map(int, input().split()))
	ctr = 0
	m = 0
	for i in range(len(l)):
		if l[i] == 0 or x[i] == 0:
			ctr = 0
		else:
			ctr += 1
			if m < ctr:
				m = ctr
	print(m)


t = int(input())
for i in range(t):
	n = int(input())
	count = 0
	amax = 0
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(n):
		if a[i] and b[i]:
			count += 1
		else:
			count = 0
		amax = max(amax, count)
	print(amax)


for _ in range(int(input())):
	x = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	maxi = 0
	c = 0
	for i in range(x):
		if a[i] != 0 and b[i] != 0:
			c += 1
			maxi = max(maxi, c)
		else:
			c = 0
	print(maxi)


n = int(input())
for i in range(n):
	streak = 0
	m = 0
	d = int(input())
	f = list(map(int, input().split()))
	s = list(map(int, input().split()))
	for i in range(d):
		if f[i] != 0 and s[i] != 0:
			streak += 1
			m = max(m, streak)
		else:
			streak = 0
	print(m)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	maxi = 0
	for j in range(n):
		if a[j] != 0 and b[j] != 0:
			count += 1
			maxi = max(maxi, count)
		else:
			count = 0
	print(maxi)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	m = 0
	for i in range(n):
		if a[i] == 0 or b[i] == 0:
			c = 0
			continue
		elif a[i] >= 1 and b[i] >= 1:
			c += 1
		m = max(m, c)
	print(m)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	max1 = 0
	for i in range(n):
		if a[i] == 0 or b[i] == 0:
			count = 0
		else:
			count += 1
		if max1 < count:
			max1 = count
	print(max1)


tc = int(input())
for _ in range(tc):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(i, streak) = (0, 0)
	for (x, y) in zip(a, b):
		if x == 0 or y == 0:
			streak = max(streak, i)
			i = 0
		else:
			i += 1
	print(max(streak, i))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	streak = 0
	max_st = 0
	for i in range(n):
		if a[i] != 0 and b[i] != 0:
			streak += 1
		elif a[i] == 0 or b[i] == 0:
			max_st = max(max_st, streak)
			streak = 0
	max_st = max(max_st, streak)
	print(max_st)


for i in range(int(input())):
	count = 0
	l = []
	w = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	for i in range(0, w):
		if a[i] > 0 and b[i] > 0:
			count += 1
			l.append(count)
		elif a[i] == 0 or b[i] == 0:
			l.append(count)
			count = 0
		c = 0
	for i in l:
		if c >= i:
			c = c
		else:
			c = i
	print(c)