The answer is reflex action. Impulse that triggers a reflex action does not pass through the brain so as to shorten the time for response. It passes through a reflex arch and this is why the muscles are contracted even without time to think of what happened. The sensory and motor neurons only arch at the spinal cord.