#include<bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(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 A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

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

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

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(...) 42
#endif

void solve()
{
    string s;
    cin>>s;
    int n=s.size();
    s="."+s;
    string t=".atcoder";
    int res=-1;
    for(int i=0; i<=7; i++)
    {
        string a=s;
        int cur=0;
        for(int j=1; j<=i; j++)
        {
            bool found=false;
            for(int k=j; k<=n; k++)
            {
                if(a[k]==t[j])
                {
                    found=true;
                    for(int z=k; z>j; z--)
                    {
                        cur++;
                        swap(a[z],a[z-1]);
                    }
                    break;
                }
            }
            if(!found)
                cur=1e9;
        }
        bool have=false;
        if(i!=7)
        {
            for(int k=i+1; k<=n; k++)
            {
                if(a[k]>t[i+1])
                {
                    have=true;
                    for(int z=k; z>i+1; z--)
                    {
                        cur++;
                        swap(a[z],a[z-1]);
                    }
                    break;
                }
            }
        }
        if(cur==1e9)
            continue;
        if(have||(i==7&&n>7))
        {
            if(res==-1||res>cur)
                res=cur;
        }
    }
    cout<<res<<'\n';
}

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

//12252024832524
#include <cstdio>
#include <cstring>
#include <algorithm>
#define TT template<typename T>
using namespace std; 

typedef long long LL;
const int MAXN = 205;
int n;
int dp[MAXN * MAXN],ID[MAXN * MAXN],pre[MAXN * MAXN];
int ans[MAXN],ling1,ling2;

LL Read()
{
	LL x = 0,f = 1;char c = getchar();
	while(c > '9' || c < '0'){if(c == '-')f = -1;c = getchar();}
	while(c >= '0' && c <= '9'){x = (x*10) + (c^48);c = getchar();}
	return x * f;
}
TT void Put1(T x)
{
	if(x > 9) Put1(x/10);
	putchar(x%10^48);
}
TT void Put(T x,char c = -1)
{
	if(x < 0) putchar('-'),x = -x;
	Put1(x); if(c >= 0) putchar(c);
}
TT T Max(T x,T y){return x > y ? x : y;}
TT T Min(T x,T y){return x < y ? x : y;}
TT T Abs(T x){return x < 0 ? -x : x;}

int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n = Read();
	dp[0] = 1;
	for(int i = 1;i <= n;++ i)
	{
		int val = Read() % 200;
		if(!val)
		{
			if(!ling1) ling1 = i;
			else
			{
				printf("Yes\n1 %d\n1 %d",ling1,i);
				return 0;
			}
			continue;
		}
		for(int j = 200*200;j >= val;-- j)
			if(dp[j-val]) 
			{
				if(dp[j])
				{
					int tot = 0,now = j;
					while(now > 0)
					{
						ans[++tot] = ID[now];
						now = pre[now];
					}
					sort(ans+1,ans+tot+1);
					printf("Yes\n");
					Put(tot);
					for(int k = 1;k <= tot;++ k) putchar(' '),Put(ans[k]);
					putchar('\n');
					
					now = j-val; tot = 0;
					while(now > 0)
					{
						ans[++tot] = ID[now];
						now = pre[now];
					}
					ans[++tot] = i;
					sort(ans+1,ans+tot+1);
					Put(tot);
					for(int k = 1;k <= tot;++ k) putchar(' '),Put(ans[k]);
					putchar('\n');
					return 0;
				}
				dp[j] = 1,ID[j] = i,pre[j] = j-val;
			}
		int ID1 = -1,ID2 = -1;
		for(int j = 1;j < 200 && ID2 < 0;++ j)
		{
			ID1 = -1; ID2 = -1;
			for(int k = j;k <= 200*200;k += 200)
			{
				if(dp[k])
				{
					if(ID1 < 0) ID1 = k;
					else if(ID2 < 0)
					{
						ID2 = k;
						break;
					}
				}
			}
			if(ID1 >= 0 && ID2 >= 0) break;
		}
		if(ID1 >= 0 && ID2 >= 0)
		{
			printf("Yes\n");
			int tot = 0;
			while(ID1 > 0)
			{
				ans[++tot] = ID[ID1];
				ID1 = pre[ID1];
			}
			Put(tot);
			sort(ans+1,ans+tot+1);
			for(int j = 1;j <= tot;++ j) putchar(' '),Put(ans[j]);
			putchar('\n');
			tot = 0;
			while(ID2 > 0)
			{
				ans[++tot] = ID[ID2];
				ID2 = pre[ID2];
			}
			Put(tot);
			sort(ans+1,ans+tot+1);
			for(int j = 1;j <= tot;++ j) putchar(' '),Put(ans[j]);
			putchar('\n');
			return 0;
		}
	}
	printf("No");
	return 0;
}