#include <vector>
#include <iostream>
using namespace std;
vector<int> cache;
int numTrees(int n) {
if (n == 0 || n== 1) return 1;
if (cache.size() <= n) cache.resize(n+1);
if (cache[n] > 0) return cache[n];
int num = 0;
for (int i = 0; i < n; ++i) {
num += numTrees(i)*numTrees(n-i-1);
}
cache[n] = num;
return cache[n];
}
int main (int argc, const char * argv[]) {
for (int i = 1; i <= 15; ++i) {
cout << i << '\t'<< numTrees(i) << endl;
}
return 0;
}