Because after the second pass through the loop i is 2, while q.size() is 1 since the first two elements have been removed. Modifying a collection that you're iterating through is a dangerous thing to do. If you use an Iterator instead you'll see all elements:
or you can always print the first element in a loop:
So I left, I came home, and I ate some pie. And then I read this tiny ad:
a bit of art, as a gift, that will fit in a stocking