#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
 
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define m_p make_pair
#define all(a) (a).begin(),(a).end()

void boost()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main()
{
    boost();
    
    int T;
    cin>>T;
    
    while(T--)
    {
        int n,i,j;
        cin>>n;
        
        if(n == 1)
            cout<<"0\n";
        else if(n == 2)
            cout<<"1\n";
        else if(n == 3)
            cout<<"2\n";
        else if(n%2 == 0)
            cout<<"2\n";
        else
            cout<<"3\n";
    }
}