#include <bits/stdc++.h>
using namespace std;
void logf(istream_iterator<string> it) {}
template <typename T, typename... Args>
void logf(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  logf(++it, args...);
}
const double PI = acos(-1);
void solve() {
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  ;
  k--;
  cout << a[k] << endl;
}
int main() {
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  ;
  while (t--) solve();
}
