check whether a chain is a non-trivial cycle