#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1000;
int sum[N];
map<int, int> v;
int a[N];
int t, n;
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    memset(sum, 0, sizeof sum);
    v.clear();
    v[0] = 0;
    for (int i = 1; i <= 2 * n; i++) {
      scanf("%d", &a[i]);
      if (a[i] == 2) a[i] = -1;
      sum[i] = sum[i - 1] + a[i];
      if (i <= n) v[sum[i]] = i;
    }
    int ans = 2 * n;
    for (int i = n; i <= 2 * n; i++) {
      int x = sum[i] - sum[2 * n];
      if (v.find(x) != v.end()) ans = min(ans, i - v[x]);
    }
    cout << ans << endl;
  }
}
