Ridbit starts with an integer n.

In one move, he can perform one of the following operations: 

  * divide n by one of its proper divisors, or 
  * subtract 1 from n if n is greater than 1. 



A proper divisor is a divisor of a number, excluding itself. For example, 1, 2, 4, 5, and 10 are proper divisors of 20, but 20 itself is not.

What is the minimum number of moves Ridbit is required to make to reduce n to 1?

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The only line of each test case contains a single integer n (1 ≤ n ≤ 10^9).

Output

For each test case, output the minimum number of moves required to reduce n to 1.

Example

Input


6
1
2
3
4
6
9


Output


0
1
2
2
2
3

Note

For the test cases in the example, n may be reduced to 1 using the following operations in sequence

1

2 \xrightarrow{} 1

3 \xrightarrow{} 2 \xrightarrow{} 1

4 \xrightarrow{} 2 \xrightarrow{} 1

6 \xrightarrow{} 2 \xrightarrow{} 1

9 \xrightarrow{} 3 \xrightarrow{} 2\xrightarrow{} 1
/* -
Legends - A: An Array.
          S: A String Array
          n: Size of the Array A.
          x: an integer variable.
The List of Functions in the Library
1. Take input in an Integer Array - ob.ar_iin(n);
1.5 Take input in an Long Array - ob.ar_lin(n);
2. Take input in an String Array - ob.ar_sin(n);
3. Take input in an Character Array - ob.ar_cin(n);
4. Take input in an Double Array - ob.ar_din(n);
5. Print the content of an int Array - ob.print_iarr(A);
6. Print the content of an String Array - ob.print_sarr(A);
7. Print the content of a Character Array - ob.print_carr(A);
8. Print the content of a Double Array - ob.print_darr(A);
9. Get the sum of an Integer Array - ob.ar_sum(A);
10. Get the Maximum in an Array  - ob.ar_max(A);
12. Get the Minimum in an Array - ob.ar_min(A);
13. Get the Number of Digits in an Integer - ob.idigits(x);
14. Get an Integer Input - ob.iin();
15. Get a String Input - ob.sin();
16. Get a Long Input - ob.lin();
17. Get the Frequency of all Characters - ob.freq(A[]);
*/

import java.io.*;
import java.util.*;
public class makeone
{
// Write Your Program in the main method below! 
public static void main(String args[])throws Exception
  {

    makeone ob = new makeone();        
    int test = ob.iin();
    String ans="";
    while(test-->0)
    {
      int n = ob.iin();
      int sol = ob.fac(n);
      ans=ans+sol+"\n";
    }
    System.out.print(ans);
  }
  
  public int fac(int n)
  {
      if(n<=3)
       return n-1;
      else
      {
       if(n%2==0)
       {
         return 2;
       }
       else
        return 3;
      }
  }
  // *********** Below are the library functions, just refer the Legends at the start of the Program to use them.

  public int iin()throws Exception
  {
    DataInputStream in = new DataInputStream(System.in);
    int n = Integer.parseInt(in.readLine());
    return n;
  }

  public long lin()throws Exception
  {
    DataInputStream in = new DataInputStream(System.in);
    long n = Long.parseLong(in.readLine());
    return n;
  }
  
  public String sin()throws Exception
  {
    DataInputStream in = new DataInputStream(System.in);
    String s = in.readLine();
    return s;
  }
          
  public int[] ar_iin(int n)throws Exception
  { //Take Integer Array as Input
    DataInputStream in = new DataInputStream(System.in);
    //int n = Integer.parseInt(in.readLine());
    String line = in.readLine();
    int A[] = new int[n];
    String strs[] = line.trim().split(" ");
    for(int i=0;i<n;i++)
     A[i] = Integer.parseInt(strs[i]);
    return A;
  }

  public long[] ar_lin(int n)throws Exception
  { //Take Long Array as Input
    DataInputStream in = new DataInputStream(System.in);
    String line = in.readLine();
    long A[] = new long[n];
    String strs[] = line.trim().split(" ");
    for(int i=0;i<n;i++)
     A[i] = Long.parseLong(strs[i]);
    return A;
  }

  public String[] ar_sin(int n)throws Exception
  { //Take Integer Array as Input
    DataInputStream in = new DataInputStream(System.in);
    //int n = Integer.parseInt(in.readLine());
    String line = in.readLine();
    String strs[] = line.trim().split(" ");
    return strs;
  }

  public char[] ar_cin(int n)throws Exception
  { //Take Integer Array as Input
    DataInputStream in = new DataInputStream(System.in);
    //int n = Integer.parseInt(in.readLine());
    String line = in.readLine();
    char A[] = new char[n];
    String strs[] = line.trim().split(" ");
    for(int i=0;i<n;i++)
     A[i] = (strs[i]).charAt(0);
    return A;
  }

  public double[] ar_din(int n)throws Exception
  { //Take Integer Array as Input
    DataInputStream in = new DataInputStream(System.in);
    //int n = Integer.parseInt(in.readLine());
    String line = in.readLine();
    double A[] = new double[n];
    String strs[] = line.trim().split(" ");
    for(int i=0;i<n;i++)
     A[i] = Double.parseDouble(strs[i]);
    return A;
  }

  public void print_iarr(int A[]){
  	for(int i=0;i<A.length;i++)
  	 System.out.print(A[i]+" ");
  	System.out.println();
  }

  public void print_sarr(String A[]){
  	for(int i=0;i<A.length;i++)
  	 System.out.print(A[i]+" ");
  	System.out.println();
  }

  public void print_carr(char A[]){
  	for(int i=0;i<A.length;i++)
  	 System.out.print(A[i]+" ");
  	System.out.println();
  }

  public void print_darr(double A[]){
  	for(int i=0;i<A.length;i++)
  	 System.out.print(A[i]+" ");
  	System.out.println();
  }
  public int ar_sum(int A[])
  { //Find sum of element in an Array
    int sum=0;
    for(int i=0;i<A.length;i++)
     sum=sum+A[i];
    return sum;
  }

  public int ar_max(int A[])
  {
    int max=A[0];
    for(int i=0;i<A.length;i++)
     max=max>A[i]?max:A[i];
    return max;
  }

  public int ar_min(int A[])
  {
    int min=A[0];
    for(int i=0;i<A.length;i++)
     min=min<A[i]?min:A[i];
    return min;
  }

  public int idigits(int n)
  {
    return (int)Math.floor(Math.log10(n) + 1);
  }

  public int[] freq(String n)
  {
    n=n.toLowerCase();
    int A[] = new int[26];
    int len = n.length();
    for(int i=0;i<len;i++){
      char a = n.charAt(i);
      int temp = (int)a;
      int val = temp-97;
      A[val]++;
    }
    return A;
  }

}
