#include <iostream>
using namespace std;
#include<unordered_map>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<climits>
#include<sstream>
#include<queue>
#include<stack>
#include<set>
#define ll int
#define loop(k,x,n) for( long long x = k; x < n; ++x )
#define rloop(k,x,n) for( long long x = n-1-k ; x>=0 ; x--)
#define t(n) long long* t = new long long[n]
#define h(n) long long* h = new long long[n]
#define visit(n) long long* visit = new long long[n]
#define v(x) vector<x> v
#define um(x,y) unordered_map<x,y> um;
#define endl '\n'


void solve(){

   string s;
   cin>>s;

   bool nota = false;

   for( ll i=0 ; i<s.size() ; i++ ){
       if( s.substr(i ,1) != "a" ){
           nota = true;
           break;
       }
   }

   if( nota ){
       cout<<"YES"<<endl;
       ll index = -1;

       string ans = "";
       for(  ll i=0 ; i<s.size() ; i++ ){
           if( s.substr(i,1) != "a" ){
              index = s.size()-i;
              break;
           }
       }

       ans+=s.substr(0 , index);
       ans+="a";
       ans+=s.substr(index);

       cout<<ans<<endl;

   }else{
       cout<<"NO"<<endl;
   }




}

int main(){

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll t;
  cin>>t;

  while( t > 0 ){
   solve();
   t--;
  }

}
