MEP Air Terminal Labeling Script

My office uses the Mark and CFM to tag air terminals in the project. I would like to develop a script that 1) identifies each unique air terminal type, 2) sorts them first by type then by size and 3) Changes the Mark to sequential lettering “A” through however many unique types there are. I am new to dynamo and having issues with the sorting and lettering.

Any help would be appreciated: