Prepare for implementing O(N^3 + f(n)) approach.
Naive implementation of the O(N^3) idea.