this problem find the quickest way out of a rectangle