class Solution(object):
    def get_third_max(self, numbers):
        if not numbers:
            return None
        
        max1, max2, max3 = None, None, None

        for num in numbers:
            if num in (max1, max2, max3):
                continue
            elif not max1 or max1 < num:
                max3 = max2
                max2 = max1 
                max1 = num
            elif not max2 or max2 < num:
                max3 = max2
                max2 = num
            elif not max3 or max3 < num:
                max3 = num
        
        return max3 if max3 else max1
    
solution = Solution()
numbers = [3, 5, 8, 5, 5, 2, 5]
print(solution.get_third_max(numbers))

