extract triplets