one thing i noticed is that "J" can be anything really. So "Z", "N" and "Y" can be anything too. (or maybe im wrong)
For the rest, I just finished my math exam today so maybe next year
But i like these kind of problems, good logical programming practice. errr...sort of