Points $X$ and $Y$ are chosen inside an acute-angled triangle $ABC$ with altitude $AD$ so that $\angle BXA + \angle ACB = 180^\circ , \angle CYA + \angle ABC = 180^\circ$, and $CD + AY = BD + AX$. Point $M$ is chosen on the ray $BX$ so that $X$ lies on segment $BM$ and $XM = AC$, and point $N$ is chosen on the ray $CY$ so that $Y$ lies on segment $CN$ and $YN = AB$. Prove that $AM = AN$. Proposed by Mykhailo Shtandenko