function out = insert(A, x)
if isempty(A)
    out.key = x;
    out.left = {};
    out.right = {};
elseif A.key < x
    A.right = insert(A.right, x);
    out = A;
elseif A.key > x
    A.left = insert(A.left, x);
    out = A;
else 
    out = A;
end;