#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <random>

int main() {
	int t; std::cin >> t;
	for (auto _i = 0; _i < t; ++_i) {
		int n; std::cin >> n;
		std::string state; std::cin >> state;
		std::vector<bool> shelves{ state[0] == 'Y', state[2 * n] == 'Y' };
		for (auto i = 1; i < n; ++i) {
			shelves.push_back(state[i * 2 - 1] == 'Y' || state[i * 2] == 'Y');
			shelves.push_back(state[2 * n + i * 2 - 1] == 'Y' || state[2 * n + i * 2] == 'Y');
		}
		shelves.push_back(state[2 * n - 1] == 'Y');
		shelves.push_back(state[4 * n - 1] == 'Y');
		int upper = -1, mid = 6 * n, lower = 6 * n;
		for (auto i = 0; i <= n; ++i) {
			int new_upper, new_mid, new_lower;
			if (!shelves[2 * i] && !shelves[2 * i + 1]) {
				new_upper = std::min({ upper + 1, mid + 2, lower + 3 });
				new_mid = std::min({ upper + 2, mid + 1, lower + 2 });
				new_lower = std::min({ upper + 3, mid + 2, lower + 1 });
			}
			else if (shelves[2 * i] && shelves[2 * i + 1]) {
				new_upper = std::min({ upper + 4, mid + 3, lower + 3 });
				new_mid = std::min({ upper + 3, mid + 3, lower + 3 });
				new_lower = std::min({ upper + 3, mid + 3, lower + 4 });
			}
			else if (shelves[2 * i]) {
				new_upper = std::min({ upper + 2, mid + 2, lower + 3 });
				new_mid = std::min({ upper + 2, mid + 2, lower + 3 });
				new_lower = std::min({ upper + 3, mid + 3, lower + 4 });
			}
			else {
				new_upper = std::min({ upper + 4, mid + 3, lower + 3 });
				new_mid = std::min({ upper + 3, mid + 2, lower + 2 });
				new_lower = std::min({ upper + 3, mid + 2, lower + 2 });
			}
			upper = new_upper;
			mid = new_mid;
			lower = new_lower;
		}
		std::cout << upper << std::endl;
	}
}
