When I run it with this input
60
toFront 93
front
back
reverse
back
reverse
toFront 80
push_back 53
push_back 50
front
front
reverse
push_back 66
reverse
front
toFront 93
front
back
reverse
back
reverse
toFront 80
push_back 53
push_back 50
front
front
reverse
push_back 66
reverse
front
toFront 93
front
back
reverse
back
reverse
toFront 80
push_back 53
push_back 50
front
front
reverse
push_back 66
reverse
front
toFront 93
front
back
reverse
back
reverse
toFront 80
push_back 53
push_back 50
front
front
reverse
push_back 66
reverse
front
It gives this:
2o job for Ada?
No job for Ada?
80
53
66
93
50
No job for Ada?
80
53
66
93
50
No job for Ada?
80
53
66
93
50
No job for Ada?
80
53
66
if I change the number of queries to 55, the output then starts with this:
P52r Ada?
No job for Ada?
80
…
So something funny going on, and I suspect array bound violation, buffer overflow, uninitialised pointer or something of that ilk. See https://ideone.com/mQ5xk8