#include<bits/stdc++.h>
using namespace std;
#define sdgt(x) ((x) <= '9' && (x) >= '0')

long long n, t, ans, ta1, tb1, sa0, sb0, sa1, sb1, ta0, tb0;
char sa[100003], ta[100003], sb[100003], tb[100003];
char c;

inline void read(long long&x){
	x = 0;
	c = getchar();
	while(!sdgt(c)) c = getchar();
	while(sdgt(c)){
		x = (x<<1)+(x<<3)+c-48;
		c = getchar();
	}
}

int main(){
	freopen("edit.in", "r", stdin);
	freopen("edit.out", "w", stdout);
	
	register int i;
	read(t);
	while(t--){
		ta1 = 0;
		tb1 = 0;
		ta0 = 0;
		tb0 = 0;
		sa0 = 0;
		sa1 = 0;
		sb0 = 0;
		sb1 = 0;
		ans = 0;
		read(n);
		
		c = getchar();
		while(!sdgt(c)) c = getchar();
		for(i = 0;sdgt(c);i++){
			sa[i] = c;
			c = getchar();
		}
		c = getchar();
		while(!sdgt(c)) c = getchar();
		for(i = 0;sdgt(c);i++){
			sb[i] = c;
			c = getchar();
		}
		c = getchar();
		while(!sdgt(c)) c = getchar();
		for(i = 0;sdgt(c);i++){
			ta[i] = c;
			c = getchar();
		}
		c = getchar();
		while(!sdgt(c)) c = getchar();
		for(i = 0;sdgt(c);i++){
			tb[i] = c;
			c = getchar();
		}
		
		for(i = 0;i < n;++i){
			if(ta[i]=='0' && tb[i]=='0'){
				if(sa[i] == sb[i]){
					ans++;
				}
			}
			else{
				if(ta[i] == '0'){
					if(sa[i] == '1') sa1++;
					else sa0++;
				}
				else{
					if(sa[i] == '1') ta1++;
					else ta0++;
				}
				if(tb[i] == '0'){
					if(sb[i] == '1') sb1++;
					else sb0++;
				}
				else{
					if(sb[i] == '1') tb1++;
					else tb0++;
				}
			}
		}
		
//		cout << ta0 << ' ' << ta1 << endl;
//		cout << sa0 << ' ' << sa1 << endl;
//		cout << tb0 << ' ' << tb1 << endl;
//		cout << sb0 << ' ' << sb1 << endl;
//		cout << ans << endl;

		if(ta0 > sb0){
			ans += sb0;
			ta0 -= sb0;
		}
		else{
			ans += ta0;
			ta0 = 0;
		}
		if(ta1 > sb1){
			ans += sb1;
			ta1 -= sb1;
		}
		else{
			ans += ta1;
			ta1 = 0;
		}
		if(tb0 > sa0){
			ans += sa0;
			tb0 -= sa0;
		}
		else{
			ans += tb0;
			tb0 = 0;
		}
		if(tb1 > sa1){
			ans += sa1;
			tb1 -= sa1;
		}
		else{
			ans += tb1;
			tb1 = 0;
		}
		
		ans += ((ta0<tb0)?ta0:tb0)+((ta1<tb1)?ta1:tb1);
		
		printf("%lld\n", ans);
	}
	return 0;
} 
