(define(vr v k)(vector-ref v k))
(define(vs v k a)(vector-set! v k a))
(define(mv n a)(make-vector n a))
(define(vvr v y x X)(vector-ref v(+(* y X)x)))
(define(vvs v y x X a)(vector-set! v(+(* y X)x)a))
(define(mktm a b)(make-tree-map a b))
(define(tmpt t k v)(tree-map-put! t k v))
(define(tmgt t k)(tree-map-get t k))
(define(tmex? t k)(tree-map-exists? t k))
(define(tmfl? t)(not(tree-map-empty? t)))
(define(tpmi t)(tree-map-pop-min! t))
(define(tpma t)(tree-map-pop-max! t))

(define n(read))
(define a(mv n 0))
(define m1 0)
(define m2 0)
(define i 0)
(while(< i n)
	(vs a i(read))
	(if(>(vr a i)m1)
		(begin(set! m2 m1)(set! m1(vr a i)))
		(set! m2(vr a i))
	)
	(inc! i)
)
(set! i 0)
(while(< i n)
	(print(if(=(vr a i)m1)m2 m1))
	(inc! i)
)