Problem: We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.

You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.

Input

The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012).

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d specifier.

Output

Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.

Examples

Input

3
4 5 6


Output

YES
NO
NO

Note

The given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".

Solution (in JAVA):

Solution:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Usuario
 */
public class Tprimes {

    private static final boolean SHOULD_BUFFER_OUTPUT = true;

    static final SuperWriter sw = new SuperWriter(System.out);

    static final Scanner sc = new Scanner();

    public static void main() {
        int casos = sc.nextInt();
        for (double entrada : sc.nextDoubleArray(casos)) {
            if (entrada == 4) {
                sw.printLine("YES");
            } else if (entrada == 2 || entrada == 1) {
                sw.printLine("NO");
            } else if (entrada % 2 != 0) {
                double raiz = Math.sqrt(entrada);
                if (Math.round(raiz) == raiz) {
                    double raizDeRaiz = Math.sqrt(raiz);
                    int contador = 3;
                    int raizEntera = (int) raiz;
                    int raizDeRaizEntera = (int) raizDeRaiz;
                    while (raizEntera % contador != 0
                            && contador <= raizDeRaizEntera) {
                        contador++;
                    }
                    if (Math.round(raizDeRaiz) == raizDeRaiz) {
                        sw.printLine("NO");
                    } else if (contador >= raizDeRaiz) {
                        sw.printLine("YES");
                    } else {
                        sw.printLine("NO");
                    }
                } else {
                    sw.printLine("NO");
                }
            } else {
                sw.printLine("NO");
            }
        }

        
    }

    static class SuperScanner extends Scanner {

        private InputStream stream;
        private byte[] buf = new byte[8096];
        private int curChar;
        private int numChars;

