// 1451-A.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <assert.h>

int get_moves(int n)
{
  if (n == 1)
    return 0;
  else if (n == 2)
    return 1;
  else if (n == 3)
    return 2;
  else if ((n & 1) == 0) /* nombre pair */
    return 2;
  else
    return 3;
}

int main()
{
  int ncases;
  std::cin >> ncases;
  for (int i = 0; i < ncases; ++i)
  {
    int n;
    std::cin >> n;
    std::cout << get_moves(n) << std::endl;
  }
  return 0;
}
