#include <bits/stdc++.h>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iostream>
#include <stdexcept>
#include <string>
#include <tuple>
#include <type_traits>

// lib/quo.hpp
#ifndef QUO_H
#define QUO_H

/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T quo(const T lhs, const T rhs) {
    return lhs > 0 ? lhs / rhs : rhs > 0 ? -((-lhs - 1 + rhs) / rhs) : (-lhs - 1 + -rhs) / -rhs;
  }
}

#endif

// lib/extgcd.hpp
#ifndef EXTGCD_HPP
#define EXTGCD_HPP


/*
usage:

std::tuple<int, int, int> result = tools::extgcd(4, 5);
int gcd = std::get<0>(result);
int x0 = std::get<1>(result);
int y0 = std::get<2>(result);
*/

namespace tools {
  template <typename T>
  std::tuple<T, T, T> extgcd(T prev_r, T r) {
    T prev_s = 1;
    T prev_t = 0;
    T s = 0;
    T t = 1;
    while (r != 0) {
      const T q = quo(prev_r, r);
      const T next_r = prev_r - q * r;
      prev_r = r;
      r = next_r;
      const T next_s = prev_s - q * s;
      prev_s = s;
      s = next_s;
      const T next_t = prev_t - q * t;
      prev_t = t;
      t = next_t;
    }
    return std::make_tuple(prev_r, prev_s, prev_t);
  }
}

#endif

// lib/fraction.hpp
#ifndef FRACTION_HPP
#define FRACTION_HPP


/*
usage:

tools::fraction(5, 2) // => (5/2)
*/

namespace tools {
  class fraction {
  private:
    std::intmax_t m_numerator;
    std::intmax_t m_denominator;

    void reduct() noexcept {
      if (this->m_denominator < 0) {
        this->m_numerator *= -1;
        this->m_denominator *= -1;
      }
      if (this->m_numerator != 0) {
        const std::intmax_t gcd = std::get<0>(tools::extgcd(this->m_numerator, this->m_denominator));
        this->m_numerator /= gcd;
        this->m_denominator /= gcd;
      }
    }

    fraction(const std::intmax_t numerator, const std::intmax_t denominator, bool) noexcept :
      m_numerator(numerator),
      m_denominator(denominator) {
      this->reduct();
    }

