//lapindromes
#include<stdio.h>
#include<string.h>
int count(char str[],char ch)
{
int count=0,k=0;
while(str[k]!='\0')
{
if(str[k]==ch)
count++;
k++;
}
return count;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,j,yes=1;
char s[1000];
scanf("%s",s);
char str1[501],str2[501];
int n=strlen(s);
if(n%2==0)
{
for(i=0;i<n/2;i++)
str1[i]=s[i];
for(j=n/2;s[j]!='\0';j++)
str2[j]=s[j];
}
else
{
for(i=0;i<n/2;i++)
str1[i]=s[i];
for(j=n/2+1;s[j]!='\0';j++)
str2[j]=s[j];
}
for(i=0;i<strlen(str1);i++)
{
if(count(str1,str1[i])!=count(str2,str1[i]))
{
yes=0;
break;
}
}
if(yes)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}