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