#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF LLONG_MAX
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A>
string to_string(const A &v);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(const pair<A, B> &p)
{
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(const tuple<A, B, C> &p)
{
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) + ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A>
string to_string(const A &v)
{
  bool first = true;
  string res = "{";
  for (const auto &x : v)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T> &val)
{
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void reverse(map<T, T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T> &val)
{
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T> &val)
{
  return val.first + val.second;
}

template <typename T>
T min(T a, T b, T c)
{
  return min(min(a, b), c);
}

template <typename T>
T max(T a, T b, T c)
{
  return max(max(a, b), c);
}

template <typename T>
T mul_mod(T a, T b, T mod)
{
  T res = 0;
  a %= mod;
  while (b)
  {
    if (b & 1)
    {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

template <typename T>
T fac_mod(T v, T mod)
{
  ll res = 1;
  for (ll i = 1; i <= v; i++)
  {
    res *= i;
    res = res % mod;
  }
  return res;
}

template <typename T>
T pow_mod(T v, T p, T mod)
{
  if (p == 1)
    return v;

  if (p % 2 == 0)
  {
    T t = pow_mod(v, p / 2, mod);
    return (t * t) % mod;
  }
  else
  {
    return (v * pow_mod(v, p - 1, mod)) % mod;
  }
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) ;
#endif

#define COMMON_MOD static_cast<ll>(pow(10, 9) + 7)
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
sort(a.begin(), a.end(), [ ](ll& lhs, ll& rhs) {return abs(lhs) < abs(rhs);});
*/
class segtree
{
public:
  vll t;
  ll size;
  segtree(vll &a)
  {
    size = 1;
    while (size < a.size())
      size *= 2;
    t.assign(2 * size - 1, 1e6);
    fill(a, 0, 0, size);
  }

  void fill(vll &a, ll x, ll lx, ll rx)
  {
    if (lx >= a.size())
      return;
    if (rx - lx == 1)
    {
      t[x] = a[lx];
      return;
    }

    ll m = (lx + rx) / 2;
    fill(a, 2 * x + 1, lx, m);
    fill(a, 2 * x + 2, m, rx);

    t[x] = min(t[2 * x + 1], t[2 * x + 2]);
  }
  ll get_min(ll l, ll r, ll x, ll lx, ll rx)
  {
    if (rx - lx == 1)
    {

      if (lx >= l && rx <= r)
        return t[x];
      else
        return 1e10;
    }
    if (lx > r || rx < l)
      return 1e10;
    if (lx >= l && rx <= r)
      return t[x];

    ll m = (lx + rx) / 2;
    return min(get_min(l, r, 2 * x + 1, lx, m), get_min(l, r, 2 * x + 2, m, rx));
  }
  ll get_min(ll l, ll r)
  {
    return get_min(l, r, 0, 0, size);
  }
};

class mytask
{
public:
  mytask() {}
  int solve()
  {

    ll t;
    cin >> t;
    while (t--)
    {
      ll n;
      cin >> n;
      vll a(n);
      for (ll &v : a)
        cin >> v;

      segtree t(a);
      bool good = false;
      ll max_x = a[0];

      for (ll x = 1; x <= n - 2; x++)
      {
        max_x = max(max_x, a[x - 1]);
        ll r = n - 1;
        ll max_z = a[n - 1];
        ll last_max_z = 0;
        while (r > x && max_x >= a[r])
        {
          last_max_z = max(last_max_z, max_z);
          max_z = max(max_z, a[r]);
          r--;
        }
        r++;
        if (max_z != max_x)
          continue;
        debug(x, r);
        ll min_y = t.get_min(x, r);
        debug(min_y);
        if (min_y < max_x)
          continue;
        if (min_y > max_x && r < n - 1 && last_max_z == max_x)
        {
          r++;
          min_y = t.get_min(x, r);
        }
        if (min_y == max_x)
        {
          cout << "YES"
               << "\n";
          cout << x << " " << r - x << " " << n - r;
          good = true;
        }

        // for (ll y = n - x - 1; y > 0; y--)
        // {
        //   max_z = max(max_z, a[x + y]);
        //   //debug(max_z, x, y);
        //   if (max_z > max_x)
        //     break;
        //   if (max_x == max_z)
        //   {
        //     ll min_y = t.get_min(x, x + y);
        //     //debug(t.t);
        //     // ll min_y = 1e10;
        //     // for (ll i = x; i < x + y; i++)
        //     // {
        //     //   min_y = min(min_y, a[i]);
        //     //   //debug(x, y, min_y, max_x, max_z, a[x + y], i);
        //     //   if (min_y < max_x)
        //     //   {
        //     //     break;
        //     //   }
        //     // }
        //     if (min_y == max_x)
        //     {
        //       good = true;
        //       cout << "YES"
        //            << "\n";
        //       cout << x << " " << y << " " << n - x - y;
        //       break;
        //     }
        //     else if (min_y > max_x)
        //     {
        //       break;
        //     }
        //   }

        if (good)
          break;
      }
      if (!good)
        cout << "NO";
      cout << "\n";
    }
    return 0;
  }
};

int main()
{

  auto task = mytask();
  task.solve();

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF LLONG_MAX
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A>
string to_string(const A &v);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(const pair<A, B> &p)
{
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(const tuple<A, B, C> &p)
{
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) + ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A>
string to_string(const A &v)
{
  bool first = true;
  string res = "{";
  for (const auto &x : v)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T> &val)
{
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void reverse(map<T, T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T> &val)
{
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T> &val)
{
  return val.first + val.second;
}

template <typename T>
T min(T a, T b, T c)
{
  return min(min(a, b), c);
}

template <typename T>
T max(T a, T b, T c)
{
  return max(max(a, b), c);
}

template <typename T>
T mul_mod(T a, T b, T mod)
{
  T res = 0;
  a %= mod;
  while (b)
  {
    if (b & 1)
    {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

template <typename T>
T fac_mod(T v, T mod)
{
  ll res = 1;
  for (ll i = 1; i <= v; i++)
  {
    res *= i;
    res = res % mod;
  }
  return res;
}

template <typename T>
T pow_mod(T v, T p, T mod)
{
  if (p == 1)
    return v;

  if (p % 2 == 0)
  {
    T t = pow_mod(v, p / 2, mod);
    return (t * t) % mod;
  }
  else
  {
    return (v * pow_mod(v, p - 1, mod)) % mod;
  }
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) ;
#endif

#define COMMON_MOD static_cast<ll>(pow(10, 9) + 7)
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
sort(a.begin(), a.end(), [ ](ll& lhs, ll& rhs) {return abs(lhs) < abs(rhs);});
*/

class mytask
{
public:
  mytask() {}
  vll find_circle(ll i, ll parent, vector<vll> &t, ll depth, vll &t_depth)
  {
    t_depth[i] = depth;
    for (ll ch : t[i])
    {
      if (ch == parent)
        continue;

      if (t_depth[ch] != -1)
      {
        return {ch, i};
      }

      vll res = find_circle(ch, i, t, depth + 1, t_depth);
      if (res.size() > 0)
      {
        res.pb(i);
        return res;
      }
    }

    return {};
  }

  int solve()
  {

    ll t;
    cin >> t;
    while (t--)
    {
      ll n;
      cin >> n;
      vll a(n);
      for (ll &v : a)
        cin >> v;
      bool good = false;
      ll max_x = a[0];

      for (ll x = 1; x < n - 3; x++)
      {
        max_x = max(max_x, a[x - 1]);
        ll max_z = a.back();
        for (ll y = n - x - 1; y > 0; y--)
        {
          max_z = max(max_z, a[x + y]);
          //debug(max_z, x, y);
          if (max_z > max_x)
            break;
          if (max_x == max_z)
          {
            ll min_y = 1e10;
            for (ll i = x; i < x + y; i++)
            {
              min_y = min(min_y, a[i]);
              //debug(x, y, min_y, max_x, max_z, a[x + y], i);
              if (min_y < max_x)
              {
                break;
              }
            }
            if (min_y == max_x)
            {
              good = true;
              cout << "YES"
                   << "\n";
              cout << x << " " << y << " " << n - x - y;
              break;
            }
          }
        }
        if (good)
          break;
      }
      if (!good)
        cout << "NO";
      cout << "\n";
    }
    return 0;
  }
};

int main()
{

  auto task = mytask();
  task.solve();

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define pb push_back
#define INF LLONG_MAX
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<ll, ll>;
using int3 = tuple<ll, ll, ll>;

template <typename A>
string to_string(const A &v);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B>
string to_string(const pair<A, B> &p)
{
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(const tuple<A, B, C> &p)
{
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) + ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A>
string to_string(const A &v)
{
  bool first = true;
  string res = "{";
  for (const auto &x : v)
  {
    if (!first)
    {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T> &val)
{
  sort(val.begin(), val.end());
}

template <typename T>
void reverse(vector<T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void reverse(map<T, T> &val)
{
  reverse(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T> &val)
{
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T pair_sum(pair<T, T> &val)
{
  return val.first + val.second;
}

template <typename T>
T min(T a, T b, T c)
{
  return min(min(a, b), c);
}

template <typename T>
T max(T a, T b, T c)
{
  return max(max(a, b), c);
}

template <typename T>
T mul_mod(T a, T b, T mod)
{
  T res = 0;
  a %= mod;
  while (b)
  {
    if (b & 1)
    {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

template <typename T>
T fac_mod(T v, T mod)
{
  ll res = 1;
  for (ll i = 1; i <= v; i++)
  {
    res *= i;
    res = res % mod;
  }
  return res;
}

template <typename T>
T pow_mod(T v, T p, T mod)
{
  if (p == 1)
    return v;

  if (p % 2 == 0)
  {
    T t = pow_mod(v, p / 2, mod);
    return (t * t) % mod;
  }
  else
  {
    return (v * pow_mod(v, p - 1, mod)) % mod;
  }
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) ;
#endif

#define COMMON_MOD static_cast<ll>(pow(10, 9) + 7)
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
sort(a.begin(), a.end(), [ ](ll& lhs, ll& rhs) {return abs(lhs) < abs(rhs);});
*/
class segtree
{
public:
  vll t;
  ll size;
  segtree(vll &a)
  {
    size = 1;
    while (size < a.size())
      size *= 2;
    t.assign(2 * size - 1, 1e6);
    fill(a, 0, 0, size);
  }

  void fill(vll &a, ll x, ll lx, ll rx)
  {
    if (lx >= a.size())
      return;
    if (rx - lx == 1)
    {
      t[x] = a[lx];
      return;
    }

    ll m = (lx + rx) / 2;
    fill(a, 2 * x + 1, lx, m);
    fill(a, 2 * x + 2, m, rx);

    t[x] = min(t[2 * x + 1], t[2 * x + 2]);
  }
  ll get_min(ll l, ll r, ll x, ll lx, ll rx)
  {
    if (rx - lx == 1)
    {

      if (lx >= l && rx <= r)
        return t[x];
      else
        return 1e10;
    }
    if (lx > r || rx < l)
      return 1e10;
    if (lx >= l && rx <= r)
      return t[x];

    ll m = (lx + rx) / 2;
    return min(get_min(l, r, 2 * x + 1, lx, m), get_min(l, r, 2 * x + 2, m, rx));
  }
  ll get_min(ll l, ll r)
  {
    return get_min(l, r, 0, 0, size);
  }
};

class mytask
{
public:
  mytask() {}
  int solve()
  {

    ll t;
    cin >> t;
    while (t--)
    {
      ll n;
      cin >> n;
      vll a(n);
      for (ll &v : a)
        cin >> v;

      segtree t(a);
      bool good = false;
      ll max_x = a[0];

      for (ll x = 1; x <= n - 2; x++)
      {
        max_x = max(max_x, a[x - 1]);
        ll max_z = a.back();
        for (ll y = n - x - 1; y > 0; y--)
        {
          max_z = max(max_z, a[x + y]);
          //debug(max_z, x, y);
          if (max_z > max_x)
            break;
          if (max_x == max_z)
          {
            ll min_y = t.get_min(x, x + y);
            //debug(t.t);
            // ll min_y = 1e10;
            // for (ll i = x; i < x + y; i++)
            // {
            //   min_y = min(min_y, a[i]);
            //   //debug(x, y, min_y, max_x, max_z, a[x + y], i);
            //   if (min_y < max_x)
            //   {
            //     break;
            //   }
            // }
            if (min_y == max_x)
            {
              good = true;
              cout << "YES"
                   << "\n";
              cout << x << " " << y << " " << n - x - y;
              break;
            }
          }
        }
        if (good)
          break;
      }
      if (!good)
        cout << "NO";
      cout << "\n";
    }
    return 0;
  }
};

int main()
{

  auto task = mytask();
  task.solve();

  return 0;
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 2; i ++){
			ll M = mx[i - 1];
			if(num[M] < 3 || l1[M] == inf || l2[M] == inf)continue;
			if((r2[M] < i + 2))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M && pt + 1 < n){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
		for(ll i = 0; i <= n; i ++){
			mx[i] = 0;
			mx2[i] = 0;
			num[i] = 0;
		}
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4 + 1, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		fill(num, num + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 1; i ++){
			ll M = mx[i - 1];
			if((num[M] < 3) || (l1[M] == inf) || (l2[M] == inf))continue;
			if((r2[M] < i + 1))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 2; i ++){
			ll M = mx[i - 1];
			if(num[M] < 3 || l1[M] == inf || l2[M] == inf)continue;
			if((r2[M] < i + 1))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M && pt + 1 < n){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
		for(ll i = 0; i <= n; i ++){
			mx[i] = 0;
			mx2[i] = 0;
			num[i] = 0;
		}
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	if(t == 3)return 0;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4 + 1, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		fill(num, num + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 1; i ++){
			ll M = mx[i - 1];
			if((num[M] < 3) || (l1[M] == inf) || (l2[M] == inf))continue;
			if((r2[M] < i + 1))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4 + 1, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		fill(num, num + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 2; i ++){
			ll M = mx[i - 1];
			if((num[M] < 3) || (l1[M] == inf) || (l2[M] == inf))continue;
			if((r2[M] < i + 1))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 2; i ++){
			if(num[a[i]] < 3 || l1[a[i]] == inf || l2[a[i]] == inf)continue;
			if((r2[a[i]] < i + 2))continue;
			if(i > 0){
				if(mx[i - 1] != a[i])continue;
			}
			ll pt = max(l2[a[i]], i + 1);
			ll x2 = get(i, pt);
			if(x2 == a[i]){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
		for(ll i = 0; i <= n; i ++){
			mx[i] = 0;
			mx2[i] = 0;
			num[i] = 0;
		}
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	if(t == 4)return 0;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4 + 1, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		fill(num, num + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 1; i ++){
			ll M = mx[i - 1];
			if((num[M] < 3) || (l1[M] == inf) || (l2[M] == inf))continue;
			if((r2[M] < i + 1))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
			else if(x2 > M && a[pt] == M && mx2[pt + 1] == M){
				x = i;
				y = pt - i + 1;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
	}
}


// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define Sort(x) sort(all(x))
#define debug(x) cerr << #x << " :" << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 2e5 + 5, inf = 1e18, mod = 1e9 + 7;
ll n, t, a[maxn], num[maxn], l1[maxn], l2[maxn], r1[maxn], r2[maxn], seg[maxn * 4], mx[maxn], mx2[maxn];
void compress(){
	vector <ll> vec;
	for(ll i = 0; i < n; i ++)vec.pb(a[i]);
	Sort(vec);
	vec.resize(unique(all(vec)) - vec.begin());
	for(ll i = 0; i < n; i ++)a[i] = lower_bound(all(vec), a[i]) - vec.begin();
}
void fix(ll p, ll x, ll v = 1, ll s = 0, ll e = n){
	if(e - s == 1){
		seg[v] = x;
		return;
	}
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	if(mid > p)fix(p, x, lc, s, mid);
	else fix(p, x, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}
ll get(ll l, ll r, ll v = 1, ll s = 0, ll e = n){
	if(l >= e || r <= s)return inf;
	if(l <= s && e <= r)return seg[v];
	ll mid = (e + s) / 2, lc = v + v, rc = lc + 1;
	ll x = get(l, r, lc, s, mid);
	ll y = get(l, r, rc, mid, e);
	return min(x, y);
}
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n;
		for(ll i = 0; i < n; i ++)cin >> a[i];
		compress();
		fill(seg, seg + n * 4, inf);
		fill(l1, l1 + n, inf);
		fill(r1, r1 + n, -1);
		fill(l2, l2 + n, inf);
		fill(r2, r2 + n, -1);
		fill(mx, mx + n, 0);
		fill(mx2, mx2 + n, 0);
		for(ll i = 0; i < n; i ++)fix(i, a[i]);
		for(ll i = 0; i < n; i ++){
			mx[i] = a[i];
			num[a[i]] ++;
			if(i > 0)mx[i] = max(mx[i], mx[i - 1]);
			l1[mx[i]] = min(l1[mx[i]], i);
			r1[mx[i]] = max(r1[mx[i]], i);
		}
		for(ll i = n - 1; i >= 0; i --){
			mx2[i] = a[i];
			if(i < n - 1)mx2[i] = max(mx2[i], mx2[i + 1]);
			l2[mx2[i]] = min(l2[mx2[i]], i);
			r2[mx2[i]] = max(r2[mx2[i]], i);
		}
		ll x = -1, y = -1, z = -1;
		for(ll i = 1; i < n - 2; i ++){
			ll M = mx[i - 1];
			if(num[M] < 3 || l1[M] == inf || l2[M] == inf)continue;
			if((r2[M] < i + 2))continue;
			ll pt = max(l2[M], i + 1);
			ll x2 = get(i, pt);
			if(x2 == M){
				x = i;
				y = pt - i;
				z = n - (x + y);
				break;
			}
		}
		if(x == -1)cout << "NO" << endl;
		else cout << "YES" << endl << x << ' ' << y << ' ' << z << endl;
		for(ll i = 0; i <= n; i ++){
			mx[i] = 0;
			mx2[i] = 0;
			num[i] = 0;
		}
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 1e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 <= mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 2e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 < mx1 or q1 < mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 1e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 < mx1 or q1 > mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 2e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 < mx1 or q1 < mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << "\n";
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << "\n";
		}
		else
			cout << "NO" << "\n";
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 1e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 < mx1 or q1 < mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 1e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 <= mx1 or q1 > mx1)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
const int mx = 1e5;
int tree[2][mx * 4];
int arr[mx + 5];
void build(int node, int start, int end, int ref) {
	if (start == end)
		tree[ref][node] = arr[start];
	else {
		int mid = (start + end) >> 1;
		build(node << 1, start, mid, ref);
		build((node << 1) + 1, mid + 1, end, ref);
		if (ref == 0)
			tree[ref][node] = min(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
		else
			tree[ref][node] = max(tree[ref][node << 1], tree[ref][(node << 1) + 1]);
	}
}
int query(int node, int start, int end, int left, int right, int ref) {
	if (left > end or right < start)
		return !ref * INT_MAX;

	if (left <= start and right >= end)
		return tree[ref][node];

	int mid = (start + end) >> 1;
	int q1 = query(node << 1, start, mid, left, right, ref);
	int q2 = query((node << 1) + 1, mid + 1, end, left, right, ref);
	if (ref == 0)
		return min(q1, q2);
	else
		return max(q1, q2);
}
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		for (int i = 1; i <= n; ++i)
			cin >> arr[i];
		build(1, 1, n, 0);
		build(1, 1, n, 1);
		bool notPos = true;
		int ind1 = -1, ind2 = -1;
		for (int i = 1; i <= n - 2 and notPos; ++i) {
			int mx1 = query(1, 1, n, 1, i, 1);
			int l = i + 2;
			int r = n;
			while (l <= r) {
				int m = (l + r) / 2;
				int q1 = query(1, 1, n, i + 1, m - 1, 0);
				int q2 = query(1, 1, n, m, n, 1);
				//cout << "i: " << i << " mx1: " << mx1 << " m: " << m << " q1: " << q1 << " q2: " << q2 << endl;
				if (mx1 == q1 and q1 == q2) {
					ind1 = i;
					ind2 = m;
					notPos = false;
					break;
				}
				if (q2 <= mx1 or q1 > q2)
					r = m - 1;
				else
					l = m + 1;
			}
		}
		if (!notPos) {
			cout << "YES" << endl;
			cout << ind1 << " " << ind2 - ind1 - 1 << " " << n - ind2 + 1 << endl;
		}
		else
			cout << "NO" << endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0,flag=0;
		for(int i=1;i<=n-1;i++){
			if(a[i].v==a[i+1].v){
				int now=i;
				while(now<n&&a[now].v==a[now+1].v)now++;
				if(now-i+1<3){
					for(int j=i;j<=now;j++){
						l=min(a[j].idx,l);
						r=max(a[j].idx,r);
					}
					i=now;
				}
				else{
					if(a[i].idx<l&&a[now].idx>r){
						l=min(l,a[i+1].idx);
						r=max(r,a[now-1].idx);
						flag=1;
						break;
					}
					else{
						l=min(l,a[i].idx);
						r=max(r,a[now].idx);
					}
				}
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0&&flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0,flag=0;
		for(int i=1;i<=n-1;i++){
			if(a[i].v==a[i+1].v){
				int now=i;
				while(now<n&&a[now].v==a[now+1].v)now++;
				if(now-i+1<3){
					for(int j=i;j<=now;j++){
						l=min(a[j].idx,l);
						r=max(a[j].idx,r);
					}
				}
				else{
					if(a[i].idx<l&&a[now].idx>r){
						l=min(l,a[i+1].idx);
						r=max(r,a[now-1].idx);
						flag=1;
						break;
					}
					else{
						l=min(l,a[i].idx);
						r=max(r,a[now].idx);
					}
				}
				i=now;
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0&&flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200010;
int a[maxn],l[maxn],r[maxn],lmax[maxn],rmax[maxn];
stack<int>sta;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t,n;
	cin>>t;
	while(t--){
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i];
		lmax[0]=rmax[n+1]=-1;
		lmax[1]=a[1],rmax[n]=a[n];
		for(int i=2;i<=n;i++)lmax[i]=max(lmax[i-1],a[i]);
		for(int i=n-1;i>=1;i--)rmax[i]=max(rmax[i+1],a[i]);
		while(!sta.empty())sta.pop();
		for(int i=1;i<=n;i++){
			while(!sta.empty()&&a[sta.top()]>=a[i])sta.pop();
			if(sta.empty())
				l[i]=1;
			else
				l[i]=sta.top()+1;
			sta.push(i);
		}
		while(!sta.empty())sta.pop();
		for(int i=n;i>=1;i--){
			while(!sta.empty()&&a[sta.top()]>=a[i])sta.pop();
			if(sta.empty())
				r[i]=n;
			else
				r[i]=sta.top()-1;
			sta.push(i);
		}
		// while(!sta.empty())sta.pop();
		// for(int i=1;i<=n;i++){
		// 	if(a[i]==a[l[i]]&&l[i]!=i)l[i]++;
		// 	if(a[i]==a[r[i]]&&r[i]!=i)r[i]--;
		// }
		int x,y,z,flag=0;
		for(int i=2;i<n;i++){
			if(a[i]==lmax[l[i]-1]&&a[i]==rmax[r[i]+1]){
				x=l[i]-1;
				y=r[i]-l[i]+1;
				z=n-x-y;
				flag=1;
				break;
			}
		}
		if(flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";

	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0;
		for(int i=1;i<=n-2;i++){
			if(a[i].v==a[i+1].v&&a[i].v==a[i+2].v){
				if(a[i].idx<l&&a[i+2].idx>r){
					l=min(l,a[i+1].idx);
					r=max(r,a[i+1].idx);
					break;
				}
				else{
					l=min(l,a[i].idx);
					r=max(r,a[i+2].idx);
				}
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200010;
int a[maxn],l[maxn],r[maxn],lmax[maxn],rmax[maxn];
stack<int>sta;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t,n;
	cin>>t;
	while(t--){
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i];
		lmax[0]=rmax[n+1]=-1;
		lmax[1]=a[1],rmax[n]=a[n];
		for(int i=2;i<=n;i++)lmax[i]=max(lmax[i-1],a[i]);
		for(int i=n-1;i>=1;i--)rmax[i]=max(rmax[i+1],a[i]);
		while(!sta.empty())sta.pop();
		for(int i=1;i<=n;i++){
			while(!sta.empty()&&a[sta.top()]>a[i])sta.pop();
			if(sta.empty())
				l[i]=1;
			else
				l[i]=sta.top()+1;
			sta.push(i);
		}
		while(!sta.empty())sta.pop();
		for(int i=n;i>=1;i--){
			while(!sta.empty()&&a[sta.top()]>a[i])sta.pop();
			if(sta.empty())
				r[i]=n;
			else
				r[i]=sta.top()-1;
			sta.push(i);
		}
		// while(!sta.empty())sta.pop();
		// for(int i=1;i<=n;i++)cout<<l[i]<<' '<<r[i]<<'\n';
		int x,y,z,flag=0;
		for(int i=2;i<n;i++){
			if(a[i]==lmax[l[i]-1]&&a[i]==rmax[r[i]+1]){
				x=l[i]-1;
				y=r[i]-l[i]+1;
				z=n-x-y;
				flag=1;
				break;
			}
		}
		if(flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";

	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0,flag=0;
		for(int i=1;i<=n-2;i++){
			if(a[i].v==a[i+1].v&&a[i].v==a[i+2].v){
				if(a[i].idx<l&&a[i+2].idx>r){
					l=min(l,a[i+1].idx);
					r=max(r,a[i+1].idx);
					flag=1;
					break;
				}
				else{
					l=min(l,a[i].idx);
					r=max(r,a[i+2].idx);
				}
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0&&flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0,flag=0;
		for(int i=1;i<=n-2;i++){
			if(a[i].v==a[i+1].v&&a[i].v==a[i+2].v){
				if(a[i].idx<l&&a[i+2].idx>r){
					l=min(l,a[i+1].idx);
					r=max(r,a[i+1].idx);
                    if(r-l+1==i){
                        flag=1;
                        break;
                    }
				}
                l=min(l,a[i].idx);
                r=max(r,a[i+2].idx);
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0&&flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct s{
	int v,idx;
}a[200010];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i].v,a[i].idx=i;
		sort(a+1,a+1+n,[&](s x,s y){
			if(x.v==y.v)return x.idx<y.idx;
			return x.v>y.v;
		});
		int l=n+1,r=0,flag=0;
		for(int i=1;i<=n-1;i++){
			if(a[i].v==a[i+1].v){
				int now=i;
				while(now<n&&a[now].v==a[now+1].v)now++;
				if(now-i+1<3){
					for(int j=i;j<=now;j++){
						l=min(a[j].idx,l);
						r=max(a[j].idx,r);
					}
				}
				else{
					if(a[i].idx<l&&a[now].idx>r){
						l=min(l,a[i+1].idx);
						r=max(r,a[now-1].idx);
						if(r-l+1==now-2){
							flag=1;
							break;
						}
					}
					l=min(l,a[i].idx);
					r=max(r,a[now].idx);
				}
				i=now;
			}
			else{
				l=min(a[i].idx,l);
				r=max(a[i].idx,r);
			}
		}
		int x=l-1,y=r-l+1,z=n-r;
		if(x>0&&y>0&&z>0&&flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=200010;
int a[maxn],l[maxn],r[maxn],lmax[maxn],rmax[maxn];
stack<int>sta;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t,n;
	cin>>t;
	while(t--){
		cin>>n;
		for(int i=1;i<=n;i++)cin>>a[i];
		lmax[0]=rmax[n+1]=-1;
		lmax[1]=a[1],rmax[n]=a[n];
		for(int i=2;i<=n;i++)lmax[i]=max(lmax[i-1],a[i]);
		for(int i=n-1;i>=1;i--)rmax[i]=max(rmax[i+1],a[i]);
		while(!sta.empty())sta.pop();
		for(int i=1;i<=n;i++){
			while(!sta.empty()&&a[sta.top()]>=a[i])sta.pop();
			if(sta.empty())
				l[i]=1;
			else
				l[i]=sta.top()+1;
			sta.push(i);
		}
		while(!sta.empty())sta.pop();
		for(int i=n;i>=1;i--){
			while(!sta.empty()&&a[sta.top()]>=a[i])sta.pop();
			if(sta.empty())
				r[i]=n;
			else
				r[i]=sta.top()-1;
			sta.push(i);
		}
		// while(!sta.empty())sta.pop();
		for(int i=1;i<=n;i++){
			if(a[i]==a[l[i]]&&l[i]!=i)l[i]++;
			if(a[i]==a[r[i]]&&r[i]!=i)r[i]--;
		}
		int x,y,z,flag=0;
		for(int i=2;i<n;i++){
			if(a[i]==lmax[l[i]-1]&&a[i]==rmax[r[i]+1]){
				x=l[i]-1;
				y=r[i]-l[i]+1;
				z=n-x-y;
				flag=1;
				break;
			}
		}
		if(flag)cout<<"YES\n"<<x<<' '<<y<<' '<<z<<'\n';
		else cout<<"NO\n";

	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(maxpre[fptr-1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(maxpre[fptr-1] > minele) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5+5;
long long sparse[MAXN][20];

void build(long long *a, int n) {
    for(int i = 0; i < n; i++) {
        sparse[i][0] = a[i];
    }
    for(int sz = 1; (1<<sz) <= n; sz++) {
        for(int i = 0; i+(1<<sz)-1 < n; i++) {
            sparse[i][sz] = min(sparse[i][sz-1], sparse[i+(1<<(sz-1))][sz-1]);
        }
    }
}

long long rmq(int s, int e) {
    int sz = log2(e-s+1);
    return min(sparse[s][sz], sparse[e-(1<<sz)+1][sz]);
}

void solve() {
    int n;
    cin >> n;
    long long a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long maxpre[n], maxsuf[n];
    maxpre[0] = a[0];
    for(int i = 1; i < n; i++) {
        maxpre[i] = max(maxpre[i-1], a[i]);
    }
    maxsuf[n-1] = a[n-1];
    for(int i = n-2; i >= 0; i--) {
        maxsuf[i] = max(maxsuf[i+1], a[i]);
    }
    build(a, n);
    for(int i = n-1; i > 1; i--) {
        long long curhi = maxsuf[i];
        int lo = lower_bound(maxpre, maxpre+n, curhi)-maxpre;
        int hi = i-2;
        if(maxpre[lo] != curhi) {
            continue;
        }
        while(lo <= hi) {
            int mid = (lo+hi)/2;
            if(rmq(mid+1, i-1) == curhi) {
                cout << "YES\n";
                cout << mid+1 << " " << (i-1)-(mid+1)+1 << " " << (n-1)-i+1 << "\n";
                return;
            }
            if(rmq(mid+1, i-1) < curhi) {
                lo = mid+1;
            } else {
                hi = mid-1;
            }
        }
    }
    cout << "NO\n";

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	ll maxele = *max_element(a, a+n);
	int cntmax = 0;
	for(int i = 0; i < n; i++) cntmax += (a[i] == maxele);
	if(cntmax >= 3) {
		bool first = true;
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele && !first) {
				cout << "YES" << "\n" << i << " " << 1 << " " << n-1-i << "\n";
				return;
			} else if(a[i] == maxele) {
				first ^= 1;
			}
		}
	}
	int fi = 1e9, li = -1e9;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			fi = min(fi, i);
			li = max(li, i);
		}
	}
	int fptr = fi, bptr = li;
	ll minele = *min_element(a+fi, a+li+1);
	ll maxpre[n], maxsuf[n];
	maxpre[0] = a[0];
	for(int i = 1; i < n; i++) maxpre[i] = max(maxpre[i-1], a[i]);
	maxsuf[n-1] = a[n-1];
	for(int i = n-2; i >= 0; i--) maxsuf[i] = max(maxsuf[i+1], a[i]);
	while(fptr > 0 && a[fptr-1] > minele) --fptr;
	while(bptr < n-1 && a[bptr+1] > minele) ++bptr;
	while(true) {
		if(fptr-1 < 0 || bptr+1 >= n) {
			cout << "NO" << "\n";
			return;
		}
		ll lar = max(a[fptr-1], a[bptr+1]);
		if(maxpre[fptr-1] == maxsuf[bptr+1] && maxpre[fptr-1] == minele) break;
		if(a[fptr-1] == lar) {
			minele = a[fptr-1];
			while(fptr > 0 && a[fptr-1] == lar) --fptr;
		}
		if(a[bptr+1] == lar) {
			minele = a[bptr+1];
			while(bptr < n-1 && a[bptr+1] == lar) ++bptr;
		}
	}
	if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
		cout << "YES\n" << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
	} else {
		cout << "NO\n";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				--fptr;
			} else {
				++bptr;
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	cout << "cnt = " << cnt << endl;
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				--fptr;
			} else if(a[bptr+1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				++bptr;
			} else {
				if(maxpre[fptr-1] > maxsuf[bptr+1]) {
					--fptr;
				} else if(maxpre[fptr-1] < maxsuf[bptr+1]) {
					++bptr;
				} else {
					if(a[fptr-1] > a[bptr+1]) {
						--fptr;
					} else {
						++bptr;
					}
				}
				minele = min({minele, a[fptr], a[bptr]});
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5+5;
long long sparse[MAXN][20];

void build(long long *a, int n) {
    for(int i = 0; i < n; i++) {
        sparse[i][0] = a[i];
    }
    for(int sz = 1; (1<<sz) <= n; sz++) {
        for(int i = 0; i+(1<<sz)-1 < n; i++) {
            sparse[i][sz] = min(sparse[i][sz-1], sparse[i+(1<<(sz-1))][sz-1]);
        }
    }
}

long long rmq(int s, int e) {
    int sz = log2(e-s+1);
    return min(sparse[s][sz], sparse[e-(1<<sz)+1][sz]);
}

void solve() {
    int n;
    cin >> n;
    long long a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    long long maxpre[n], maxsuf[n];
    maxpre[0] = a[0];
    for(int i = 1; i < n; i++) {
        maxpre[i] = max(maxpre[i-1], a[i]);
    }
    maxsuf[n-1] = a[n-1];
    for(int i = n-2; i >= 0; i--) {
        maxsuf[i] = max(maxsuf[i+1], a[i]);
    }
    build(a, n);
    for(int i = n-1; i > 1; i--) {
        long long curhi = maxsuf[i];
        int lo = lower_bound(maxpre, maxpre+n, curhi)-maxpre;
        int hi = upper_bound(maxpre, maxpre+i-1, curhi)-maxpre-1;
        hi = min(i-2, hi);
        if(maxpre[lo] != curhi) {
            continue;
        }
        while(lo <= hi) {
            int mid = (lo+hi)/2;
            if(rmq(mid+1, i-1) == curhi) {
                cout << "YES\n";
                cout << mid+1 << " " << (i-1)-(mid+1)+1 << " " << (n-1)-i+1 << "\n";
                return;
            }
            if(rmq(mid+1, i-1) < curhi) {
                lo = mid+1;
            } else {
                hi = mid-1;
            }
        }
    }
    cout << "NO\n";

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	ll maxele = *max_element(a, a+n);
	int cntmax = 0;
	for(int i = 0; i < n; i++) cntmax += (a[i] == maxele);
	if(cntmax >= 3) {
		bool first = true;
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele && !first) {
				cout << "YES" << "\n" << i << " " << 1 << " " << n-1-i << "\n";
				return;
			} else if(a[i] == maxele) {
				first ^= 1;
			}
		}
	}
	int fi = 1e9, li = -1e9;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			fi = min(fi, i);
			li = max(li, i);
		}
	}
	int fptr = fi, bptr = li;
	ll minele = *min_element(a+fi, a+li+1);
	ll maxpre[n], maxsuf[n];
	maxpre[0] = a[0];
	for(int i = 1; i < n; i++) maxpre[i] = max(maxpre[i-1], a[i]);
	maxsuf[n-1] = a[n-1];
	for(int i = n-2; i >= 0; i--) maxsuf[i] = max(maxsuf[i+1], a[i]);
	while(fptr > 0 && a[fptr-1] > minele) --fptr;
	while(bptr < n-1 && a[bptr+1] > minele) ++bptr;
	while(true) {
		if(fptr-1 < 0 || bptr+1 >= n) {
			cout << "NO" << "\n";
			return;
		}
		ll lar = max(a[fptr-1], a[bptr+1]);
		if(maxpre[fptr-1] == maxsuf[bptr+1] && maxpre[fptr-1] == minele) break;
		if(a[fptr-1] == lar) {
			minele = a[fptr-1];
			while(fptr > 0 && a[fptr-1] == lar) --fptr;
		}
		if(a[bptr+1] == lar) {
			minele = maxsuf[bptr+1];
			while(bptr < n-1 && a[bptr+1] == lar) ++bptr;
		}
	}
	if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
		cout << "YES\n" << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
	} else {
		cout << "NO\n";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(fptr > 0 && a[fptr-1] > minele) {
			--fptr;
		}
		while(bptr < n-1 && a[bptr+1] > minele) {
			++bptr;
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(maxpre[fptr-1] > minele) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else if(maxsuf[bptr+1] > minele) {
				++bptr;
				minele = min(minele, a[bptr]);
			} else {
				if(maxpre[fptr-1] > maxsuf[bptr+1]) {
					--fptr;
				} else {
					++bptr;
				}
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(maxpre[fptr-1] >= maxsuf[bptr+1]) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	ll maxele = *max_element(a, a+n);
	int cntmax = 0;
	for(int i = 0; i < n; i++) cntmax += (a[i] == maxele);
	if(cntmax >= 3) {
		bool first = true;
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele && !first) {
				cout << "YES" << "\n" << i << " " << 1 << " " << n-1-i << "\n";
				return;
			} else if(a[i] == maxele) {
				first ^= 1;
			}
		}
	}
	int fi = 1e9, li = -1e9;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			fi = min(fi, i);
			li = max(li, i);
		}
	}
	int fptr = fi, bptr = li;
	ll minele = *min_element(a+fi, a+li+1);
	ll maxpre[n], maxsuf[n];
	maxpre[0] = a[0];
	for(int i = 1; i < n; i++) maxpre[i] = max(maxpre[i-1], a[i]);
	maxsuf[n-1] = a[n-1];
	for(int i = n-2; i >= 0; i--) maxsuf[i] = max(maxsuf[i+1], a[i]);
	while(fptr > 0 && a[fptr-1] > minele) --fptr;
	while(bptr < n-1 && a[bptr+1] > minele) ++bptr;
	// cout << fptr << " " << bptr << endl;
	while(true) {
		if(fptr-1 < 0 || bptr+1 >= n) {
			cout << "NO" << "\n";
			return;
		}
		ll lar = max(a[fptr-1], a[bptr+1]);
		if(maxpre[fptr-1] == maxsuf[bptr+1] && maxpre[fptr-1] == minele) break;
		if(a[fptr-1] == lar) {
			minele = min(minele, a[fptr-1]);
			while(fptr > 0 && a[fptr-1] == lar) --fptr;
		}
		if(a[bptr+1] == lar) {
			minele = min(minele, a[bptr+1]);
			while(bptr < n-1 && a[bptr+1] == lar) ++bptr;
		}
	}
	if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
		cout << "YES\n" << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
	} else {
		cout << "NO\n";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] > a[bptr+1]) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] == max({minele, a[fptr-1], a[bptr+1]})) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else {
				++bptr;
				minele = min(minele, a[bptr]);
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	ll maxele = *max_element(a, a+n);
	int cntmax = 0;
	for(int i = 0; i < n; i++) cntmax += (a[i] == maxele);
	if(cntmax >= 3) {
		bool first = true;
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele && !first) {
				cout << "YES" << "\n" << i << " " << 1 << " " << n-1-i << "\n";
				return;
			} else if(a[i] == maxele) {
				first ^= 1;
			}
		}
	}
	int fi = 1e9, li = -1e9;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			fi = min(fi, i);
			li = max(li, i);
		}
	}
	int fptr = fi, bptr = li;
	ll minele = *min_element(a+fi, a+li+1);
	ll maxpre[n], maxsuf[n];
	maxpre[0] = a[0];
	for(int i = 1; i < n; i++) maxpre[i] = max(maxpre[i-1], a[i]);
	maxsuf[n-1] = a[n-1];
	for(int i = n-2; i >= 0; i--) maxsuf[i] = max(maxsuf[i+1], a[i]);
	while(fptr > 0 && a[fptr-1] > minele) --fptr;
	while(bptr < n-1 && a[bptr+1] > minele) ++bptr;
	while(true) {
		if(fptr-1 < 0 || bptr+1 >= n) {
			cout << "NO" << "\n";
			return;
		}
		ll lar = max(maxpre[fptr-1], maxsuf[bptr+1]);
		if(maxpre[fptr-1] == maxsuf[bptr+1] && maxpre[fptr-1] == minele) break;
		if(maxpre[fptr-1] == lar) {
			minele = maxpre[fptr-1];
			while(fptr > 0 && maxpre[fptr-1] == lar) --fptr;
		} else {
			minele = maxsuf[bptr+1];
			while(bptr < n-1 && maxsuf[bptr+1] == lar) ++bptr;
		}
	}
	if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
		cout << "YES\n" << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
	} else {
		cout << "NO\n";
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(a[fptr-1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				--fptr;
			} else if(a[bptr+1] == max({minele, maxpre[fptr-1], maxsuf[bptr+1]})) {
				++bptr;
			} else {
				if(maxpre[fptr-1] > maxsuf[bptr+1]) {
					--fptr;
				} else if(maxpre[fptr-1] < maxsuf[bptr+1]) {
					++bptr;
				} else {
					if(a[fptr-1] > a[bptr+1]) {
						--fptr;
					} else {
						++bptr;
					}
				}
				minele = min({minele, a[fptr], a[bptr]});
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second

void solve() {
	int n;
	cin >> n;
	ll a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll maxele = *max_element(a, a+n);
	int cnt = 0, fidx = 1e9, lidx = -1;
	for(int i = 0; i < n; i++) {
		if(a[i] == maxele) {
			++cnt;
			fidx = min(fidx, i);
			lidx = max(lidx, i);
		}
	}
	if(cnt >= 3) {
		for(int i = 0; i < n; i++) {
			if(a[i] == maxele) {
				if(i != fidx && i != lidx) {
					cout << "YES\n";
					cout << i << " " << 1 << " " << n-i-1 << "\n";
					return;
				}
			}
		}
	} else {
		int fptr = fidx, bptr = lidx;
		ll minele = 1e9;
		for(int i = fptr; i <= bptr; i++) {
			minele = min(minele, a[i]);
		}
		ll maxpre[n], maxsuf[n];
		maxpre[0] = a[0];
		for(int i = 1; i < n; i++) {
			maxpre[i] = max(maxpre[i-1], a[i]);
		}
		maxsuf[n-1] = a[n-1];
		for(int i = n-2; i >= 0; i--) {
			maxsuf[i] = max(maxsuf[i+1], a[i]);
		}
		while(true) {
			if(fptr-1 < 0 || bptr+1 >= n) {
				cout << "NO\n";
				return;
			}
			if(maxpre[fptr-1] == minele && maxsuf[bptr+1] == minele) {
				cout << "YES\n";
				cout << fptr << " " << bptr-fptr+1 << " " << n-1-bptr << "\n";
				return;
			}
			if(maxpre[fptr-1] > minele) {
				--fptr;
				minele = min(minele, a[fptr]);
			} else if(maxsuf[bptr+1] > minele) {
				++bptr;
				minele = min(minele, a[bptr]);
			} else {
				if(maxpre[fptr-1] > maxsuf[bptr+1]) {
					--fptr;
				} else {
					++bptr;
				}
			}
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--) solve();
	return 0;
}


#include <set>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10, INF = 1e18;

int a[N], suf[N], seg[N << 2];

void build(int i, int j, int n) {
  if (i == j) {
    seg[n] = a[i];
    return;
  }
  int m = (i + j) >> 1;
  build(i, m, n << 1);
  build(m + 1, j, n << 1 | 1);
  seg[n] = min(seg[n << 1], seg[n << 1 | 1]);
}

int query(int i, int j, int l, int r, int n) {
  if (i > r || j < l) {
      return INF;
  }
  if (i >= l && j <= r) {
    return seg[n];
  }
  int m = (i + j) >> 1;
  return min(query(i, m, l, r, n << 1), query(m + 1, j, l, r, n << 1 | 1));
}

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    suf[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; --i) {
      suf[i] = max(suf[i + 1], a[i]);
    }
    build(0, n - 1, 1);
    int mx = 0;
    bool ok = 0;
    for (int i = 0; i + 2 < n; ++i) {
      mx = max(mx, a[i]);
      int l = i + 1, r = n - 2;
      while (l + 3 < r) {
        int m = (l + r) >> 1;
        int y = suf[m + 1];
        int x = query(0, n - 1, i + 1, m, 1);
        if (x < mx) {
          r = m - 1;
        } else if (x > mx) {
          l = m + 1;
        } else if (y < mx) {
          r = m - 1;
        } else if (y > mx) {
          l = m + 1;
        } else {
          l = m;
          break;
        }
      }
      while (l <= r) {
        int y = suf[l + 1];
        int x = query(0, n - 1, i + 1, l, 1);
        if (x == y && x == mx) {
          ok = 1;
          cout << "YES\n" << i + 1 << ' ' << l - i << ' ' << n - l - 1 << '\n';
          break;
        }
        ++l;
      }
      if (ok) {
        break;
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[1] - 1 << " 1 " << n - v[1] << '\n';
    } else {
      suf[n] = a[n];
      for (int i = n; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (l > 1 && r < n) {
        while (1) {
          int p = l, q = r;
          while (l > 2 && pre[l - 1] > mn) {
            mn = min(mn, a[--l]);
          }
          while (r < n - 1 && suf[r + 1] > mn) {
            mn = min(mn, a[++r]);
          }
          if (p - q == l - r) {
            break;
          }
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          if (r == n - 1) {
            mn = a[--l];
          } else if (l == 2) {
            mn = a[++r];
          } else {
            if (a[l - 1] > a[r + 1]) {
              mn = a[--l];
            } else {
              mn = a[++r];
            }
          }
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[0] << ' ' << v[1] - v[0] << ' ' << n - v[1] << '\n';
    } else {
      suf[n] = a[n];
      for (int i = n; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (r < v.back()) {
        mn = min(mn, a[r++]);
      }
      while (l > 1 && r < n) {
        while (l > 1 && a[l - 1] >= mn) {
          --l;
        }
        while (r < n && a[r + 1] >= mn) {
          ++r;
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          mn = max(mn, max(pre[l - 1], suf[r + 1]));
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[1] - 1 << " 1 " << n - v[1] << '\n';
    } else {
      suf[n] = a[n];
      for (int i = n; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (r < v.back()) {
        mn = min(mn, a[r++]);
      }
      while (1) {
        while (l > 2 && a[l - 1] >= mn) {
          --l;
        }
        while (r < n - 1 && a[r + 1] >= mn) {
          ++r;
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          if (l == 2) {
            if (r == n - 1) {
              break;
            }
            mn = a[++r];
          } else if (r == n - 1) {
            mn = a[--l];
          } else {
            if (a[l - 1] > a[r + 1]) {
              mn = a[--l];
            } else {
              mn = a[++r];
            }
          }
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <set>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10, INF = 1e18;

int ret[2] = {INF, 0};
int a[N], seg[N << 2][2];

void build(int i, int j, int n) {
  if (i == j) {
    seg[n][0] = seg[n][1] = a[i];
    return;
  }
  int m = (i + j) >> 1;
  build(i, m, n << 1);
  build(m + 1, j, n << 1 | 1);
  seg[n][0] = min(seg[n << 1][0], seg[n << 1 | 1][0]);
  seg[n][1] = max(seg[n << 1][1], seg[n << 1 | 1][1]);
}

int query(int i, int j, int l, int r, int n, bool b) {
  if (i > r || j < l) {
      return ret[b];
  }
  if (i >= l && j <= r) {
    return seg[n][b];
  }
  int m = (i + j) >> 1;
  if (b) {
    return max(query(i, m, l, r, n << 1, 1), query(m + 1, j, l, r, n << 1 | 1, 1));
  } else {
    return min(query(i, m, l, r, n << 1, 0), query(m + 1, j, l, r, n << 1 | 1, 0));
  }
}

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    build(0, n - 1, 1);
    int mx = 0;
    bool ok = 0;
    for (int i = 0; i + 2 < n; ++i) {
      mx = max(mx, a[i]);
      bool nope = 0;
      int l = i + 1, r = n - 2;
      while (l + 3 < r) {
        int m = (l + r) >> 1;
        int x = query(0, n - 1, i + 1, m, 1, 0);
        int y = query(0, n - 1, m + 1, n - 1, 1, 1);
        if (x < mx) {
          l = m + 1;
        } else if (x > mx) {
          r = m - 1;
        } else if (y < mx) {
          r = m - 1;
        } else if (y > mx) {
          l = m + 1;
        } else {
          l = m;
          break;
        }
      }
      while (l < n - 1 && l <= r) {
        int x = query(0, n - 1, i + 1, l, 1, 0);
        int y = query(0, n - 1, l + 1, n - 1, 1, 1);
        if (x == y && x == mx) {
          ok = 1;
          cout << "YES\n" << i + 1 << ' ' << l - i << ' ' << n - l - 1 << '\n';
          break;
        }
        ++l;
      }
      if (ok) {
        break;
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[0] << ' ' << v[1] - v[0] << ' ' << n - v[1] << '\n';
    } else {
      for (int i = n + 1; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (r < v.back()) {
        mn = min(mn, a[r++]);
      }
      while (l > 1 && r < n) {
        while (l > 1 && a[l - 1] >= mn) {
          --l;
        }
        while (r < n && a[r + 1] >= mn) {
          ++r;
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          mn = max(mn, max(pre[l - 1], suf[r + 1]));
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[1] - 1 << " 1 " << n - v[1] << '\n';
    } else {
      suf[n] = a[n];
      for (int i = n; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (l > 1 && r < n) {
        while (1) {
          int p = l, q = r;
          while (l > 2 && pre[l - 1] > mn) {
            mn = min(mn, a[--l]);
          }
          while (r < n - 1 && suf[r + 1] > mn) {
            mn = min(mn, a[++r]);
          }
          if (p - q == l - r) {
            break;
          }
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          if (a[l - 1] > a[r + 1]) {
            mn = a[--l];
          } else {
            mn = a[++r];
          }
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}


#include <vector>
#include <iostream>

using namespace std;

#define int long long

const int N = 2e5 + 10;

int a[N], pre[N], suf[N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
      pre[i] = max(pre[i - 1], a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (pre[n] == a[i]) {
        v.push_back(i);
      }
    }
    bool ok = 0;
    if (v.size() > 2) {
      ok = 1;
      cout << "YES\n" << v[1] - 1 << " 1 " << n - v[1] << '\n';
    } else {
      suf[n] = a[n];
      for (int i = n; --i;) {
        suf[i] = max(suf[i + 1], a[i]);
      }
      int l = v[0], r = v[0], mn = pre[n];
      while (r < v.back()) {
        mn = min(mn, a[r++]);
      }
      while (1) {
        int p = l, q = r;
        while (l > 2 && a[l - 1] >= mn) {
          --l;
        }
        while (r < n - 1 && a[r + 1] >= mn) {
          ++r;
        }
        if (pre[l - 1] == suf[r + 1] && pre[l - 1] == mn) {
          ok = 1;
          cout << "YES\n" << l - 1 << ' ' << r - l + 1 << ' ' << n - r << '\n';
          break;
        } else {
          mn = max(a[l - 1], a[r + 1]);
        }
        if (p == l && q == r) {
          break;
        }
      }
    }
    if (!ok) {
      cout << "NO\n";
    }
  }
  return 0;
}