#include<bits/stdc++.h>
using namespace std;
typedef     long long    ll;
typedef     vector<int> vi;
typedef     vector<long long> vl;
typedef     pair<int, int>pi;
typedef     pair<long long, long long>pl;
#define F   first
#define S   second
#define pb  push_back
#define     all(x)      x.begin() , x.end()
#define mp  make_pair
#define     REP(i,a,b) for(i=a;i<=b;i++)
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
int main()
{
  int t;
  cin >> t;
  while (t--)
  {
    ll n, i, x = 0, c = 0;
    cin >> n;
      if(n==1) c=0;
      else if(n==2) c=1;
      else if(n==3) c=2;
      else
      {
        if(n%2==0) c=2;
        else c=3;
      }

        
    cout << c << endl;

  }
}