/*
    Saturday | 21 November 2020
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define TryUntillAC ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
ll power_mod(ll x, ll y, ll p)
{
    ll res = 1; x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1; 
        x = (x * x) % p;
                }
    return res;
}


int main()
{
    TryUntillAC
    ll t; cin>>t;
    while(t--){
        ll n; cin>>n;
        if(n == 1) cout<<"0"<<endl;
        else if(n == 2) cout<<"1"<<endl;
        else if(n == 3) cout<<"2"<<endl;
        else if(n%2 == 0) cout<<"2"<<endl;
        else cout<<"3"<<endl;
    }
}