code generating output for hung q