#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = LLONG_MAX - 100000;
long long pw(long long x, long long y, long long p = inf) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long invmod(long long a, long long m = mod) { return pw(a, m - 2, m); }
long long cl(long long a, long long x) {
  return a % x == 0 ? a / x : a / x + 1;
}
void run_time_terror(long long case_no = 0) {
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == 2) a[i] = -1;
  }
  for (long long i = 0; i < n; ++i) {
    cin >> b[i];
    if (b[i] == 2) b[i] = -1;
  }
  reverse(a.begin(), a.end());
  std::map<long long, vector<long long> > m;
  m[0].push_back(0);
  for (long long i = 0; i < n; ++i) {
    if (i) {
      a[i] += a[i - 1];
      b[i] += b[i - 1];
    }
    m[a[i]].push_back(i + 1);
  }
  long long ans = 2 * n, netsm = a.back() + b.back();
  if (netsm == 0) {
    cout << "0\n";
    return;
  }
  if (m[netsm].size()) ans = min(m[netsm][0], ans);
  for (long long i = 0; i < n; ++i) {
    long long req = netsm - b[i];
    if (m[req].size()) ans = min(ans, i + 1 + m[req][0]);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed);
  cout << setprecision(0);
  long long tt = 1;
  cin >> tt;
  for (long long case_no = 1; case_no <= tt; case_no++) {
    run_time_terror(case_no);
  }
  return 0;
}
