#include<bits/stdc++.h>
using namespace std;
extern vector<int> solve(vector<int> A);

int solve_bruteforce(vector<int> A) {
  int n = (int)A.size();
  vector<pair<long long, long long>> a;
  for (int i = 0; i < n; ++i) {
    a.push_back({A[i], i});
  }
  sort(a.begin(), a.end());
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    sum += a[i].first;
  }
  long long mn = n;
  for (int can = 1; can <= n; ++can) {
    long long cur = 0;
    for (int i = 0; i < can; ++i) {
      cur += a[i].first;
    }
    long long l = 0, r = n - 1;
    while (l < can && l < r && cur < (sum + 1) / 2) {
      cur -= a[l++].first;
      cur += a[r--].first;
    }
    cout << "first" << '\n' << l << ' ' << r << ' ' << cur << '\n';
    if (cur >= (sum + 1) / 2) {
      mn = min(mn, (long long)abs(can - (n - can)));
    }
  }
//   cout << '\n';
  // cout << "Minimum: " << mn << '\n';
  for (int can = 1; can <= n; ++can) {
    long long cur = 0;
    for (int i = 0; i < can; ++i) {
      cur += a[i].first;
    }
    long long l = 0, r = n - 1;
    while (l < can && l < r && cur < (sum + 1) / 2) {
      cur -= a[l++].first;
      cur += a[r--].first;
    }
    if (cur >= (sum + 1) / 2) {
      if (mn == abs(can - (n - can))) {
        set<long long> s;
        cur = 0;
        for (int i = 0; i < can; ++i) {
          cur += a[i].first;
          s.insert(a[i].second);
        }
        l = 0, r = n - 1;
        while (l < can && l < r && cur < (sum + 1) / 2) {
          cur -= a[l++].first;
          cur += a[r--].first;
          s.erase(a[l - 1].second);
          s.insert(a[r + 1].second);
        }
        vector<int> ans;
        for (auto &i : s) {
          ans.push_back(i);
        }
        sort(ans.begin(), ans.end(), [&](int i, int j) {
          return A[i] < A[j];
        });
        for (int i = 0; i < n; ++i) {
          if (s.find(i) == s.end()) {
            ans.push_back(i);
          }
        }
        // return ans;
      }
    }
  }
  return mn;
//   return {-1};
}

int main () {
    freopen("output.txt", "r", stdin);
    int t;
    cin >> t ;
    for (int test=1; test<=t; test++) {
        int n;
        cin >> n ;
        vector <int> a(n);
        long long sum = 0;
        for (int i=0; i<n; i++) {
            cin >> a[i] ;
            sum += a[i];
        }


        vector<int> idx = solve(a);

        // cout << "OK" << '\n'; return 0;
        int ans = solve_bruteforce(a);
        
        long long cur = 0, cnt = 0;
        for (int i = 0; i < n; ++i) {
            cur += a[idx[i]];
            if (cur >= (sum + 1) / 2) {
                cnt = i + 1;
                break;
            }
        }
        // cout << '\n';
        // cout << cnt << '\n'; return 0;

        cnt = abs(cnt - (n - cnt));

        if (ans != cnt) {
            cout << "Expected: " << ans << ", " << "Found: " << cnt << '\n';
            cout << n << '\n';
            for (int i = 0; i < n; ++i) {
                cout << a[i] << ' ';
            }
            cout << '\n';
            // for (int i = 0; i < n; ++i) {
            //     cout << idx[i] << ' ';
            // }
            // cout << '\n';
            // for (int i = 0; i < n; ++i) {
            //     cout << a[idx[i]] << ' ';
            // }
            cout << '\n'; return 0;
        }
    }
    cout << "succesful" << '\n';
    cout << '\n' ;
    return 0;
}

