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)))