def tree(n, start=1):
    """
    builds a tree to depth n starting at the desired value
    
    Examples
    --------
    
    >>>tree(4)
    [[1, 2], [2, 4], [4, 8], [8, 16]]
    
    >>>tree(5)
    [[1, 2], [2, 4], [16, 5], [4, 8], [8, 16], [16, 32]]
    
    >>>tree(6)
    [[1, 2], [2, 4], [16, 5], [4, 8], [5, 10], [8, 16], [16, 32], [32, 64]]

    """
    l = []
    new_last = [start]
    for i in range(n):
        last, new_last = [new_last, []]
        for old_val in last:
            l.append([old_val, old_val * 2])
            new_last.append(old_val * 2)
            new_val = (old_val - 1) / 3
            if new_val > 1 and new_val % 1 == 0:
                l.append([old_val, int(new_val)])
                new_last.append(int(new_val))
    return sorted(l, key=lambda x: x[1])
