You should save the names and surnames using a hash. Here there is the edited plunkr:
http://plnkr.co/edit/dChHKr?p=preview
The fact is that you need to trace, for each name, the assigned surname. Otherwise, you are not able to remove it from the list once you assign a new one.