#include <bits/stdc++.h>
using namespace std;
inline int __gcd(int a, int b) { return b > 0 ? __gcd(b, a % b) : a; }
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
int a[maxn], b[maxn];
map<int, int> ta, tb;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    ta.clear();
    tb.clear();
    int sum = 0;
    for (long long i = 1; i <= (long long)n; ++i) {
      int x;
      cin >> x;
      if (x == 1) {
        sum++;
        a[i] = 1;
      } else {
        sum--;
        a[i] = -1;
      }
    }
    reverse(a + 1, a + n + 1);
    for (long long i = 1; i <= (long long)n; ++i) {
      int x;
      cin >> x;
      if (x == 1) {
        sum++;
        b[i] = 1;
      } else {
        sum--;
        b[i] = -1;
      }
    }
    int temsum = 0;
    for (long long i = 1; i <= (long long)n; ++i) {
      temsum += a[i];
      if (ta.find(temsum) == ta.end()) ta[temsum] = i;
    }
    temsum = 0;
    for (long long i = 1; i <= (long long)n; ++i) {
      temsum += b[i];
      if (tb.find(temsum) == tb.end()) tb[temsum] = i;
    }
    int ans = n * 2;
    ta[0] = tb[0] = 0;
    for (long long i = -n; i <= (long long)n; ++i) {
      if (ta.find(i) != ta.end() && tb.find(sum - i) != tb.end())
        ans = min(ans, ta[i] + tb[sum - i]);
    }
    cout << ans << "\n";
  }
}
