He fills the *L jug with 8L and puts the remaining 4L in the 5L jug.

(12L = empty; 8L jug = 8L; 5L jug = 4L)

He empties the 8L jug in the 12L jug and pours the content of the 5L jug into the 8L jug.

(12L jug = 8L; 8L jug = 4L; 5L jug = empty).

He fills the 5L jug from the 12L jug and fills up the 8L jug with the 5L jug.

(12L jug = 3L; 8L jug = 8L; 5L jug = 1L)

He empties the 8L jug in the 12L jug and empties the 5L jug int the 8L jug.

(12L jug = 11L; 8L jug =1 L; 5L jug = empty)

He fills the 5L jug from the 12L jug and empties it in the 8L jug, which now contains 6L

(12L jug = 6L; 8L jug = 6L; 5L jug = empty)