After you file

I got a good one for ya... 

The divorce decree says the Ex wife gets to Claim the 2 oldest kids and dad gets to claim the youngest. Mom had custody at the time of the divorce dad now has custody. Mom is still claiming the oldest 2 kids which I don't see as being fair. When dad goes to file his taxes claiming all the 3 kids because he has custody and supports them 12 months out of the year the return is kicked back because mom has already claimed them. Dad mails in a paper return and still get his income tax. What is the legal way to handle this? Does the court document override the IRS rules of who supports them at least 6 months out of the year ?