reference implementation of the slowest solution