| f | class ExceptionTree: | f | class ExceptionTree: | 
            |  |  |  |  | 
            |  | def __init__(self): |  | def __init__(self): | 
            | n | self.cache = {1: type('Exception-1', (Exception,), {'n': 1})} | n | self.exceptions = {1: type('Exception-1', (Exception,), {'n': 1} | 
            |  |  |  | )} | 
            |  |  |  |  | 
            |  | def __call__(self, index): |  | def __call__(self, index): | 
            | n | if index in self.cache: | n | if index in self.exceptions: | 
            |  | return self.cache[index] |  | return self.exceptions[index] | 
            |  | parent_index = index // 2 |  | parent_index = index // 2 | 
            |  | parent_exception = self(parent_index) |  | parent_exception = self(parent_index) | 
            | t | new_exception = type(f'Exception-{index}', (parent_exception,), | t | exception_class = type(f'Exception-{index}', (parent_exception,) | 
            |  | {'n': index}) |  | , {'n': index}) | 
            |  | self.cache[index] = new_exception |  | self.exceptions[index] = exception_class | 
            |  | return new_exception |  | return exception_class |