#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
struct SegTree
{
    //everything is indexed from 0
    int n;
    vector<int> tree, lazy;
    int INF = 1e9;
    void build(vector<int> &a, int v, int tl, int tr)
    {
        if (tl == tr)
        {
            tree[v] = a[tl];
        }
        else
        {
            int tm = (tl + tr) / 2;
            build(a, v * 2, tl, tm);
            build(a, v * 2 + 1, tm + 1, tr);
            tree[v] = min(tree[v * 2],tree[v * 2 + 1]); //TBC
        }
    }
    void build_tree(vector<int> &a)
    {
        n = a.size();
        tree.assign(4 * n, 0);
        // lazy.assign(4 * n, 0);
        build(a, 1, 0, n - 1);
    }
    int query(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return 1e9;
        if (l == tl && r == tr)
        {
            return tree[v];
        }
        int tm = (tl + tr) / 2;
        return min(query(v * 2, tl, tm, l, min(r, tm)), query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)); //TBC
    }
    int query(int l, int r)
    {
        return query(1, 0, n - 1, l, r);
    }
};
struct SegTree2
{
    //everything is indexed from 0
    int n;
    vector<int> tree, lazy;
    int INF = 1e9;
    void build(vector<int> &a, int v, int tl, int tr)
    {
        if (tl == tr)
        {
            tree[v] = a[tl];
        }
        else
        {
            int tm = (tl + tr) / 2;
            build(a, v * 2, tl, tm);
            build(a, v * 2 + 1, tm + 1, tr);
            tree[v] = max(tree[v * 2],tree[v * 2 + 1]); //TBC
        }
    }
    void build_tree(vector<int> &a)
    {
        n = a.size();
        tree.assign(4 * n, 0);
        // lazy.assign(4 * n, 0);
        build(a, 1, 0, n - 1);
    }
    int query(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return 0;
        if (l == tl && r == tr)
        {
            return tree[v];
        }
        int tm = (tl + tr) / 2;
        return max(query(v * 2, tl, tm, l, min(r, tm)), query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)); //TBC
    }
    int query(int l, int r)
    {
        return query(1, 0, n - 1, l, r);
    }
};
ll n;
// ve <ll> logx(2e5+1);
bool is_ok(ll val, ll p, ll q, ll r, SegTree &S1, SegTree2 &S2)
{
    if (p<=0||q<=0||r<=0)
    {
        return false;
    }
    ll l1 = 0, r1 = p - 1;
    ll A = S2.query(l1,r1);
    l1 = p, r1 = p + q - 1;
    ll B = S1.query(l1,r1);
    l1 = p + q, r1 = p + q + r - 1;
    ll C = S2.query(l1,r1);
    // cout <<"ABC.. "<<A<<" "<<B<<" "<<C<<"\n";
    if (A==B&&B==C)
    {
        return true;
    }
    return false;
}
int main()
{
    FAST
        // freopen("input1.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);

    //     logx[1] = 0;
    // for (ll i = 2; i <=2e5; i++)
    //     logx[i] = logx[i / 2] + 1;
    ll tests;
    cin >> tests;
    rep(gg, 0, tests)
    {
        cin >> n;
        ve<ll> arr(n);
        unordered_map <ll, ll> m1;
        set <ll,greater <ll>> s1;
        rep(i, 0, n)
        {
            cin >> arr[i];
            s1.insert(arr[i]);
        }
        ll ii=0;
        for (auto x: s1)
        {
            m1[x]=ii;
            ii++;
        }
        ve <ve <ll>> vv1(s1.size());
        ve <ll> vv2(s1.size());
        rep (i,0,n)
        {
            vv1[m1[arr[i]]].pb(i);
        }

        SegTree S1;
        SegTree2 S2;
        S1.build_tree(arr);
        S2.build_tree(arr);
        
        ll X = 0, Y = 0, Z = 0;
        bool flag = false;
        ll L = 1e9, R = -1;
        for (int z=0;z<vv1.size();z++)
        {
        //     // cout<<"arr.. "<<-m.first<<" "<<L<<" "<<R<<"\n";
            if (vv1[z].size() >= 3)
            {
                if (L == 1e9 && R == -1)
                {
                    flag = true;
                    X = vv1[z][1];
                    Y = 1;
                    Z = n - 1 - vv1[z][1];
                    break;
                }
                else
                {
                    ll p, q, r;
                    p = L, q = R - L + 1, r = n - p - q;
                    // cout<<p<<" "<<q<<" "<<r<<"\n";
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    p--, q++;
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    p++, q--;
                    q++, r--;
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    q--, r++;
                }
            }
            ll g =vv1[z][0];
            ll w = vv1[z][(ll)vv1[z].size() - 1];
            L = min(g, L);
            R = max(R, w);
        }

        if (flag)
        {
            cout << "YES\n";
            cout << X << " " << Y << " " << Z << "\n";
        }
        else
        {
            cout << "NO\n";
        }
    }
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

You are given an array a consisting of n integers.

Let min(l, r) be the minimum value among a_l, a_{l + 1}, …, a_r and max(l, r) be the maximum value among a_l, a_{l + 1}, …, a_r.

Your task is to choose three positive (greater than 0) integers x, y and z such that:

  * x + y + z = n; 
  * max(1, x) = min(x + 1, x + y) = max(x + y + 1, n). 



In other words, you have to split the array a into three consecutive non-empty parts that cover the whole array and the maximum in the first part equals the minimum in the second part and equals the maximum in the third part (or determine it is impossible to find such a partition).

Among all such triples (partitions), you can choose any.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 2 ⋅ 10^4) — the number of test cases. Then t test cases follow.

