#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, m, n) for(int i = m; i >= n; i--)

int books[30000];
int memo[30000][3][4];

int main(){
	int T, n;
	string s;
	cin >> T;
	rep(t, T){
		memset(books, 0, sizeof(books));
		cin >> n;
		cin >> s;
		rep(i, n * 4){
			if(s[i] == 'Y'){
				int d = 0;
				if(i >= n * 2) d++;
				int i2 = i % (2 * n);
				books[(i2+1)/2] |= (1 << d);
			}
		}
		fill(&memo[0][0][0], &memo[29999][2][3] + 1, INF);
		memo[0][0][books[0]] = 0;
		queue<PPP> que;
		que.push(PPP(0, PP(0, P(0, books[0]))));
		while(!que.empty()){
			PPP ppp = que.front();
			que.pop();
			int cost = ppp.first;
			int pos = ppp.second.first;
			int p = ppp.second.second.first;
			int b = ppp.second.second.second;
			if(pos == n && p == 0 && b == 0){
				cout << cost << endl;
				break;
			}
			if(b == 0 && memo[pos+1][p][books[pos+1]] == INF){
				memo[pos+1][p][books[pos+1]] = cost + 1;
				que.push(PPP(cost + 1, PP(pos+1, P(p, books[pos+1]))));
			}
			if(p <= 1){
				if(memo[pos][0][b & 2] == INF){
					memo[pos][0][b & 2] = cost + 1;
					que.push(PPP(cost + 1, PP(pos, P(0, b & 2))));
				}
				if(memo[pos][1][b & 2] == INF){
					memo[pos][1][b & 2] = cost + 1;
					que.push(PPP(cost + 1, PP(pos, P(1, b & 2))));
				}
			}
			if(p >= 1){
				if(memo[pos][2][b & 1] == INF){
					memo[pos][2][b & 1] = cost + 1;
					que.push(PPP(cost + 1, PP(pos, P(2, b & 1))));
				}
				if(memo[pos][1][b & 1] == INF){
					memo[pos][1][b & 1] = cost + 1;
					que.push(PPP(cost + 1, PP(pos, P(1, b & 1))));
				}
			}
		}
	}
	return 0;
}