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

ll solve()
{
	ll n;
	cin>>n;
	if(n==1)
		return 0;

	if(n==2)
		return 1;
	if(n==3)
		return 2;
	if(n%2==0)
		return 2;
	return 3;

 
}
int main()
{
   
	ll t;
	 cin>>t;


	 
	while(t--)
	{
		cout<<solve()<<'\n';
	}
 
    return 0;
 
}
