This is really just two topological sorts: .
The magic is in the fact that this works at all!
Terminology: forward reachable, backward reachable. If u and v are in the same strongly connected component, then v is both forward reachable and backward reachable from u (and vice versa).
Argue that G and GT have the same strongly connected components.
What can we say about when to nodes in the same strongly connected component turn black (with respect to top-level calls to Visit)?