For this Question: Andrew is now bored with usual prime numbers and decides to find prime numbers which has exactly three factors. He sits back and keeps on thinking random numbers, and asks you to tell him if the number he has chosen had exactly 3 factors. Now he has given <b>N</b> random numbers,  you need to tell him "<b>Yes</b>" if those numbers had exactly 3 factors otherwise "<b>No</b>".

<b>Note:</b> You can consider the number to be factor of its own.First-line contains N, the number of random numbers he thinks of. Second-line contains the N numbers separated by space.

<b>Constraints:</b>
1 <= N <= 10^5
1 <= numbers <= 10^12Print N lines containing "Yes" or "No".Sample Input 1
3
2 4 6

Sample Output 1
No
Yes
No

Explanation:
2 has 2 factors: 1, 2
4 has 3 factors: 1,2,4
6 has 4 factors: 1,2,3,6

Sample Input 2
3
3 5 7

Sample Output 2
No
No
No, I have written this Solution Code: import java.util.*;
import java.io.*;
import java.lang.*;

class Main
{
    static int MAX = 1000005;
    static long spf[] = new long[MAX+5]; 
    public static void main (String[] args)throws IOException {
        
        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        
        int N = Integer.parseInt(read.readLine());
        
        
        SOF();
        
        String str[] = read.readLine().trim().split(" ");
        for(int i = 0; i < N; i++)
        {
            
            long x = Long.parseLong(str[i]);
            long g = (long)Math.sqrt(x);
            
            if((g*g)!=x) 
		  {
		    System.out.println("No");
		  }
		  else
		  {
		    if(spf[(int)g]==g)
		    {
		      System.out.println("Yes");
		    }
		    else
		      System.out.println("No");
		  }
        }
    }
    public static void SOF()
    {
        spf[1] = 0;
        for (int i=2; i<MAX; i++)

            // marking smallest prime factor for every
            // number to be itself.
            spf[i] = i;

        // separately marking spf for every even
        // number as 2
        for (int i=4; i<MAX; i+=2)
            spf[i] = 2;

        for (int i=3; i*i<MAX; i++)
        {
            // checking if i is prime
            if (spf[i] == i)
            {
                // marking SPF for all numbers divisitedible by i
                for (int j=i*i; j<MAX; j+=i)

                    // marking spf[j] if it is not
                    // previously marked
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
    
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?