#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long dx[] = {-1, 1, 0, 0};
long long dy[] = {0, 0, 1, -1};
bool test = 1;
const long long N = 2e5 + 5;
long long n;
long long a[N];
long long cache[N][4];
long long dp(long long idx, long long cur) {
  if (idx >= n) return 0;
  long long &ans = cache[idx][cur];
  if (ans != -1) return ans;
  ans = 0;
  if (cur == 0) {
    ans = max(ans, a[idx] + dp(idx + 2, cur));
    if (idx < n - 2) ans = max(ans, a[idx] + dp(idx + 1, 1));
    ans = max(ans, dp(idx + 1, 2));
  } else if (cur == 1) {
    if (idx < n - 3) ans = max(ans, a[idx] + dp(idx + 2, cur));
    ans = max(ans, a[idx] + dp(idx + 3, 3));
  } else if (cur == 2) {
    ans = max(ans, a[idx] + dp(idx + 2, cur));
    ans = max(ans, a[idx] + dp(idx + 1, 3));
  } else
    ans = max(ans, a[idx] + dp(idx + 2, cur));
  return ans;
}
void solve() {
  cin >> n;
  for (long long i = 0; i <= n; i++)
    for (long long j = 0; j < 4; j++) cache[i][j] = -1;
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << dp(0, 0) << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  if (test) cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
