A bullet with mass m hits a ballistic pendulum, having length L and mass M, and gets embedded in it. After the bullet hits the pendulum, it swings up, with the bullet embedded into it, and reaches to a maximum height h with respect to its initial position. Determine the initial velocity of the bullet.