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

typedef long long ll;
typedef pair<ll,ll>ii;
#define X first
#define Y second
#define pb push_back
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define uni(a) (a).resize(unique(all(a)) - (a).begin())
const ll mod = 1e9+7;
const ll maxN = 1e6+5;
const ll N = 1e6;

void solve() {
	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 == 0) cout << 2 << "\n";
		else cout << 3 << "\n";
	}
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	ll T = 1;
	cin >> T;
	while (T--) solve();
	return 0;
}



