solve for x and y

x+y=5
and x^x + y^y = 31

i have found x,y = 2,3 or 3,2
but i got the answer by merely substituting the values...
is there any proper way to find x and y??

this equation is not easily to solve algebraically.

x^x + (5-x)^(5-x) = 31

can't take logs, or roots, or anything easy. Not sure what doing this kind of exercise is intended to teach.