//#pragma GCC optimize("Ofast,unroll-loops") #ifdef LOCAL #include "debug.h" #else #include #include #include #define debug(x...) #endif using namespace std; //#define int ll typedef long long ll; typedef long double ld; typedef pair pii; #define sz(x) int((x).size()) template using ordered_set = __gnu_pbds::tree , __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; #ifdef ONLINE_JUDGE mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #else mt19937 rng(1000 - 7); #endif const int N = 2e5 + 10; //const ll MOD = 998244353; const ll MOD = 1e9 + 7; const ld eps = 5e-8; const pii dir[] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } }; signed main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cout << fixed << setprecision(9); ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int n; cin >> n; vector a(n); for (int& x : a) { cin >> x; } int x, y, ans = 0; for (int i = 0; i < n; i++) { for (int j = 1; j < n; j++) { if (a[i] > a[j]) { if ((a[i] + a[j]) % 120 == 0 && a[i] + a[j] > ans) { x = a[i], y = a[j]; ans = a[i] + a[j]; } } } } cout << x << " " << y << endl; return 0; }