#include <iostream>
using namespace std;
int main()
{
int i, N, m = 0;
cin >> N;
int H[N]={0}, W[N]={0};
for (i=0;i<N;i++)
cin >> H[i];
for (i=0;i<N;i++)
cin >> W[i];
for (i=1;i<N;i++)
if (H[i] * W[i] <= H[m] * W[m])
m = i;
cout << H[m] << " " << W[m];
}