The document presents a novel path tracing scheme for all-optical networks utilizing a prime number encoding scheme within a Benes network framework, aimed at improving data packet routing efficiency. By assigning prime number tags to network nodes and performing multiplication with packet labels, the proposed method enhances path identification and minimizes signal degradation. Experimental setups demonstrate the effectiveness of this approach over traditional optical cross connects, offering reduced system complexity and improved quality of service.