Problem:
Score : 100 points

Problem Statement

Print the K-th element of the following sequence of length 32:

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

Constraints

1 \leq K \leq 32

All values in input are integers.

Input

Input is given from Standard Input in the following format:

K

Output

Print the K-th element.

Sample Input 1

6

Sample Output 1

2

The 6-th element is 2.

Sample Input 2

27

Sample Output 2

5

The 27-th element is 5.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
 
using namespace std;
 
template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}
 
template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}
 
#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

char t[1003];

set<string> words;

void rec(int nr, int id, char let) {
	if(!nr) {
		string s = "";
		for(int i = 1; i <= id; ++i) {
			s.push_back(t[i]);
			// cout << t[i];
		}
		words.insert(s);

		return;
	}

	for(char c = 'a'; c <= let + 1; ++c) {
		t[id] = c;

		// if(nr == 1) {
		// 	// string s = "";
		// 	// for(int i = 1; i <= id; ++i) {
		// 	// 	s.push_back(t[i]);
		// 	// 	// cout << t[i];
		// 	// }
		// 	// words.insert(s);

		// 	// // cout << endl;
		// }

		// if(nr > 1) {
			rec(nr - 1, id + 1, let);
		// }
	}

}

int main() {
	int n;
	cin >> n;

	if(n == 1){
		cout << "a" << endl;
		return 0;
	}

	char let = 'a';
	// t[1] = 'a';
	for(int i = 1; i <= n; ++i) {
		t[i] = let;
		// debug()

		rec(n - i, i + 1, let);

		let++;
	}

	for(auto s : words) {
		cout << s << endl;
	}
  
}