import java.util.Scanner;
class Codechef
{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int i=0;i<t;i++) {
String x = s.next();
lapindrome(x);
}
}
public static void lapindrome(String x) {
int l = x.length();
String s1;
String s2;
int count = 0;
if(l%2==0)
{
s1 = x.substring(0,(l/2));
s2 = x.substring((l/2),l);
}
else
{
s1 = x.substring(0,(l/2));
s2 = x.substring((l/2+1),l);
}
char a1[]=s1.toCharArray();
char a2[]=s2.toCharArray();
for(int i = 0;i<a1.length;i++)
{
int temp=0;
int temp1=0;
for(int j=0;j<a1.length;j++)
{
if(a1[i]==a1[j])
temp++;
}
for(int k =0;k<a2.length;k++)
{
if(a1[i]==a2[k])
temp1++;
}
if(temp==temp1)
count=1;
else
count=0;
}
for(int i = 0;i<a2.length;i++)
{
int temp=0;
int temp1=0;
for(int j=0;j<a2.length;j++)
{
if(a2[i]==a2[j])
temp++;
}
for(int k =0;k<a1.length;k++)
{
if(a2[i]==a1[k])
temp1++;
}
if(temp==temp1)
count=1;
else
count=0;
}
if(count == 1)
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
}