Musical Chair Problem Implementation