#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

char buff[40010];
int u[10010];
int s[10010];
int n;

int memo[2][10010];

int solve(int now, int us){
  if(now == n){
    if(s[now]){
      if(us == 0) return 3;
      else return 2;
    }else if(u[now]){
      return 1;
    }else{
      return us;
    }
  }

  if(memo[us][now]) return memo[us][now];

  int ret = INT_MAX;

  if(u[now] && s[now]){
    ret = min(ret, 2 + solve(now+1, 0));
    ret = min(ret, 2 + solve(now+1, 1));
  }else if(u[now]){
    ret = min(ret, 1 + solve(now+1, 1));
    ret = min(ret, 1 + solve(now+1, 0));
  }else if(s[now]){
    if(us == 0){
      ret = 2 + solve(now+1, 1);
    }else{
      ret = 1 + solve(now+1, 1);
    }
  }else{
    ret = solve(now+1, us);
  }

  //printf("solve(%d,%d)=%d\n",now,us,ret+1);
  return memo[us][now] = ret + 1;
}

int main(){
  int t;
  scanf("%d",&t);
  while(t --> 0){
    scanf("%d %s",&n,buff);
    u[0] = (buff[0] == 'Y');
    s[0] = (buff[n+n] == 'Y');
    u[n] = (buff[n+n-1] == 'Y');
    s[n] = (buff[n+n+n+n-1] == 'Y');

    REP(i,n-1){
      u[i+1] = ((buff[2*i+1] == 'Y') | (buff[2*(i+1)] == 'Y'));
      s[i+1] = ((buff[n+n+2*i+1] == 'Y') | (buff[n+n+2*(i+1)] == 'Y'));
    }

    //REP(i,n+1) printf("%d ",u[i]); puts("");
    //REP(i,n+1) printf("%d ",s[i]); puts("");

    memset(memo,0,sizeof(memo));
    print(solve(0,0));
  }
  return 0;
}