		#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

using ll = long long;
using ld = long double;

const ll inf = LONG_LONG_MAX;

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1){
            res = (res * a)%mod;
        }
        a = (a * a)%mod;
        b >>= 1;
    }
    return (res%mod);
}

bool prime(ll n){
	for(ll i=2;i<=sqrt(n);i++){
		if(n%i == 0){
			return false;
		}
	}

	return true;
}

signed main(){
	ll t;
	cin >> t;

	while(t--){
		ll n;
		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 == 1){
				cout << 3 << "\n";
			}
			else{
				cout << 2 << "\n";
			}
		}
	}
	return 0;
}