#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n)  for(ll i = 0; i < (n); ++i)
#define rep1(i,n)  for(ll i = 1;i <= (n); ++i)
#define pb push_back
#define M 1000000007
unordered_map<ll,ll>mp;

int main()
{

    fastIO
    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==0)
    cout<<"2\n";
    else
    cout<<"3\n";
    }
	return 0;
}
