generate all possible triplets
ptr1 = head NEW_LINE while ptr1 is not None : NEW_LINE INDENT ptr2 = ptr1 . next_ NEW_LINE while ptr2 is not None : NEW_LINE INDENT ptr3 = ptr2 . next_ NEW_LINE while ptr3 is not None : NEW_LINE DEDENT DEDENT