insert val t@(T tval left right)
    | val > tval = T tval left (insert val right)
    | otherwise = t
insert val t@(T tval left right)
    | val > tval = T tval left (insert val right)
    | otherwise = t
insert val t@(T tval left right)
    | val > tval = T tval left (insert val right)
    | otherwise = t