#include <bits/stdc++.h>
using namespace std;
pair<long long int, long long int> binarysearch(
    vector<pair<long long int, long long int>>& arr, long long int low,
    long long int high, long long int a) {
  if (low > high) {
    return make_pair(-1, -1);
  }
  long long int mid = (low + high) / 2;
  if (arr[mid].first == a) {
    if (mid != 0 && arr[mid - 1].first == a) {
      return binarysearch(arr, low, mid - 1, a);
    } else {
      return arr[mid];
    }
  } else if (arr[mid].first < a) {
    return binarysearch(arr, mid + 1, high, a);
  } else {
    return binarysearch(arr, low, mid - 1, a);
  }
}
int main(void) {
  long long int t;
  cin >> t;
  while (t-- > 0) {
    long long int n;
    cin >> n;
    vector<long long int> left(n);
    vector<long long int> right(n);
    for (long long int i = 0; i < n; i++) {
      cin >> left[i];
    }
    for (long long int i = 0; i < n; i++) {
      cin >> right[i];
    }
    reverse(right.begin(), right.end());
    vector<long long int> leftdif(n + 1, 0);
    long long int blue = 0, straw = 0;
    for (long long int i = 0; i < n; i++) {
      if (left[i] == 1) {
        straw++;
      } else {
        blue++;
      }
      leftdif[i + 1] = blue - straw;
    }
    vector<long long int> rightdif(n + 1, 0);
    blue = 0, straw = 0;
    for (long long int i = 0; i < n; i++) {
      if (right[i] == 1) {
        straw++;
      } else {
        blue++;
      }
      rightdif[i + 1] = blue - straw;
    }
    vector<pair<long long int, long long int>> rightfinal;
    for (long long int i = 0; i < n + 1; i++) {
      rightfinal.push_back(make_pair(rightdif[i], n - i));
    }
    sort(rightfinal.begin(), rightfinal.end());
    vector<long long int> ans(n + 1, -1);
    for (long long int i = 0; i < n + 1; i++) {
      long long int l = leftdif[i];
      long long int r = binarysearch(rightfinal, 0, n, -l).second;
      if (r == -1) {
        ans[i] = INT_MAX;
      } else {
        ans[i] = n - i + r;
      }
    }
    long long int minans = INT_MAX;
    for (auto& x : ans) {
      minans = min(minans, x);
    }
    if (minans == INT_MAX) {
      cout << 2 * n << endl;
    } else {
      cout << minans << endl;
    }
  }
  return 0;
}
