#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <set>

typedef long long int llu;
typedef long long int lli;

using namespace std;

int div(int n) {
    
    int limit = sqrtl(n);
    
    for(int i = 2; i <= limit; ++i)
        if(n % i == 0)
            return n / i;
    
    return 0;
}


int main() {
    
    ios_base::sync_with_stdio(0);
    // cin.tie(0);
    
    int t;
    cin >> t;
    
    while(t--) {
        
        unsigned 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;
}