  public:
    fraction() noexcept :
      fraction(0, 1, true) {
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    fraction(const T n) noexcept :
      fraction(n, 1, true) {
    }
    template <typename T1, typename T2, typename std::enable_if<std::is_integral<T1>::value && std::is_integral<T2>::value, std::nullptr_t>::type = nullptr>
    fraction(const T1 numerator, const T2 denominator) :
      m_numerator(numerator),
      m_denominator(denominator) {
      if (this->m_denominator == 0) throw std::domain_error("Denominator cannot be zero.");
      this->reduct();
    }

    std::intmax_t numerator() const noexcept {
      return this->m_numerator;
    }

    std::intmax_t denominator() const noexcept {
      return this->m_denominator;
    }

    explicit operator double() const noexcept {
      return static_cast<double>(this->m_numerator) / this->m_denominator;
    }

    fraction operator+() const noexcept {
      return *this;
    }

    fraction operator-() const noexcept {
      return fraction(-this->m_numerator, this->m_denominator, true);
    }

    friend fraction operator+(const fraction& lhs, const fraction& rhs) noexcept {
      return fraction(lhs.m_numerator * rhs.m_denominator + rhs.m_numerator * lhs.m_denominator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator+(const fraction& lhs, const T rhs) noexcept {
      return fraction(lhs.m_numerator + static_cast<std::intmax_t>(rhs) * lhs.m_denominator, lhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator+(const T lhs, const fraction& rhs) noexcept {
      return fraction(static_cast<std::intmax_t>(lhs) * rhs.m_denominator + rhs.m_numerator, rhs.m_denominator, true);
    }

    friend fraction operator-(const fraction& lhs, const fraction& rhs) noexcept {
      return fraction(lhs.m_numerator * rhs.m_denominator - rhs.m_numerator * lhs.m_denominator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator-(const fraction& lhs, const T rhs) noexcept {
      return fraction(lhs.m_numerator - static_cast<std::intmax_t>(rhs) * lhs.m_denominator, lhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator-(const T lhs, const fraction& rhs) noexcept {
      return fraction(static_cast<std::intmax_t>(lhs) * rhs.m_denominator - rhs.m_numerator, rhs.m_denominator, true);
    }

    friend fraction operator*(const fraction& lhs, const fraction& rhs) noexcept {
      return fraction(lhs.m_numerator * rhs.m_numerator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator*(const fraction& lhs, const T rhs) noexcept {
      return fraction(lhs.m_numerator * static_cast<std::intmax_t>(rhs), lhs.m_denominator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator*(const T lhs, const fraction& rhs) noexcept {
      return fraction(static_cast<std::intmax_t>(lhs) * rhs.m_numerator, rhs.m_denominator, true);
    }

    friend fraction operator/(const fraction& lhs, const fraction& rhs) {
      if (rhs == 0) throw std::domain_error("Cannot divide by zero.");
      return fraction(lhs.m_numerator * rhs.m_denominator, lhs.m_denominator * rhs.m_numerator, true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator/(const fraction& lhs, const T rhs) {
      if (rhs == 0) throw std::domain_error("Cannot divide by zero.");
      return fraction(lhs.m_numerator, lhs.m_denominator * static_cast<std::intmax_t>(rhs), true);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend fraction operator/(const T lhs, const fraction& rhs) {
      if (rhs == 0) throw std::domain_error("Cannot divide by zero.");
      return fraction(static_cast<std::intmax_t>(lhs) * rhs.m_denominator, rhs.m_numerator, true);
    }

    fraction& operator++() noexcept {
      return *this = *this + 1;
    }
    fraction operator++(int) noexcept {
      const fraction prev = *this;
      ++*this;
      return prev;
    }

    fraction& operator--() noexcept {
      return *this = *this - 1;
    }
    fraction operator--(int) noexcept {
      const fraction prev = *this;
      --*this;
      return prev;
    }

    fraction& operator+=(const fraction& other) noexcept {
      return *this = *this + other;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    fraction& operator+=(const T other) noexcept {
      return *this = *this + other;
    }

    fraction& operator-=(const fraction& other) noexcept {
      return *this = *this - other;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    fraction& operator-=(const T other) noexcept {
      return *this = *this - other;
    }

    fraction& operator*=(const fraction& other) noexcept {
      return *this = *this * other;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    fraction& operator*=(const T other) noexcept {
      return *this = *this * other;
    }

    fraction& operator/=(const fraction& other) {
      return *this = *this / other;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    fraction& operator/=(const T other) {
      return *this = *this / other;
    }

    friend bool operator==(const fraction& lhs, const fraction& rhs) noexcept {
      return lhs.m_numerator == rhs.m_numerator && lhs.m_denominator == rhs.m_denominator;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator==(const fraction& lhs, const T rhs) noexcept {
      return lhs.m_numerator == static_cast<std::intmax_t>(rhs) && lhs.m_denominator == 1;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator==(const T lhs, const fraction& rhs) noexcept {
      return static_cast<std::intmax_t>(lhs) == rhs.m_numerator && 1 == rhs.m_denominator;
    }

    friend bool operator!=(const fraction& lhs, const fraction& rhs) noexcept {
      return !(lhs == rhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator!=(const fraction& lhs, const T rhs) noexcept {
      return !(lhs == rhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator!=(const T lhs, const fraction& rhs) noexcept {
      return !(lhs == rhs);
    }

    friend bool operator<(const fraction& lhs, const fraction& rhs) noexcept {
      return lhs.m_numerator * rhs.m_denominator < rhs.m_numerator * lhs.m_denominator;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator<(const fraction& lhs, const T rhs) noexcept {
      return lhs.m_numerator < static_cast<std::intmax_t>(rhs) * lhs.m_denominator;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator<(const T lhs, const fraction& rhs) noexcept {
      return static_cast<std::intmax_t>(lhs) * rhs.m_denominator < rhs.m_numerator;
    }

    friend bool operator>(const fraction& lhs, const fraction& rhs) noexcept {
      return rhs < lhs;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator>(const fraction& lhs, const T rhs) noexcept {
      return rhs < lhs;
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator>(const T lhs, const fraction& rhs) noexcept {
      return rhs < lhs;
    }

    friend bool operator<=(const fraction& lhs, const fraction& rhs) noexcept {
      return !(rhs < lhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator<=(const fraction& lhs, const T rhs) noexcept {
      return !(rhs < lhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator<=(const T lhs, const fraction& rhs) noexcept {
      return !(rhs < lhs);
    }

    friend bool operator>=(const fraction& lhs, const fraction& rhs) noexcept {
      return !(lhs < rhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator>=(const fraction& lhs, const T rhs) noexcept {
      return !(lhs < rhs);
    }
    template <typename T, typename std::enable_if<std::is_integral<T>::value, std::nullptr_t>::type = nullptr>
    friend bool operator>=(const T lhs, const fraction& rhs) noexcept {
      return !(lhs < rhs);
    }
  };
}

namespace std {
  string to_string(const tools::fraction& f);
  double sqrt(const tools::fraction& f);
  ostream& operator<<(ostream& os, const tools::fraction& self);

  template <>
  struct hash<tools::fraction> {
    typedef std::size_t result_type;
    typedef tools::fraction argument_type;
    std::size_t operator()(const tools::fraction& key) const {
      static const std::hash<std::intmax_t> hash = std::hash<std::intmax_t>();
      std::size_t result = 17;
      result = 31 * result + hash(key.numerator());
      result = 31 * result + hash(key.denominator());
      return result;
    }
  };
}

#endif

// lib/fraction.cpp

namespace std {
  string to_string(const tools::fraction& f) {
    return '(' + to_string(f.numerator()) + '/' + to_string(f.denominator()) + ')';
  }

  double sqrt(const tools::fraction& f) {
    return sqrt(static_cast<double>(f));
  }

  ostream& operator<<(ostream& os, const tools::fraction& self) {
    return os << to_string(self);
  }
}

// main.cpp

int main() {
  std::int_fast64_t n;
  std::cin >> n;
  std::vector<std::int_fast64_t> a;
  a.reserve(n);
  std::copy_n(std::istream_iterator<std::int_fast64_t>(std::cin), n, std::back_inserter(a));

  std::vector<tools::fraction> b;
  b.reserve(n);
  std::transform(a.begin(), a.end(), std::back_inserter(b), [](const std::int_fast64_t a_i) { return tools::fraction(a_i); });
  std::sort(b.begin(), b.end());
  const tools::fraction max = b.back();
  b.pop_back();
  const tools::fraction half = max / 2;
  const std::vector<tools::fraction>::iterator upward_it = std::lower_bound(b.begin(), b.end(), half);
  const tools::fraction upper_nearest_half = upward_it != b.end() ? *upward_it : tools::fraction(std::numeric_limits<std::int_fast32_t>::max());
  const std::vector<tools::fraction>::reverse_iterator downward_it = std::lower_bound(b.rbegin(), b.rend(), half, std::greater<tools::fraction>());
  const tools::fraction lower_nearest_half = downward_it != b.rend() ? *downward_it : tools::fraction(std::numeric_limits<std::int_fast32_t>::min());

  std::cout << max.numerator() << ' ' << (upper_nearest_half - half <= half - lower_nearest_half ? upper_nearest_half : lower_nearest_half).numerator() << std::endl;
  return 0;
}

Measured memory_bytes: 2560