Massachusetts school allowed to ban student's 'two genders'