#include<bits/stdc++.h>
using namespace std;
void solve(){
string s;
cin>>s;
int pos=s.length()-1;
for(;pos;pos--)
if(s[pos]!='l'&&s[pos]!='q'&&s[pos]!='b')
break;
string tmp=s.substr(0,pos+1);
bool fg=true;
for(int i=0,j=tmp.length()-1;i<=j;i++,j--){
if(tmp[i]!=tmp[j]){
fg=false;
break;
}
}
cout<<(fg?"Yes":"No")<<"\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--) solve();
return 0;
}