**why I getting the wrong answer can anyone help me please**

#include

#include

#include

#include

using namespace std;

int main(){

int n,m;

cin>>n>>m;

vector<pair<int,int>>vec1(n),vec2(m);

```
for(int i=0;i<n;i++){
cin>>vec1[i].first;
vec1[i].second=i;
}
for(int i=0;i<m;i++){
cin>>vec2[i].first;
vec2[i].second=i;
}
sort(vec1.begin(),vec1.end());
sort(vec2.begin(),vec2.end());
for(int i=0;i<m;i++){
cout<<vec1[0].second<<" "<<vec2[i].second<<"\n";
}
for(int i=0;i<m;i++){
cout<<vec1[n-1].second<<" "<<vec2[i].second<<"\n";
}
return 0;
```

}