def equal_stacks(h1, h2, h3):
    """Compare three stacks of cylinders and return the maximum possible height of the stacks such that all of the
    stacks are exactly the same height

    Solve:
        For this, we can use a dictionary, and store the "heights" of the stacks as the key with the value being a list
        that the stack will append to as we iterate through each possible sum for each stack.  By doing this, we can then
        simply look for the height key that has a list of length 3, as that will be the highest maximum sum

    Args:
        h1 (list): list of integers in stack 1
        h2 (list): list of integers in stack 2
        h3 (list): list of integers in stack 3

    Returns:
        (int): The maximum possible height of the stacks where all have the same height
    """
    sums = {}
    s = 0
    for i in reversed(h1):
        s += i
        sums[s] = [1]
    s = 0
    for i in reversed(h2):
        s += i
        if s in sums:
            sums[s].append(1)
    s = 0
    for i in reversed(h3):
        s += i
        if s in sums:
            sums[s].append(1)
    largest = 0
    for i in sums:
        if len(sums[i]) == 3 and i > largest:
            largest = i
    return largest