head,tail= 0,5
while head < tail:
if head % 3 == 0:
print(q[head])
else:
q[tail] = q[head]
tail += 1
head += 1