PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000003. Kiểm tra nguyên tố cho nhiều truy vấn (Prime Check)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Kiểm tra nguyên tố cho nhiều truy vấn (Prime Check)

Prime Check

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

You are given QQ integers X1,X2,…,XQX_1,X_2,\ldots,X_Q. For each integer, determine whether it is prime. A prime number is an integer greater than 11 having exactly two positive divisors. Report the result in the input order.

Input

The first line contains the integer QQ, the number of questions. Each of the next QQ lines contains an integer XiX_i for question ii.

Output

Print exactly QQ lines. On line ii, print Yes if XiX_i is prime, and No otherwise. Capitalization matters.

Subtasks

  • Subtask 1 (20 points): 1≤Q≤501\le Q\le 50, 2≤Xi≤30002\le X_i\le 3000 for every 1≤i≤Q1\le i\le Q.
  • Subtask 2 (30 points): 1≤Q≤10001\le Q\le 1000, 2≤Xi≤1000002\le X_i\le 100000 for every 1≤i≤Q1\le i\le Q.
  • Subtask 3 (50 points): 1≤Q≤100001\le Q\le 10000, 2≤Xi≤3000002\le X_i\le 300000 for every 1≤i≤Q1\le i\le Q.

Examples

Input

4
17
31
35
49

Output

Yes
Yes
No
No

Explanation

Query 1: 17 has no proper positive divisor, print Yes. Query 2: 31 has no proper positive divisor, print Yes. Query 3: 35 is divisible by 5, print No. Query 4: 49 is divisible by 7, print No.