Pošljite SMS: Induced subgraph density. II. Sparse and dense sets in cographs