On a Generalization of the de Bruijn-Erdos Theorem