#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i, flag;
  string temp = "abcdefghijklmnopqrstuvwxyz";
  size_t found, f;
  cin >> t;
  while (t--) {
    string s;
    string ans = "";
    cin >> s;
    ans += s[0];
    flag = 1;
    for (i = 0; i < s.length() - 1; i++) {
      found = ans.find(s[i + 1]);
      if (found == string::npos) {
        f = ans.find(s[i]);
        if (f == 0)
          ans = s[i + 1] + ans;
        else if (f == ans.length() - 1)
          ans = ans + s[i + 1];
        else {
          flag = 0;
          break;
        }
      } else {
        if (!((found < ans.length() - 1 && ans[found + 1] == s[i]) ||
              (found > 0 && ans[found - 1] == s[i]))) {
          flag = 0;
          break;
        }
      }
    }
    if (flag) {
      for (i = 0; i < 26; i++) {
        found = ans.find(temp[i]);
        if (found == string::npos) ans = ans + temp[i];
      }
      cout << "YES\n";
      cout << ans << "\n";
    } else
      cout << "NO\n";
  }
  return 0;
}
