Let John’s and Peter’s ages be J and P.
3J+5P=110, J²+P²=386.
So J=(110-5P)/3 and (110-5P)²/9+P²=386.
12100-1100P+25P²+9P²=3474.
34P²-1100P+8626=0, 17P²-550P+4313=0=(17P-227)(P-19).
If P=19, then J=(110-5P)/3=5. John is younger than Peter.
In 5 years John will be 10 years old.