def threeSum(nums):
    for i in range(len(nums) - 1):
        left = i + 1
        right = len(nums) - 1
        if i > 0 and nums[i] == nums[i - 1]:
            continue
        while left < right:
            he = nums[i] + nums[left] + nums[right]
            if he < 0:
                left += 1
            elif he > 0:
                right -= 1
            else:
                print(nums[i],nums[left],nums[right])
                while left < right and nums[left] == nums[left + 1]:
                    left += 1
                while left < right and nums[right] == nums[right - 1]:
                    right -= 1
                left += 1
                right -= 1
threeSum([-1,-1,-1,1,1,1,0,2,4])
