'''
简单多维DP
'''
T = int(input())
for _ in range(T):
N = int(input())
arr = list(map(int, input().split()))
# dp(i, j) 表示前i个房子做选择,第i个房子可选标记为j(0不可选,1可选)约束下,所有选法的价值和的最大值
dp1 = [0, 0]
dp2 = [0, 0]
for i in range(N):
if i == 0:
dp2[0], dp2[1] = 0, arr[i]
else:
dp2[0], dp2[1] = dp1[1], max(dp1[1], dp1[0] + arr[i])
dp1, dp2 = dp2, dp1
print(max(dp1[0], dp1[1]))