Statistics for Multi-stage neural networks with application to motion planning of a mechanical snake