# your code goes here
from typing import List
a: List[int] = [int(input()) for j in range(5)]
max_1, max_2 = sorted(a)[-1], sorted(a)[-2]
print (a.index(max_1))
print (a.index(max_2))
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCmZyb20gdHlwaW5nIGltcG9ydCBMaXN0CmE6IExpc3RbaW50XSA9IFtpbnQoaW5wdXQoKSkgZm9yIGogaW4gcmFuZ2UoNSldCm1heF8xLCBtYXhfMiA9IHNvcnRlZChhKVstMV0sIHNvcnRlZChhKVstMl0KcHJpbnQgKGEuaW5kZXgobWF4XzEpKQpwcmludCAoYS5pbmRleChtYXhfMikp