#include <iostream>
using namespace std;
const int N = 100010;
typedef long long ll;
int a[N], b[N];
ll x;
int n, m;
int main(){
cin >> n >> m >> x;
for(int i=0; i<n; i++) cin >> a[i];
for(int i=0; i<m; i++) cin >> b[i];
//i 从前往后,j从后往前,j不用回溯
for(int i=0, j=m-1; i<n; i++){
while(j>=0 && a[i] + b[j] > x) j--;
if(j>=0 && a[i] + b[j] == x) cout << i << " " << j << endl;
}
return 0;
}