Shortest first logic (inefficient)