
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main()
{ ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
 ll t;
cin>>t;
while(t--)
{ ll n;
    cin>>n;
if(n<=3)
cout<<n-1<<endl;
else
{
    if(n%2==0)
    cout<<2<<endl;
    else
    {
        cout<<3<<endl;
    }
    
}


}

 
 
 
 


     
 }
    


  
 
  

  
      


