1. Fill the 5-liter jug to the top.
2. Pour water from the 5-liter jug into the 3-liter jug until it is full. This leaves you with 2 liters in the 5-liter jug.
3. Empty the 3-liter jug and pour the 2 liters from the 5-liter jug into the 3-liter jug.
4. Fill the 5-liter jug again and pour it into the 3-liter jug until it is full. Now you have exactly 4 liters left in the 5-liter jug.