Amplification of terahertz radiation in carbon nanotubes