import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i = 0; i < n; i++) {
// 第一个字符串
String x = new String();
x = in.next();
int xlen = x.length();
ArrayList<Character> a = new ArrayList<Character>();
for (int j = 0; j < xlen; j++) {
a.add(x.charAt(j));
}
Collections.sort(a);
// 第二个字符串
String y = new String();
y = in.next();
int ylen = y.length();
ArrayList<Character> b = new ArrayList<Character>();
for (int j = 0; j < ylen; j++) {
b.add(y.charAt(j));
}
Collections.sort(b);
// 判断
if (a.equals(b)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}