The first line of the test case contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the length of a.

The second line of the test case contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), where a_i is the i-th element of a.

It is guaranteed that the sum of n does not exceed 2 ⋅ 10^5 (∑ n ≤ 2 ⋅ 10^5).

Output

For each test case, print the answer: NO in the only line if there is no such partition of a that satisfies the conditions from the problem statement. Otherwise, print YES in the first line and three integers x, y and z (x + y + z = n) in the second line.

If there are several answers, you can print any.

Example

Input


6
11
1 2 3 3 3 4 4 3 4 2 1
8
2 9 1 7 3 9 4 1
9
2 1 4 2 4 3 3 1 2
7
4 2 1 1 4 1 4
5
1 1 1 1 1
7
4 3 4 3 3 3 4


Output


YES
6 1 4
NO
YES
2 5 2
YES
4 1 2
YES
1 1 3
YES
2 1 4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
struct SegTree
{
    //everything is indexed from 0
    int n;
    vector<int> tree, lazy;
    int INF = 1e9;
    void build(vector<int> &a, int v, int tl, int tr)
    {
        if (tl == tr)
        {
            tree[v] = a[tl];
        }
        else
        {
            int tm = (tl + tr) / 2;
            build(a, v * 2, tl, tm);
            build(a, v * 2 + 1, tm + 1, tr);
            tree[v] = min(tree[v * 2],tree[v * 2 + 1]); //TBC
        }
    }
    void build_tree(vector<int> &a)
    {
        n = a.size();
        tree.assign(4 * n, 0);
        // lazy.assign(4 * n, 0);
        build(a, 1, 0, n - 1);
    }
    int query(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return 1e9;
        if (l == tl && r == tr)
        {
            return tree[v];
        }
        int tm = (tl + tr) / 2;
        return min(query(v * 2, tl, tm, l, min(r, tm)), query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)); //TBC
    }
    int query(int l, int r)
    {
        return query(1, 0, n - 1, l, r);
    }
};
struct SegTree2
{
    //everything is indexed from 0
    int n;
    vector<int> tree, lazy;
    int INF = 1e9;
    void build(vector<int> &a, int v, int tl, int tr)
    {
        if (tl == tr)
        {
            tree[v] = a[tl];
        }
        else
        {
            int tm = (tl + tr) / 2;
            build(a, v * 2, tl, tm);
            build(a, v * 2 + 1, tm + 1, tr);
            tree[v] = max(tree[v * 2],tree[v * 2 + 1]); //TBC
        }
    }
    void build_tree(vector<int> &a)
    {
        n = a.size();
        tree.assign(4 * n, 0);
        // lazy.assign(4 * n, 0);
        build(a, 1, 0, n - 1);
    }
    int query(int v, int tl, int tr, int l, int r)
    {
        if (l > r)
            return 0;
        if (l == tl && r == tr)
        {
            return tree[v];
        }
        int tm = (tl + tr) / 2;
        return max(query(v * 2, tl, tm, l, min(r, tm)), query(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)); //TBC
    }
    int query(int l, int r)
    {
        return query(1, 0, n - 1, l, r);
    }
};
ll n;
// ve <ll> logx(2e5+1);
bool is_ok(ll val, ll p, ll q, ll r, SegTree &S1, SegTree2 &S2)
{
    if (p<=0||q<=0||r<=0)
    {
        return false;
    }
    ll l1 = 0, r1 = p - 1;
    ll A = S2.query(l1,r1);
    l1 = p, r1 = p + q - 1;
    ll B = S1.query(l1,r1);
    l1 = p + q, r1 = p + q + r - 1;
    ll C = S2.query(l1,r1);
    // cout <<"ABC.. "<<A<<" "<<B<<" "<<C<<"\n";
    if (A==B&&B==C)
    {
        return true;
    }
    return false;
}
int main()
{
    FAST
        // freopen("input1.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);

    //     logx[1] = 0;
    // for (ll i = 2; i <=2e5; i++)
    //     logx[i] = logx[i / 2] + 1;
    ll tests;
    cin >> tests;
    rep(gg, 0, tests)
    {
        cin >> n;
        ve<ll> arr(n);
        unordered_map <ll, ll> m1;
        set <ll,greater <ll>> s1;
        rep(i, 0, n)
        {
            cin >> arr[i];
            s1.insert(arr[i]);
        }
        ll ii=0;
        for (auto x: s1)
        {
            m1[x]=ii;
            ii++;
        }
        ve <ve <ll>> vv1(s1.size());
        ve <ll> vv2(s1.size());
        rep (i,0,n)
        {
            vv1[m1[arr[i]]].pb(i);
        }

        SegTree S1;
        SegTree2 S2;
        S1.build_tree(arr);
        S2.build_tree(arr);
        
        ll X = 0, Y = 0, Z = 0;
        bool flag = false;
        ll L = 1e9, R = -1;
        for (int z=0;z<vv1.size();z++)
        {
        //     // cout<<"arr.. "<<-m.first<<" "<<L<<" "<<R<<"\n";
            if (vv1[z].size() >= 3)
            {
                if (L == 1e9 && R == -1)
                {
                    flag = true;
                    X = vv1[z][1];
                    Y = 1;
                    Z = n - 1 - vv1[z][1];
                    break;
                }
                else
                {
                    ll p, q, r;
                    p = L, q = R - L + 1, r = n - p - q;
                    // cout<<p<<" "<<q<<" "<<r<<"\n";
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    p--, q++;
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    p++, q--;
                    q++, r--;
                    if (is_ok(vv2[z],p, q, r, S1, S2))
                    {
                        flag = true;
                        X = p, Y = q, Z = r;
                        break;
                    }
                    q--, r++;
                }
            }
            ll g =vv1[z][0];
            ll w = vv1[z][(ll)vv1[z].size() - 1];
            L = min(g, L);
            R = max(R, w);
        }

        if (flag)
        {
            cout << "YES\n";
            cout << X << " " << Y << " " << Z << "\n";
        }
        else
        {
            cout << "NO\n";
        }
    }
}

```