#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9) + 1;

#define pb push_back
#define F first
#define S second
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less_equal <int> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define sz(x) (int)x.size()
ll time() {return chrono::system_clock().now().time_since_epoch().count();}
mt19937 rnd(time());

void solve()
{
    string s;
    cin >> s;

    bool can = false;
    int mem = 0;

    for (int i = 0; i < sz(s); i++)
        if (s[sz(s) - i - 1] != 'a')
        {
            can = true;
            mem = i;
            break;
        }
    if (can)
    {
        cout << "YES\n";
        for (int i = 0; i < sz(s); i++)
            if (mem == i)
                cout << 'a' << s[i];
            else
                cout << s[i];
        cout << '\n';
        return;
    }

    cout << "NO\n";
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    #ifdef _LOCAL_
        system("color a");
    #endif // _LOCAL_

    int t;
    cin >> t;

    while (t--)
        solve();
}
