writing ring finding by processing trees inter-level connections.