Build cyclic/acyclic list, add function to check if it is cyclic or not