#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <string>
#include <sstream>
#include <utility>
#include <ctime>
using std::priority_queue;
using std::vector;
using std::swap;
using std::stack;
using std::sort;
using std::max;
using std::min;
using std::pair;
using std::map;
using std::string;
using std::cin;
using std::cout;
using std::set;
using std::queue;
using std::string;
using std::istringstream;
using std::make_pair;
using std::greater;
using std::endl;
char str[30];
bool vis[30];
int count[30];
int main()
{
int T;
scanf("%d", &T);
while(T--)
{
scanf("%s", str);
memset(vis, 0, sizeof(vis));
memset(count, 0, sizeof(count));
for(int i = 0; i < 26; ++i)
if(!vis[i])
{
int tc = 1;
int temp = i;
vis[i] = true;
while(str[temp]-'A' != i)
{
temp = str[temp]-'A';
vis[temp] = true;
++tc;
}
++count[tc];
}
bool ans(true);
for(int i = 2; i <= 26; i += 2)
if(count[i]&1)
{
ans = false;
break;
}
if(ans)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}