#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int** dp;
bool** map;
char* buf;

void func(){
	int N,limit;
	scanf("%d",&N);

	for(int i = 0; i < 3; i++){
		for(int k = 0; k <= N; k++)dp[i][k] = BIG_NUM;
	}

	for(int i = 0; i < 2; i++){
		for(int k = 0; k <= 2*N; k++)map[i][k] = false;
	}

	scanf("%s",buf);

	limit = 2*N;

	for(int i = 0; i < limit;i++){
		if(buf[i] == 'Y'){
			map[0][i] = true;
		}
	}
	for(int i = 0; i < limit; i++){
		if(buf[limit+i] == 'Y'){
			map[1][i] = true;
		}
	}

	if(map[0][0] == true && map[1][0] == true){
		dp[0][0] = 3;
		dp[1][0] = 2;
		dp[2][0] = 2;
	}else if(map[0][0] == false && map[1][0] == false){
		dp[0][0] = 0;
		dp[1][0] = 1;
		dp[2][0] = 2;
	}else if(map[0][0] == true && map[1][0] == false){
		dp[0][0] = 1;
		dp[1][0] = 1;
		dp[2][0] = 2;
	}else if(map[0][0] == false && map[1][0] == true){
		dp[0][0] = 3;
		dp[1][0] = 2;
		dp[2][0] = 2;
	}

	limit = N-1;
	for(int i = 1; i <= limit; i++){
		if((map[0][2*i-1] == true || map[0][2*i] == true)&& (map[1][2*i-1] == true || map[1][2*i] == true)){ //??????????£???¨?\\????£???????????????¬????????´???????????????????????´???
			dp[0][i] = min(dp[0][i-1]+4,min(dp[1][i-1]+3,dp[2][i-1]+3));
			dp[1][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+3,dp[2][i-1]+3));
			dp[2][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+3,dp[2][i-1]+4));
		}else if((map[0][2*i-1] == false && map[0][2*i] == false) && (map[1][2*i-1] == false && map[1][2*i] == false)){ //??????????????´???????????????????????´???
			dp[0][i] = min(dp[0][i-1]+1,min(dp[1][i-1]+2,dp[2][i-1]+3));
			dp[1][i] = min(dp[0][i-1]+2,min(dp[1][i-1]+1,dp[2][i-1]+2));
			dp[2][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+2,dp[2][i-1]+1));
		}else if((map[0][2*i-1] == true || map[0][2*i] == true) && (map[1][2*i-1] == false && map[1][2*i] == false)){ //??????????£???????????????´???????????????????????´???
			dp[0][i] = min(dp[0][i-1]+2,min(dp[1][i-1]+2,dp[2][i-1]+3));
			dp[1][i] = min(dp[0][i-1]+2,min(dp[1][i-1]+2,dp[2][i-1]+3));
			dp[2][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+3,dp[2][i-1]+4));
		}else if((map[0][2*i-1] == false && map[0][2*i] == false) && (map[1][2*i-1] == true || map[1][2*i] == true)){ //?\\????£???????????????´???????????????????????´???
			dp[0][i] = min(dp[0][i-1]+4,min(dp[1][i-1]+3,dp[2][i-1]+3));
			dp[1][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+2,dp[2][i-1]+2));
			dp[2][i] = min(dp[0][i-1]+3,min(dp[1][i-1]+2,dp[2][i-1]+2));
		}
	}

	if(map[0][2*N-1] == true && map[1][2*N-1] == true){
		dp[0][N] = min(dp[0][N-1]+4,min(dp[1][N-1]+3,dp[2][N-1]+3));
	}else if(map[0][2*N-1] == false && map[1][2*N-1] == false){
		dp[0][N] = min(dp[0][N-1]+1,min(dp[1][N-1]+2,dp[2][N-1]+3));
	}else if(map[0][2*N-1] == true && map[1][2*N-1] == false){
		dp[0][N] = min(dp[0][N-1]+2,min(dp[1][N-1]+2,dp[2][N-1]+3));
	}else if(map[0][2*N-1] == false && map[1][2*N-1] == true){
		dp[0][N] = min(dp[0][N-1]+4,min(dp[1][N-1]+3,dp[2][N-1]+3));
	}

	printf("%d\n",dp[0][N]);
}

int main(){

	dp = new int*[3];
	for(int i = 0; i < 3; i++){
		dp[i] = new int[10001];
	}

	map = new bool*[2];
	for(int i = 0; i < 2; i++){
		map[i] = new bool[20001];
	}

	buf = new char[40010];


	int TEST;
	scanf("%d",&TEST);

	for(int loop = 0; loop < TEST; loop++){
		func();
	}

	return 0;
}

Measured memory_bytes: 3396