//Sarvagya Agarwal
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define is(X) cout<<#X<<" is "<<X<<endl
#define ff first
#define ll long long
#define ss second
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
int main()
{
fast;
//openin;
int t;
cin>>t;
while(t--)
{
string s,temp1,temp2,temp3,temp4;
cin>>s;
set<string> ss;
int n = s.size();bool flag=false;
for(int i=1;i<n;++i)
{
for(int j=i+1;j<n;++j)
{
for(int k=j+1;k<n;++k)
{
temp1="";temp2="";temp3="";temp4="";
for(int z = 0;z<i;z++)temp1+=s[z];
for(int z = i;z<j;z++)temp2+=s[z];
for(int z = j;z<k;z++)temp3+=s[z];
for(int z = k;z<n;z++)temp4+=s[z];
if(temp1.size()==0 || temp2.size()==0 || temp3.size()==0 || temp4.size()==0)continue;
ss.insert(temp1);ss.insert(temp2);ss.insert(temp3);ss.insert(temp4);
if(ss.size()==4)
{
flag=true;
cout<<"YES\n";
break;
}
ss.clear();
}
if(flag)break;
}
if(flag)break;
}
if(!flag)cout<<"NO\n";
}
return 0;
}
Ly9TYXJ2YWd5YSBBZ2Fyd2FsCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgcmVwKGksYSxiKSBmb3IoaW50IGk9YTtpPD1iOysraSkKI2RlZmluZSBpcyhYKSBjb3V0PDwjWDw8IiBpcyAiPDxYPDxlbmRsCiNkZWZpbmUgZmYgZmlyc3QKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBzcyBzZWNvbmQKI2RlZmluZSBmYXN0IGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpO2Npbi50aWUoMCk7Y291dC50aWUoMCkKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCB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