For the trapassato prossimo, as for all compound tenses, the use of the auxiliary is determined by the main verb. When the trapassato prossimo is formed with essere, the participio passato (past participle) must agree in gender and number with the subject of the verb.