def detect_cycle(node):
    if node is None:
        return False
    hare = tortoise = node

    while True:
        if hare is None or hare.successor is None:
            return False
        tortoise = tortoise.successor
        hare = hare.successor.successor

        if hare is tortoise:
            return True