Write code to find cycle in directed graph.