#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long x;
  long long y;
};
struct PPoint {
  Point x;
  Point y;
};
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b <= 0) return a;
  return gcd(b, a % b);
}
long long dx[]{0, 1, 0, -1};
long long dy[]{1, 0, -1, 0};
const long long NCONS = 100000;
int32_t main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> l(n), r(n);
    long long diff_l = 0, diff_r = 0;
    for (long long i = n - 1; i >= 0; i--) {
      cin >> l[i];
      if (l[i] == 1)
        diff_l += 1;
      else
        diff_l -= 1;
    }
    for (long long i = 0; i < n; i++) {
      cin >> r[i];
      if (r[i] == 1)
        diff_r += 1;
      else
        diff_r -= 1;
    }
    map<long long, long long> mp;
    map<long long, bool> visited;
    long long ret = INT_MAX;
    mp[diff_l] = 0;
    visited[diff_l] = true;
    for (long long i = 0; i < n; i++) {
      if (l[i] == 1)
        diff_l -= 1;
      else
        diff_l += 1;
      if (visited[diff_l]) continue;
      visited[diff_l] = true;
      mp[diff_l] = i + 1;
    }
    if (visited[-diff_r]) ret = mp[-diff_r];
    for (long long i = 0; i < n; i++) {
      if (r[i] == 1)
        diff_r -= 1;
      else
        diff_r += 1;
      if (visited[-diff_r] == false) continue;
      ret = min(ret, mp[-diff_r] + i + 1);
    }
    cout << ret << '\n';
  }
  return 0;
}
