        #include<iostream.h>
        int main()
        {
        int t;
          cin>>t;
          int arr[]={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 n;
          while(t--)
          {
          cin>>n;
          cout<<arr[n-1]<<" ";  
          }
          return 0;
        }