while 1:A=map(int,raw_input().split());I=range(len(A));print" ".join(map(str,max([(A+A)[i:i+l]for l in I for i in I],key=sum)))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top