added printlastpop and sort function in tribe class