#include<iostream>#include<cstdio>usingnamespace std;constint N =1e5+10;int n, m, x;int a[N], b[N];//#define read(x) scanf("%d",&x)intmain(){
cin>>n>>m>>x;for(int i =0; i < n; i ++) cin>>a[i];for(int i =0; i < m; i ++) cin>>b[i];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){printf("%d %d\n", i, j);break;}}return0;}