#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t,i,j,a,b,c,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int chk=0,v,s;
        if(n==1)
        {
            cout<<0<<endl;
            continue;
        }
        if(n==2)
        {
            cout<<1<<endl;
            continue;
        }
        if(n%2==0)
        {
            cout<<2<<endl;
            continue;
        }
        if(n==3) {cout<<2<<endl; continue;}
        else cout<<3<<endl;

    }






    return 0;
}
