1. We fill in a 3-gallon container,
2. We pour the capacity of the 3-gallon container into a 5-gallon container,
3. We fill in the 3-gallon container back,
4. We pour the water out of the 3-gallon container into the 5-gallon container until the 5-gallon container is filled up and there is exactly one gallon of water remaining in the 3-gallon container,
5. We pour the water out of the 5-gallon container, and we get exactly one gallon of water in the 3-gallon container
something like this, I hope;)