rt
#include<bits/stdc++.h>
using namespace std;
int T;
string str;
inline bool check()
{
if(str[0]=='D'&&str[1]=='X')return true;
for(int i=2;i<str.size()-3;i++)
if(str[i]==str[i+1]&&str[i+1]==str[i+2]&&str[i+2]==str[i+3])return true;
return false;
}
int main()
{
ios::sync_with_stdio(false);
cin>>T;
while(T--)
{
cin>>str;
puts(check()?"Yes":"No");
}
return 0;
}