Problem list
Log in
#r02767 · Online Judge > GoldOJ

Max Odd and Max Even

Bronze II 2.0 s 1024 MB

Given $n$ followed by $n$ integers (one per line), print the maximum odd value on the first line and the maximum even value on the second. Both an odd and an even value are guaranteed to exist.

Input

First line $n$ ($2 \le n \le 1000$); then $n$ integers, each in $[-10000, 10000]$, one per line.

Output

Print the max odd value, then the max even value.

Example 1

Input
6
3
10
-1
8
15
2
Output
15
10
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code