Charles Trigg proposed this festive cryptarithm in the American Mathematical Monthly in 1956:

MERRY XMAS TO ALL

If each letter is a unique representation of a digit, and each word is a square integer, what are these four numbers?