1) fill 5 gallon container ---------------> 3 gallon container have 0 lgallon and 5 gallon container have 5 gallon water

2) pour water from 5 gallon container to 3 gallon container --------> 3 gallon container have 3 lgallon and 5 gallon container have 2 gallon water

3) empty 3 gallon conainer -----> 3 gallon container have 0 lgallon and 5 gallon container have 2 gallon water

4) pour water from 5 gallon container to 3 gallon container -----> 3 gallon container have 2 gallon and 5 gallon container have 0 gallon water

5) fill 5 gallon container -----> 3 gallon container have 2 gallon and 5 gallon container have 5 gallon water

6) pour water from 5 gallon container to 3 gallon container -----> 3 gallon container have 3 gallon and 5 gallon container have 4 gallon water

7) empty 3 gallon container -----> 3 gallon container have 0 gallon and 5 gallon container have 4 gallon water

8) pour water from 5 gallon container to 3 gallon container -----> 3 gallon container have 3 gallon and 5 gallon container have 1 gallon water