Which endocrine gland produces melatonin?

Thymus

Pineal gland

Adrenal cortex

Pituitary gland