Two balls X and Y weighing 5 g and 50 kg respectively were thrown up vertically…