Add identifiers on terminal nodes