Electronic and magnetic properties of an AlN monolayer doped with first-row elements: a first-principles study