#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    int bl = 0, rd = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[n - i - 1];
      if (a[n - i - 1] == 1)
        rd += 1;
      else
        bl += 1;
    }
    unordered_map<int, int> lowest;
    lowest[rd - bl] = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] == 1)
        rd -= 1;
      else
        bl -= 1;
      if (lowest.find(rd - bl) == lowest.end()) lowest[rd - bl] = i + 1;
    }
    for (int i = 0; i < n; i++) {
      cin >> b[i];
      if (b[i] == 1)
        rd += 1;
      else
        bl += 1;
    }
    int best = INT_MAX;
    if (lowest.find(bl - rd) != lowest.end()) best = lowest[bl - rd];
    for (int i = 0; i < n; i++) {
      if (b[i] == 1)
        rd -= 1;
      else
        bl -= 1;
      if (lowest.find(bl - rd) != lowest.end())
        best = min(best, lowest[bl - rd] + 1 + i);
    }
    cout << best << endl;
  }
  return 0;
}
