solved puzzles 1-4
stealing from @jedireza