#include<bits/stdc++.h>//f818
using namespace std;
int main(){
int n,h[2001],w[2001],ansh,answ;
while(cin>>n){
ansh=answ=10000000;
for(int i=1;i<=n;i++) cin>>h[i];
for(int j=1;j<=n;j++){
cin>>w[j];
if((h[j]*w[j])<(ansh*answ)) {
ansh=h[j];
answ=w[j];
}
}
cout<<ansh<<" "<<answ;
}
return 0;
}