#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ll long long
#define ull unsigned long long
#define dl double
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sp " "
#define fi "\n"
#define ld long double
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef vector<int> vi;
typedef vector<ll> vll;
const int mod = 1e9 + 7;

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    // freopen("errors.txt", "w", stderr);
#endif
}

void fast() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int cnt=1;
void solve() {
    string s;cin>>s;
    int n = s.length();
    int l=0,r=0,mini=1e9;
    pair<int,int> ans;
    vi mp(12);
    bool x=0;
    while (l<n) {
        while (r<n && !x) {
            if (s[r]=='0' && r-1>=0 && s[r-1]=='1') {
                mp[10]++;
                mp[1]--;
                r++;
            }
            else {
                mp[s[r]-'0']++;
                r++;
            }
            bool y=0;
            for (int i=2;i<=10;i++) {
                if (mp[i]<=0)y=1;
            }
            if ((mp[0]>0&& mp[1]>0 && !y) || (!y && mp[10]>1))
                x=1;
        }
        if (x && r-l<mini) {
            mini=r-l;
            ans=make_pair(l+1,r);
        }
        if (s[l]=='1' && l+1<n && s[l+1]=='0') {
            mp[0]++;
            mp[1]++;
            mp[10]--;
        }
        mp[s[l]-'0']--;
        {
            bool y=0;
            x=0;
            for (int i=2;i<=10;i++) {
                if (mp[i]<=0)y=1;
            }
            if ((mp[0]>0 && mp[1]>0 && !y) || (!y && mp[10]>1))
                x=1;
        }
        l++;
    }
    cout<<"Case "<<cnt++<<": ";
    if (mini==1e9)cout<<"NO";
    else cout<<"YES "<<ans.first<<" "<<ans.second;
    cout<<fi;

}
signed main() {
    fast();
    file();
    int off=1;
    cin>>off;
    while (off--)solve();
}