How do I address cousins?
First of all, 堂 and 表 are now mainly used in formal language, such as a kinship notarial certificate. We rarely use those terms in oral speech.
The completely male-side cousins are called 堂房, abbreviated to 堂. Other cousins are called 中表, abbreviated to 表.
Father is male and father's brother is male - 堂
Father's sister is female - 表
Mother is female - 表

Father's brother's son, older than ego - 堂兄
Father's brother's son, younger than ego - 堂弟
Father's brother's daughter, older than ego - 堂姐
Father brother's daughter, younger than ego - 堂妹

Father's sister's son, older than ego - 表兄
Father's sister's son, younger than ego - 表弟
Father's sister's daughter, older than ego - 表姐
Father sister's daughter, younger than ego - 表妹

Mother's sibling's son, older than ego - 表兄
Mother's sibling's son, younger than ego - 表弟
Mother's sibling's daughter, older than ego - 表姐
Mother's sibling's daughter, younger than ego - 表妹