#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector <int> v(n);
for(int i = 0; i < n; i++) {
cin >> v[i];
}
int a, b, c, d; //1, 2 макс.; 1, 2 мин.
a = c = v[0];
b = d = v[1];
if(a > b) swap(a, b);
if(c > d) swap(c, d);
for(int i = 2; i < n; i++) {
if(v[i] > a) {
b = a;
a = v[i];
} else if(v[i] > b) {
b = v[i];
}
if(v[i] < c) {
d = c;
c = v[i];
} else if(v[i] < d) {
d = v[i];
}
}
if(a > b) swap(a, b);
if(c > d) swap(c, d);
if(a * b > c * d) cout << a << " " << b;
else cout << c << " " << d;
}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector <int> v(n);
for(int i = 0; i < n; i++) {
cin >> v[i];
}
int a, b, c, d; //1, 2 макс.; 1, 2 мин.
a = c = v[0];
b = d = v[1];
if(n != 2) {
for(int i = 0; i < n; i++) {
if(v[i] > a) {
b = a;
a = v[i];
} else if(v[i] > b) {
b = v[i];
}
if(v[i] < c) {
d = c;
c = v[i];
} else if(v[i] < d) {
d = v[i];
}
}
}
if(a > b) swap(a, b);
if(c > d) swap(c, d);
if(a * b > c * d) cout << a << " " << b;
else cout << c << " " << d;
}
var body = document.getElementsByTagName('body')[0];
body.addEventListener('touchmove', function (e) {
Move(e.touches[0]);
}, false);