Solving restaurant puzzle