Problem:
Score : 400 points

Problem Statement

Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.
From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized.
If there are multiple pairs that maximize the value, any of them is accepted.

Constraints

2 \leq n \leq 10^5

0 \leq a_i \leq 10^9

a_1,a_2,...,a_n are pairwise distinct.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

n
a_1 a_2 ... a_n

Output

Print a_i and a_j that you selected, with a space in between.

Sample Input 1

5
6 9 4 2 11

Sample Output 1

11 6

\rm{comb}(a_i,a_j) for each possible selection is as follows:

\rm{comb}(4,2)=6

\rm{comb}(6,2)=15

\rm{comb}(6,4)=15

\rm{comb}(9,2)=36

\rm{comb}(9,4)=126

\rm{comb}(9,6)=84

\rm{comb}(11,2)=55

\rm{comb}(11,4)=330

\rm{comb}(11,6)=462

\rm{comb}(11,9)=55

Thus, we should print 11 and 6.

Sample Input 2

2
100 0

Sample Output 2

100 0

Solution in Rust (1.15.1) (judge verdict: Accepted)

// This code is generated by [cargo-atcoder](https://github.com/tanakh/cargo-atcoder)
// Original source code:
/*
#![allow(non_snake_case)]
#![allow(unused_imports)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;

#[derive(Debug, Clone)]
struct Combination {
    fact_inv: Vec<usize>,
    inv: Vec<usize>,
    com: Option<Vec<usize>>,
    MOD: usize,
}
impl Combination {
    fn new(n: usize, MOD: usize) -> Combination {
        let mut fact_inv = vec![0; n + 1];
        let mut inv = vec![0; n + 1];
        fact_inv[0] = 1;
        fact_inv[1] = 1;
        inv[1] = 1;
        for i in 2..=n {
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
        }
        Combination {
            fact_inv: fact_inv,
            inv: inv,
            com: None,
            MOD: MOD,
        }
    }
    fn fix_n(&mut self, n: usize) {
        let mut com = vec![0; n + 1];
        com[0] = 1;
        for i in 1..=n {
            com[i] = com[i - 1] * ((n - i + 1) * self.inv[i] % self.MOD) % self.MOD;
        }
        self.com = Some(com)
    }
    fn _calc_nck(&self, n: usize, k: usize) -> usize {
        if n < k {
            return 0;
        }
        let mut ans: usize = 1;
        let mut i = n;
        while n - k < i {
            ans *= i;
            ans %= self.MOD;
            i -= 1;
        }
        ans * self.fact_inv[k] % self.MOD
    }
    fn nck(&self, n: usize, k: usize) -> usize {
        match self.com.clone() {
            None => self._calc_nck(n, k),
            Some(x) => x[k],
        }
    }
    fn nhk(&self, n: usize, k: usize) -> usize {
        if self.fact_inv.len() < n + k - 1 {
            panic!("length must be n+k-1 or larger!")
        }
        self.nck(n + k - 1, k)
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        a: [isize; n],
    }
    let bset: BTreeSet<isize> = a.clone().into_iter().collect();
    let max = a.iter().max().unwrap();
    let ans: &isize;
    if n % 2 == 0 {
        let u = bset.range(max/2..).next().unwrap();
        let l = bset.range(..=max/2).next_back().unwrap();
        ans = if (max/2 - u).abs() < (max/2 - l).abs() {
            u
        } else {
            l
        };
    } else {
        let u = bset.range(max/2+1..).next().unwrap();
        let l = bset.range(..=max/2).next_back().unwrap();

        ans = if (max/2+1 - u).abs() < (max/2 - l).abs() {
            u
        } else {
            l
        };
    }

    println!("{} {}", max, ans);
}
*/

fn main() {
    let exe = "/tmp/bin950915AD";
    std::io::Write::write_all(&mut std::fs::File::create(exe).unwrap(), &decode(BIN)).unwrap();
    std::fs::set_permissions(exe, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap();
    std::process::exit(std::process::Command::new(exe).status().unwrap().code().unwrap())
}

fn decode(v: &str) -> Vec<u8> {
    let mut ret = vec![];
    let mut buf = 0;
    let mut tbl = vec![64; 256];
    for i in 0..64 { tbl[TBL[i] as usize] = i as u8; }
    for (i, c) in v.bytes().filter_map(|c| { let c = tbl[c as usize]; if c < 64 { Some(c) } else { None } }).enumerate() {
        match i % 4 {
            0 => buf = c << 2,
            1 => { ret.push(buf | c >> 4); buf = c << 4; }
            2 => { ret.push(buf | c >> 2); buf = c << 6; }
            3 => ret.push(buf | c),
            _ => unreachable!(),
        }
    }
    ret
}

const TBL: &'static [u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const BIN: &'static str = "<base64-encoded ELF executable removed>";