#include <iostream> using namespace std; int main() { int a[1001],b[1001],i,n; while(cin>>n) { a[0] = 0; for(i=1; i<=n; ++i) cin>>a[i]; for(i=1; i<=n; ++i) cin>>b[i]; for(i=1; i<=n; ++i) cout<<a[i]<<" "<<a[b[i]]<<endl; } return 0; }
混个AC