CodeEff/ECCO huggingface dataset:
# Original solution
while True:
    N = int(eval(input()))
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N):
        for group, members in list(d.items()):
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print((len(first_group_menbers)))

# Optimized solution
while True:
    N = int(eval(input()))
    if N == 0:
        break
    
    first_group_menbers = set(input()[:-1].split(":")[1].split(","))
    d = {}
    for i in range(N-1):
        group, members = input()[:-1].split(":")
        d[group] = set(members.split(","))
        
    for i in range(N-1):
        for group, members in list(d.items()):
            if group in first_group_menbers:
                first_group_menbers.remove(group)
                for m in members:
                    first_group_menbers.add(m)
    
    print((len(first_group_menbers)))
# Original solution
while 1:
    n=int(eval(input()))
    if n==0:break
    print(((sum(sorted([int(eval(input())) for _ in range(n)])[1:-1]))//(n-2)))

# Optimized solution
while 1:
    n=int(eval(input()))
    if n<3:break
    print(((sum(sorted([int(eval(input())) for _ in [0]*n])[1:-1]))//(n-2)))
# Original solution
while True:
    n = int(eval(input()))
    if not(n): break
    s = sum(sorted([int(eval(input())) for i in range(n)])[1:-1])
    print((s//(n-2)))

# Optimized solution
while True:
    n = int(eval(input()))
    if n==0: break
    a = sum(sorted([int(eval(input())) for _ in range(n)])[1:-1])//(n-2)
    print(a)