def _can_fast_union(self: _T, other: _T) -> bool:
    freq = self.freq
    if ((freq is None) or (freq != other.freq)):
        return False
    if (not self.is_monotonic_increasing):
        return False
    if ((len(self) == 0) or (len(other) == 0)):
        return True
    if (self[0] <= other[0]):
        (left, right) = (self, other)
    else:
        (left, right) = (other, self)
    right_start = right[0]
    left_end = left[(- 1)]
    return ((right_start == (left_end + freq)) or (right_start in left))
def _can_fast_union(self: _T, other: _T) -> bool:
    freq = self.freq
    if ((freq is None) or (freq != other.freq)):
        return False
    if (not self.is_monotonic_increasing):
        return False
    if ((len(self) == 0) or (len(other) == 0)):
        return True
    if (self[0] <= other[0]):
        (left, right) = (self, other)
    else:
        (left, right) = (other, self)
    right_start = right[0]
    left_end = left[(- 1)]
    return ((right_start == (left_end + freq)) or (right_start in left))