public class Main2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = Integer.parseInt(in.nextLine());
List<String> res = new ArrayList<>();
for (int i = 0; i < N; i++) {
long v = in.nextLong();
if (v % 2 == 1) {
res.add("No");
} else {
long v1 = v;
while (v1 % 2 == 0) {
v1 = v1 / 2;
}
long v2 = v / v1;
res.add(v1 + " " + v2);
}
}
for (String word : res) {
System.out.println(word);
}
}
}