• ss = [
            ("a1", "b1", "c"),
            ("a1", "b1", "d"),
            ("a1", "b6", "v"),
            ("a2", "b2", "e"),
            ("a2", "b3", "f")
        ]
    
    result = {}
    for (a, b, c) in ss:
        if a not in result:
            result[a] = {b: [c]}
        elif b not in result[a]:
            result[a][b] = [c]
        elif c not in result[a][b]:
            result[a][b].append(c)
    
    print(result)