        public SuperScanner() {
            this.stream = System.in;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private final StringBuilder sb = new StringBuilder();

        @Override
        public String next() {
            int c = read();
            while (isWhitespace(c)) {
                if (c == -1) {
                    return null;
                }
                c = read();
            }
            sb.setLength(0);
            do {
                sb.append((char) c);
                c = read();
            } while (!isWhitespace(c));
            return sb.toString();
        }

        @Override
        public int nextInt() {
            int c = read();
            while (isWhitespace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = (res << 3) + (res << 1);
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }

        @Override
        public long nextLong() {
            int c = read();
            while (isWhitespace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = (res << 3) + (res << 1);
                res += c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sgn;
        }
    }

    static class Scanner {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        public String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }

        public int nextIntOrQuit() {
            Integer n = nextInteger();
            if (n == null) {
                sw.close();
                System.exit(0);
            }
            return n.intValue();
        }

        public String next() {
            while (!st.hasMoreTokens()) {
                String l = nextLine();
                if (l == null) {
                    return null;
                }
                st = new StringTokenizer(l);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < res.length; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < res.length; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public double[] nextDoubleArray(int n) {
            double[] res = new double[n];
            for (int i = 0; i < res.length; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public void sortIntArray(int[] array) {
            Integer[] vals = new Integer[array.length];
            for (int i = 0; i < array.length; i++) {
                vals[i] = array[i];
            }
            Arrays.sort(vals);
            for (int i = 0; i < array.length; i++) {
                array[i] = vals[i];
            }
        }

        public void sortLongArray(long[] array) {
            Long[] vals = new Long[array.length];
            for (int i = 0; i < array.length; i++) {
                vals[i] = array[i];
            }
            Arrays.sort(vals);
            for (int i = 0; i < array.length; i++) {
                array[i] = vals[i];
            }
        }

        public void sortDoubleArray(double[] array) {
            Double[] vals = new Double[array.length];
            for (int i = 0; i < array.length; i++) {
                vals[i] = array[i];
            }
            Arrays.sort(vals);
            for (int i = 0; i < array.length; i++) {
                array[i] = vals[i];
            }
        }

        public String[] nextStringArray(int n) {
            String[] vals = new String[n];
            for (int i = 0; i < n; i++) {
                vals[i] = next();
            }
            return vals;
        }

        public Integer nextInteger() {
            String s = next();
            if (s == null) {
                return null;
            }
            return Integer.parseInt(s);
        }

        public int[][] nextIntMatrix(int n, int m) {
            int[][] ans = new int[n][];
            for (int i = 0; i < n; i++) {
                ans[i] = nextIntArray(m);
            }
            return ans;
        }

        public char[][] nextGrid(int r) {
            char[][] grid = new char[r][];
            for (int i = 0; i < r; i++) {
                grid[i] = next().toCharArray();
            }
            return grid;
        }

        public static <T> T fill(T arreglo, int val) {
            if (arreglo instanceof Object[]) {
                Object[] a = (Object[]) arreglo;
                for (Object x : a) {
                    fill(x, val);
                }
            } else if (arreglo instanceof int[]) {
                Arrays.fill((int[]) arreglo, val);
            } else if (arreglo instanceof double[]) {
                Arrays.fill((double[]) arreglo, val);
            } else if (arreglo instanceof long[]) {
                Arrays.fill((long[]) arreglo, val);
            }
            return arreglo;
        }

        public <T> T[] nextObjectArray(Class<T> clazz, int size) {
            @SuppressWarnings("unchecked")
            T[] result = (T[]) java.lang.reflect.Array.newInstance(clazz, size);
            for (int c = 0; c < 3; c++) {
                Constructor<T> constructor;
                try {
                    if (c == 0) {
                        constructor = clazz.getDeclaredConstructor(Scanner.class,
                                Integer.TYPE);
                    } else if (c == 1) {
                        constructor = clazz.getDeclaredConstructor(Scanner.class);
                    } else {
                        constructor = clazz.getDeclaredConstructor();
                    }
                } catch (Exception e) {
                    continue;
                }
                try {
                    for (int i = 0; i < result.length; i++) {
                        if (c == 0) {
                            result[i] = constructor.newInstance(this, i);
                        } else if (c == 1) {
                            result[i] = constructor.newInstance(this);
                        } else {
                            result[i] = constructor.newInstance();
                        }
                    }
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                return result;
            }
            throw new RuntimeException("Constructor not found");
        }

        public Collection<Integer> wrap(int[] as) {
            ArrayList<Integer> ans = new ArrayList<Integer>();
            for (int i : as) {
                ans.add(i);
            }
            return ans;
        }

        public int[] unwrap(Collection<Integer> collection) {
            int[] vals = new int[collection.size()];
            int index = 0;
            for (int i : collection) {
                vals[index++] = i;
            }
            return vals;
        }

        int testCases = Integer.MIN_VALUE;

        boolean testCases() {
            if (testCases == Integer.MIN_VALUE) {
                testCases = nextInt();
            }
            return --testCases >= 0;
        }
    }

    static class SuperWriter {

        private final PrintWriter writer;

        public SuperWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public SuperWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.flush();
            writer.close();
        }

        public void printLine(String line) {
            writer.println(line);
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public void printLine(int... vals) {
            if (vals.length == 0) {
                writer.println();
            } else {
                writer.print(vals[0]);
                for (int i = 1; i < vals.length; i++) {
                    writer.print(" ".concat(String.valueOf(vals[i])));
                }
                writer.println();
            }
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public void printLine(long... vals) {
            if (vals.length == 0) {
                writer.println();
            } else {
                writer.print(vals[0]);
                for (int i = 1; i < vals.length; i++) {
                    writer.print(" ".concat(String.valueOf(vals[i])));
                }
                writer.println();
            }
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public void printLine(double... vals) {
            if (vals.length == 0) {
                writer.println();
            } else {
                writer.print(vals[0]);
                for (int i = 1; i < vals.length; i++) {
                    writer.print(" ".concat(String.valueOf(vals[i])));
                }
                writer.println();
            }
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public void printLine(int prec, double... vals) {
            if (vals.length == 0) {
                writer.println();
            } else {
                String precision = "%." + prec + "f";
                writer.print(String.format(precision, vals[0]).replace(',', '.'));
                precision = " " + precision;
                for (int i = 1; i < vals.length; i++) {
                    writer.print(String.format(precision, vals[i]).replace(',', '.'));
                }
                writer.println();
            }
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public <E> void printLine(Collection<E> vals) {
            if (vals.size() == 0) {
                writer.println();
            } else {
                int i = 0;
                for (E val : vals) {
                    if (i++ == 0) {
                        writer.print(val.toString());
                    } else {
                        writer.print(" ".concat(val.toString()));
                    }
                }
                writer.println();
            }
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public void print(String value) {
            writer.print(value);
            if (!SHOULD_BUFFER_OUTPUT) {
                writer.flush();
            }
        }

        public boolean ifZeroExit(Number... values) {
            for (Number number : values) {
                if (number.doubleValue() != 0.0d || number.longValue() != 0) {
                    return false;
                }
            }
            close();
            System.exit(0);
            return true;
        }
    }

    public static void main(String[] args) {
        main();
        sw.close();
    }

}