#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define endll endl
const int inf=0x3f3f3f3f;
#define int long long
#define bt(x,a,b)(a<=x && x<=b)
const ll inff=0x3f3f3f3f3f3f3f3f;
char a[300005];
signed main()
{
    ios::sync_with_stdio( false );
    cin.tie( nullptr ), cout.tie( nullptr );
    int n;
    cin>>n;
    for(int i = 0 ; i < n ; ++i){
        cin>>a;
        int len=strlen(a),flag=-1;
        for(int j = 0 ; j <len  ; ++j){
            if(a[len-j-1]!='a'){
                flag=j;
                break;
            }
            else
                flag=-1;
        }
        if(flag==-1)
            cout<<"NO"<<endl;
        else{
            cout<<"YES"<<endl;
            for(int j = 0 ; j < flag ; ++j){
                cout<<a[j];
            }
            cout<<'a';
            for(int j = flag ; j <len  ; ++j){
                cout<<a[j];
            }
            cout<<endl;
        }
    }
}