Tree GCD output

I can’t find mistake in my code for a long time, getting Wrong Answer response all the time and start to think maybe there is problem with checking my output ?
How you implement it ?
I’m writing on Python 3.5, but all other languages output accepted
Already tried:
-print(value,end = ’ ‘) - to concatenate all list
-print(’ '.join(str(e) for e in answerList))