cartesian.py: Initial attempt at closest cartesian problem