#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define ull         unsigned long long
#define ld          long double
#define mp          make_pair
#define pb          push_back
#define ff          first
#define ss          second
ll big = 1000000007;


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        ll ret = 0;
        if(n==1) ret = 0;
        else if(n==2) ret = 1;
        else if(n==3) ret = 2;
        else if(n==4) ret = 2;
        else if(n%2==0) ret = 2;
        else ret = 3;

        cout<<ret<<'\n';
        
    }
    return 0;
}




