#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool is_prime(ll N)
{
    for(ll i=2;i*i<=N;i++)
    {
        if(N%i==0)
        return(0);
    }
    return(1);
}

void solve()
{
ll N;
cin>>N;
  if(N==1){
  cout<<0<<endl;
  return;
  }
  if(N==2){
  cout<<1<<endl;
  return;
  }
  if(N==3){
  cout<<2<<endl;
  return;
  }
  else if(N%2)
  cout<<3<<endl;
  else
  cout<<2<<endl;
}


int main()
{
    ll t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}