import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer token;
        StringTokenizer token2;
        StringBuilder sb = new StringBuilder();
        int n = Integer.parseInt(br.readLine());
        for(int i=0; i<n; i++){
            int m = Integer.parseInt(br.readLine());
            int sticker[][] = new int[2][m];
            token = new StringTokenizer(br.readLine());
            token2 = new StringTokenizer(br.readLine());
            for(int j=0; j<m; j++){
                sticker[0][j] = Integer.parseInt(token.nextToken());
                sticker[1][j] = Integer.parseInt(token2.nextToken());
            }
            if(m == 1){
                sb.append(Math.max(sticker[0][0], sticker[1][0]));
                continue;
            }
            sticker[0][1] += sticker[1][0];
            sticker[1][1] += sticker[0][0];
            for(int k=2; k<m && m>2; k++){
                sticker[0][k] += Math.max(sticker[1][k-1], sticker[1][k-2]);
                sticker[1][k] += Math.max(sticker[0][k-1], sticker[0][k-2]);
            }
            sb.append(Math.max(sticker[0][m-1], sticker[1][m-1])).append("\n");
        }
        System.out.print(sb);
    }
}
