You are given N services and a list of dependency pairs (A, B) meaning service B must be deployed before service A. Compute any valid deployment order of all services. If no valid order exists due to cycles, detect the cycle and return an appropriate indication. Describe and implement your approach (e.g., Kahn’s BFS-based algorithm or a DFS-based topological sort), analyze time and space complexity, and explain how you would handle partial deployments, retries, and failure recovery in production.