def max_lens(X):
    """
    max_lens
    Return: a tuple of which each element is the max length of the elements in
            the corresponding dimension of the input X.
    Example: max_lens([[1,2,3], [4,5]]) --> [2,3]
    """
    if not isinstance(X[0], list):
        return tuple([len(X)])
    elif not isinstance(X[0][0], list):
        return tuple([len(X), max(len(x) for x in X)])
    elif not isinstance(X[0][0][0], list):
        return tuple([len(X), max(len(x) for x in X),
                      max(len(x) for xs in X for x in xs)])
    else:
        raise ValueError(
            "Data list whose dim is greater than 3 is not supported!")