New Hampshire man pleads guilty in three N.H., Maine bank robberies