A lemma on finite p-groups and some consequences