#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    int T;
    cin >> T;
    while (T--) {
        int n;
        scanf("%d", &n);
        if (n == 1 || n == 2 || n == 3) printf("%d\n", n - 1);
        else if (n % 2 == 0) printf("2\n");
        else printf("3\n");
    }
}
