compBalTree x n
  | odd n = [Branch x l r | l <- compBalTree x $ (n - 1) `quot` 2, r <- compBalTree x $ (n - 1) `quot` 2]
  | even n = concat [[Branch x p q, Branch x q p] | p <- compBalTree x $ (n - 1) `quot` 2, q <- compBalTree x $ n `quot` 2]
  | otherwise = []
compBalTree x n
  | odd n = [Branch x l r | l <- compBalTree x $ (n - 1) `quot` 2, r <- compBalTree x $ (n - 1) `quot` 2]
  | even n = concat [[Branch x p q, Branch x q p] | p <- compBalTree x $ (n - 1) `quot` 2, q <- compBalTree x $ n `quot` 2]
  | otherwise = []
compBalTree x n
  | odd n = [Branch x l r | l <- compBalTree x $ (n - 1) `quot` 2, r <- compBalTree x $ (n - 1) `quot` 2]
  | even n = concat [[Branch x p q, Branch x q p] | p <- compBalTree x $ (n - 1) `quot` 2, q <- compBalTree x $ n `quot` 2]
  | otherwise = []