Ex 4 with a simple queue