#include<bits/stdc++.h>

using namespace std;

void solve();

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}
void solve()
{
	string s;
	cin>>s;
	int n=s.size();
	if(s.empty())
    {
        cout<<"NO"<<endl;
        return;
    }
    bool flag=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]!='a')
        {
            flag=1;
            break;
        }
    }
    if(!flag)
    {
        cout<<"NO"<<endl;
        return;
    }
    int count=0;
    for(int j=n-1;j>=0;j--)
    {
        if(s[j]!='a')
        {
            break;
        }
        count++;
    }
    s.insert(s.begin()+count,'a');
    cout<<"YES"<<endl;
    cout<<s<<endl;
    return;
}

