#include <bits/stdc++.h>
using namespace std;
#define FIO ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
#define int long long
#define mod 1000000007
typedef vector<int> vi;
typedef vector<bool> vb;
#define ff first
#define ss second
#define pb push_back
#define Pob pop_back
#define mp make_pair

void solve() {
  int n; cin >> n;
  int a;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a > 10) {
      ans += a - 10;
    }
  }
  cout << ans;

}

int32_t main() {
  FIO
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int t = 1;
  // cin >> t;
  while (t--)solve();
  return 0;
}


#include <bits/stdc++.h>

const int N = 2*100000;

char S1[N + 5], S2[N + 5], S3[N + 5];

bool tag[4];
void solve() {
	int n; scanf("%d%s%s%s", &n, S1, S2, S3);
	for(int o=0;o<4;o++) tag[o] = 0;
	tag[(S1[0] - '0') << 1 | (S1[2*n - 1] - '0')] = true;
	tag[(S2[0] - '0') << 1 | (S2[2*n - 1] - '0')] = true;
	tag[(S3[0] - '0') << 1 | (S3[2*n - 1] - '0')] = true;
	if( !tag[0] ) {
		for(int i=0;i<n;i++) putchar('0');
		putchar('1');
		for(int i=0;i<n;i++) putchar('0');
		puts("");
	} else if( !tag[3] ) {
		for(int i=0;i<n;i++) putchar('1');
		putchar('0');
		for(int i=0;i<n;i++) putchar('1');
		puts("");
	} else if( !tag[2] ) {
		putchar('0');
		for(int i=0;i<n;i++) putchar('1');
		for(int i=0;i<n;i++) putchar('0');
		puts("");
	} else {
		putchar('1');
		for(int i=0;i<n;i++) putchar('0');
		for(int i=0;i<n;i++) putchar('1');
		puts("");
	}
}

int main() {
	int T; scanf("%d", &T);
	while( T-- ) solve();
} 