#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=200010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
unordered_map<int,int>pos;
int n,k,d,a[Maxn],b[Maxn],pre[Maxn],f[Maxn][18],Log[Maxn];
int query_mx(int l,int r)
{
	int t=Log[r-l+1];
	return max(f[l][t],f[r-(1<<t)+1][t]);
}
struct Seg{int l,r,lc,rc,c[3],cmx,cmn,tmx,tmn;}tr[Maxn<<1];
int tot=0;
void wmx(int x,int v)
{
	tr[x].cmx=v;tr[x].c[2]=tr[x].l+v;tr[x].c[0]=tr[x].c[1]+v;tr[x].tmx=v;
}
void wmn(int x,int v)
{
	tr[x].cmn=v;tr[x].c[1]=tr[x].l-v;tr[x].c[0]=tr[x].c[2]-v;tr[x].tmn=v;
}
void up(int x)
{
	int lc=tr[x].lc,rc=tr[x].rc;
	tr[x].cmx=max(tr[lc].cmx,tr[rc].cmx);
	tr[x].cmn=min(tr[lc].cmn,tr[rc].cmn);
	for(int i=0;i<3;i++)tr[x].c[i]=min(tr[lc].c[i],tr[rc].c[i]);
}
void down(int x)
{
	int t=tr[x].tmx;
	if(t!=inf)wmx(tr[x].lc,t),wmx(tr[x].rc,t),tr[x].tmx=inf;
	t=tr[x].tmn;
	if(t!=inf)wmn(tr[x].lc,t),wmn(tr[x].rc,t),tr[x].tmn=inf;
}
void build(int l,int r)
{
	int x=++tot;
	tr[x].l=l;tr[x].r=r;tr[x].tmx=tr[x].tmn=inf;
	if(l==r)return;
	int mid=l+r>>1;
	tr[x].lc=tot+1,build(l,mid);
	tr[x].rc=tot+1,build(mid+1,r);
}
void w(int x,int p)
{
	if(tr[x].l==tr[x].r)
	{
		tr[x].cmx=tr[x].cmn=b[p];
		tr[x].c[0]=p;tr[x].c[1]=p-b[p];tr[x].c[2]=p+b[p];
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(p<=mid)w(lc,p);
	else w(rc,p);
	up(x);
}
int tmp[30],lt;
void _w(int x,int l,int r,int v,int o)
{
	if(tr[x].l==l&&tr[x].r==r)
	{
		if(o==1)wmx(x,v);
		if(o==2)wmn(x,v);
		if(o==3)tmp[++lt]=x;
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(r<=mid)_w(lc,l,r,v,o);
	else if(l>mid)_w(rc,l,r,v,o);
	else _w(lc,l,mid,v,o),_w(rc,mid+1,r,v,o);
	up(x);
}
int V;
int go(int x,int op)
{
	if(tr[x].l==tr[x].r)return x;
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(op==1)
	{
		if(tr[lc].c[0]<=V)return go(lc,op);
		return go(rc,op);
	}
	else
	{
		if(tr[lc].c[0]>=V)return go(lc,op);
		return go(rc,op);
	}
}
int main()
{
	n=read(),k=read(),d=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		pre[i]=pos[a[i]];pos[a[i]]=i;
	}
//	for(int i=1;i<=n;i++)printf("%d ",pre[i]);puts("");
	int ans=1,L=1,R=1,v=1;
	if(d==0)
	{
		for(int i=2;i<=n;i++)
		{
			if(a[i]==a[i-1])v++;
			else v=1;
			if(v>ans)ans=v,R=i,L=i-v+1;
		}
		return printf("%d %d",L,R),0;
	}
	Log[1]=0;for(int i=2;i<=n;i++)Log[i]=Log[i>>1]+1;
	for(int i=1;i<=n;i++)f[i][0]=pre[i];
	for(int j=1;(1<<j)<=n;j++)
	for(int i=1;i+(1<<j)-1<=n;i++)
	f[i][j]=max(f[i][j-1],f[i+(1<<(j-1))][j-1]);
	for(int i=1;i<=n;i++)b[i]=(int)floor((double)a[i]/(double)d);
	build(1,n);w(1,1);
	for(int i=2;i<=n;i++)
	{
		if(abs(a[i])%d==abs(a[i-1])%d)v++;
		else v=1;
//		printf("%d %d\n",i,v);
		if(v>1)
		{
			lt=0;_w(1,i-v+1,i-1,0,3);
			int op=(b[i]>b[i-1]);
			bool flag=false;
			for(int j=lt;j;j--)
			{
				int x=tmp[j];
				if(op==1)
				{
					if(tr[x].cmx<=b[i])wmx(x,b[i]);
					else{V=b[i];int o=go(x,1);_w(1,tr[o].l,tr[x].r,b[i],1);break;}
				}
				else
				{
					if(tr[x].cmn>=b[i])wmn(x,b[i]);
					else{V=b[i];int o=go(x,2);_w(1,tr[o].l,tr[x].r,b[i],2);/*printf("%d %d\n",tr[o].l,tr[x].r);*/break;}
				}
			}
		}
		w(1,i);
		if(v<=R-L+1)continue;
		int l=i-v+1,r=i;bool flag=false;
		while(l<=r)
		{
			int mid=l+r>>1;
//			printf("$ %d %d %d\n",mid,i,query_mx(mid,i));
			if(query_mx(mid,i)<mid)r=mid-1,flag=true;
			else l=mid+1;
		}
		if(!flag)continue;
//		puts("ok");
		r++;lt=0;
//		printf("r=%d\n",r);
		_w(1,r,i,0,3);V=i+k;
		for(int j=1;j<=lt;j++)
		{
			int x=tmp[j];
			if(tr[x].c[0]<=V)
			{
//				printf("%d %d %d\n",tr[x].l,tr[x].r,tr[x].c[0]);
				int o=go(x,1);
//				printf("%d %d %d %d %d %d\n",i,tr[o].l,tr[o].cmn,tr[o].cmx,tr[o].c[0],V);
				if(i-tr[o].l+1>R-L+1)R=i,L=tr[o].l;
				break;
			}
		}
	}
	printf("%d %d",L,R);
}


#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=200010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
unordered_map<int,int>pos;
int n,k,d,a[Maxn],b[Maxn],pre[Maxn],f[Maxn][18],Log[Maxn];
int query_mx(int l,int r)
{
	int t=Log[r-l+1];
	return max(f[l][t],f[r-(1<<t)+1][t]);
}
struct Seg{int l,r,lc,rc,c[3],cmx,cmx1,cmn,cmn1,tmx,tmn;}tr[Maxn<<1];
int tot=0;
void wmx(int x,int v)
{
	if(v<tr[x].cmx)return;
//	printf("l=%d r=%d\n",tr[x].l,tr[x].r);
//	printf("%d %d\n",tr[x].cmn,tr[x].cmx);
	tr[x].cmx1=tr[x].cmx=v;tr[x].c[2]=tr[x].l+v;tr[x].c[0]=tr[x].c[1]+v;tr[x].tmx=v;
//	printf("%d %d\n",tr[x].cmn,tr[x].cmx);
}
void wmn(int x,int v)
{
	if(v>tr[x].cmn)return;
	tr[x].cmn1=tr[x].cmn=v;tr[x].c[1]=tr[x].l-v;tr[x].c[0]=tr[x].c[2]-v;tr[x].tmn=v;
}
void up(int x)
{
	int lc=tr[x].lc,rc=tr[x].rc;
	tr[x].cmx=max(tr[lc].cmx,tr[rc].cmx);
	tr[x].cmn=min(tr[lc].cmn,tr[rc].cmn);
	tr[x].cmx1=min(tr[lc].cmx1,tr[rc].cmx1);
	tr[x].cmn1=max(tr[lc].cmn1,tr[rc].cmn1);
	for(int i=0;i<3;i++)tr[x].c[i]=min(tr[lc].c[i],tr[rc].c[i]);
}
void down(int x)
{
	int t=tr[x].tmx;
	if(t!=inf)wmx(tr[x].lc,t),wmx(tr[x].rc,t),tr[x].tmx=inf;
	t=tr[x].tmn;
	if(t!=inf)wmn(tr[x].lc,t),wmn(tr[x].rc,t),tr[x].tmn=inf;
}
void build(int l,int r)
{
	int x=++tot;
	tr[x].l=l;tr[x].r=r;tr[x].tmx=tr[x].tmn=inf;
//	tr[x].cmx=tr[x].cmn1=-1010000000;
//	tr[x].cmn=tr[x].cmx1=tr[x].c[0]=tr[x].c[1]=tr[x].c[2]=1010000000;
	if(l==r)return;
	int mid=l+r>>1;
	tr[x].lc=tot+1,build(l,mid);
	tr[x].rc=tot+1,build(mid+1,r);
}
void w(int x,int p)
{
	if(tr[x].l==tr[x].r)
	{
		tr[x].cmx=tr[x].cmn=tr[x].cmx1=tr[x].cmn1=b[p];
		tr[x].c[0]=p;tr[x].c[1]=p-b[p];tr[x].c[2]=p+b[p];
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(p<=mid)w(lc,p);
	else w(rc,p);
	up(x);
}
int tmp[30],lt;
void _w(int x,int l,int r,int v,int o)
{
	if(tr[x].l==l&&tr[x].r==r)
	{
		if(o==1)wmx(x,v);
		if(o==2)wmn(x,v);
		if(o==3)tmp[++lt]=x;
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(r<=mid)_w(lc,l,r,v,o);
	else if(l>mid)_w(rc,l,r,v,o);
	else _w(lc,l,mid,v,o),_w(rc,mid+1,r,v,o);
	up(x);
}
int V;
int go(int x,int op)
{
	if(tr[x].l==tr[x].r)return x;
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(op==1)
	{
		if(tr[lc].c[0]<=V)return go(lc,op);
		return go(rc,op);
	}
	else if(op==2)
	{
		if(tr[lc].cmn1>=V)return go(lc,op);
		return go(rc,op);
	}
	else
	{
//		printf("&       %d %d %d\n",tr[lc].l,tr[lc].r,tr[lc].cmx);
		if(tr[lc].cmx1<=V)return go(lc,op);
		return go(rc,op);
	}
}
int fuck[Maxn];
int main()
{
//	freopen("3.in","r",stdin);
//	freopen("my.txt","w",stdout);
	n=read(),k=read(),d=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		pre[i]=pos[a[i]];pos[a[i]]=i;
	}
//	for(int i=1;i<=n;i++)printf("%d\n",a[i]);return 0;
//	for(int i=1;i<=n;i++)printf("%d ",pre[i]);puts("");
	int ans=1,L=1,R=1,v=1;
	if(d==0)
	{
		for(int i=2;i<=n;i++)
		{
			if(a[i]==a[i-1])v++;
			else v=1;
			if(v>ans)ans=v,R=i,L=i-v+1;
		}
		return printf("%d %d",L,R),0;
	}
	Log[1]=0;for(int i=2;i<=n;i++)Log[i]=Log[i>>1]+1;
	for(int i=1;i<=n;i++)f[i][0]=pre[i];
	for(int j=1;(1<<j)<=n;j++)
	for(int i=1;i+(1<<j)-1<=n;i++)
	f[i][j]=max(f[i][j-1],f[i+(1<<(j-1))][j-1]);
	for(int i=1;i<=n;i++)b[i]=(int)floor((double)a[i]/(double)d);
	build(1,n);w(1,1);
	for(int i=2;i<=n;i++)
	{
		if((a[i]%d+d)%d==(a[i-1]%d+d)%d)v++;
		else v=1;
//		printf("%d %d\n",i,v);
		if(v>1)
		{
			lt=0;_w(1,i-v+1,i-1,0,3);
			int op=(b[i]>b[i-1]);
			bool flag=false;
//			printf("i=%d\n",i);
			for(int j=lt;j;j--)
			{
				int x=tmp[j];
				if(op==1)
				{
					if(tr[x].cmx<=b[i])wmx(x,b[i])/*,printf("!3   %d %d\n",tr[x].l,tr[x].r)*/;
					else{V=b[i];int o=go(x,3);_w(1,tr[o].l,tr[x].r,b[i],1);/*printf("!4   %d %d\n",tr[o].l,tr[x].r);*/break;}
				}
				else
				{/**/
					if(tr[x].cmn>=b[i])wmn(x,b[i])/*,printf("!1   %d %d\n",tr[x].l,tr[x].r)*/;
					else{V=b[i];int o=go(x,2);_w(1,tr[o].l,tr[x].r,b[i],2);/*printf("!2   %d %d\n",tr[o].l,tr[x].r);*/break;}
				}/**/
			}
		}
		w(1,i);
		if(v<=R-L+1)continue;
		int l=i-v+1,r=i;bool flag=false;
		while(l<=r)
		{
			int mid=l+r>>1;
			if(query_mx(mid,i)<mid)r=mid-1,flag=true;
			else l=mid+1;
		}
		if(!flag)continue;
		r++;lt=0;
//		printf("r=%d\n",r);
		_w(1,r,i,0,3);V=i+k;
		for(int j=1;j<=lt;j++)
		{
			int x=tmp[j];
			if(tr[x].c[0]<=V)
			{
//				printf("%d %d %d\n",tr[x].l,tr[x].r,tr[x].c[0]);
				int o=go(x,1);
//				printf("%d %d %d %d %d %d\n",i,tr[o].l,tr[o].cmn,tr[o].cmx,tr[o].c[0],V);
				if(i-tr[o].l+1>R-L+1)R=i,L=tr[o].l;
				break;
			}
		}
	}
	printf("%d %d",L,R);
}


#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=200010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
unordered_map<int,int>pos;
int n,k,d,a[Maxn],pre[Maxn];
int main()
{
	n=read(),k=read(),d=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		pre[i]=pos[a[i]];pos[a[i]]=i;
	}
	int ans=1,L=1,R=1,v=1;
	if(d==0)
	{
		for(int i=2;i<=n;i++)
		{
			if(a[i]==a[i-1])v++;
			else v=1;
			if(v>ans)ans=v,R=i,L=i-v+1;
		}
		return printf("%d %d",L,R),0;
	}
	for(int r=2;r<=n;r++)
	{
		if(a[r]%d==a[r-1]%d)v++;
		else{v=1;continue;}
		if(v<=R-L+1)continue;
		int lim=max(pre[r]+1,r-v+1);
		int mn=a[r]/d,mx=a[r]/d;
		for(int l=r-1;l>=lim;l--)
		{
			mn=min(mn,a[l]/d),mx=max(mx,a[l]/d);
			lim=max(lim,pre[l]+1);
			if(mx-mn<=r-l+k)
			{
				if(r-l+1>ans)
				ans=r-l+1,R=r,L=l;
			}
		}
	}
	printf("%d %d",L,R);
}


#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=200010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
unordered_map<int,int>pos;
int n,k,d,a[Maxn],pre[Maxn];
int main()
{
	n=read(),k=read(),d=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		pre[i]=pos[a[i]];pos[a[i]]=i;
	}
	int ans=1,L=1,R=1,v=1;
	if(d==0)
	{
		for(int i=2;i<=n;i++)
		{
			if(a[i]==a[i-1])v++;
			else v=1;
			if(v>ans)ans=v,R=i,L=i-v+1;
		}
		return printf("%d %d",L,R),0;
	}
	for(int r=2;r<=n;r++)
	{
		if(abs(a[r])%d==abs(a[r-1])%d)v++;
		else{v=1;continue;}
		if(v<=R-L+1)continue;
		int lim=max(pre[r]+1,r-v+1);
		int mn=(int)floor((double)a[r]/(double)d),mx=(int)floor((double)a[r]/(double)d);
		for(int l=r-1;l>=lim;l--)
		{
			mn=min(mn,(int)floor((double)a[l]/(double)d)),mx=max(mx,(int)floor((double)a[l]/(double)d));
//			printf("%d %d %d %d\n",l,r,mn,mx);
			lim=max(lim,pre[l]+1);
			if(mx-mn<=r-l+k)
			{
				if(r-l+1>ans)
				ans=r-l+1,R=r,L=l;
			}
		}
	}
	printf("%d %d",L,R);
}


#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=200010;
const int inf=2147483647;
int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return x*f;
}
unordered_map<int,int>pos;
int n,k,d,a[Maxn],b[Maxn],pre[Maxn],f[Maxn][18],Log[Maxn];
int query_mx(int l,int r)
{
	int t=Log[r-l+1];
	return max(f[l][t],f[r-(1<<t)+1][t]);
}
struct Seg{int l,r,lc,rc,c[3],cmx,cmn,tmx,tmn;}tr[Maxn<<1];
int tot=0;
void wmx(int x,int v)
{
	if(v<=tr[x].cmx)return;
	tr[x].cmx=v;tr[x].c[2]=tr[x].l+v;tr[x].c[0]=tr[x].c[1]+v;tr[x].tmx=v;
}
void wmn(int x,int v)
{
	if(v>=tr[x].cmn)return;
	tr[x].cmn=v;tr[x].c[1]=tr[x].l-v;tr[x].c[0]=tr[x].c[2]-v;tr[x].tmn=v;
}
void up(int x)
{
	int lc=tr[x].lc,rc=tr[x].rc;
	tr[x].cmx=max(tr[lc].cmx,tr[rc].cmx);
	tr[x].cmn=min(tr[lc].cmn,tr[rc].cmn);
	for(int i=0;i<3;i++)tr[x].c[i]=min(tr[lc].c[i],tr[rc].c[i]);
}
void down(int x)
{
	int t=tr[x].tmx;
	if(t!=inf)wmx(tr[x].lc,t),wmx(tr[x].rc,t),tr[x].tmx=inf;
	t=tr[x].tmn;
	if(t!=inf)wmn(tr[x].lc,t),wmn(tr[x].rc,t),tr[x].tmn=inf;
}
void build(int l,int r)
{
	int x=++tot;
	tr[x].l=l;tr[x].r=r;tr[x].tmx=tr[x].tmn=inf;
	if(l==r)return;
	int mid=l+r>>1;
	tr[x].lc=tot+1,build(l,mid);
	tr[x].rc=tot+1,build(mid+1,r);
}
void w(int x,int p)
{
	if(tr[x].l==tr[x].r)
	{
		tr[x].cmx=tr[x].cmn=b[p];
		tr[x].c[0]=p;tr[x].c[1]=p-b[p];tr[x].c[2]=p+b[p];
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(p<=mid)w(lc,p);
	else w(rc,p);
	up(x);
}
int tmp[30],lt;
void _w(int x,int l,int r,int v,int o)
{
	if(tr[x].l==l&&tr[x].r==r)
	{
		if(o==1)wmx(x,v);
		if(o==2)wmn(x,v);
		if(o==3)tmp[++lt]=x;
		return;
	}
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(r<=mid)_w(lc,l,r,v,o);
	else if(l>mid)_w(rc,l,r,v,o);
	else _w(lc,l,mid,v,o),_w(rc,mid+1,r,v,o);
	up(x);
}
int V;
int go(int x)
{
	if(tr[x].l==tr[x].r)return tr[x].l;
	int mid=tr[x].l+tr[x].r>>1,lc=tr[x].lc,rc=tr[x].rc;
	down(x);
	if(tr[lc].c[0]<=V)return go(lc);
	return go(rc);
}
int main()
{
	n=read(),k=read(),d=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		pre[i]=pos[a[i]];pos[a[i]]=i;
	}
//	for(int i=1;i<=n;i++)printf("%d ",pre[i]);puts("");
	int ans=1,L=1,R=1,v=1;
	if(d==0)
	{
		for(int i=2;i<=n;i++)
		{
			if(a[i]==a[i-1])v++;
			else v=1;
			if(v>ans)ans=v,R=i,L=i-v+1;
		}
		return printf("%d %d",L,R),0;
	}
	for(int i=1;i<=n;i++)f[i][0]=pre[i];
	for(int j=1;(1<<j)<=n;j++)
	for(int i=1;i+(1<<j)-1<=n;i++)
	f[i][j]=max(f[i][j-1],f[i+(1<<j)][j-1]);
	for(int i=1;i<=n;i++)b[i]=(int)floor((double)a[i]/(double)d);
	build(1,n);w(1,1);
	for(int i=2;i<=n;i++)
	{
		if(abs(a[i])%d==abs(a[i-1])%d)v++;
		else v=1;
//		printf("%d %d\n",i,v);
		if(v>1)
		{
			if(b[i]>b[i-1])_w(1,i-v+1,i,b[i],1);
			else _w(1,i-v+1,i,b[i],2);
		}
		w(1,i);
		if(v<=R-L+1)continue;
		int l=i-v+1,r=i;bool flag=false;
		while(l<=r)
		{
			int mid=l+r>>1;
//			printf("# %d %d %d\n",mid,i,query_mx(mid,i));
			if(query_mx(mid,i)<mid)r=mid-1,flag=true;

			else l=mid+1;
		}
		if(!flag)continue;
//		puts("ok");
		r++;lt=0;
//		printf("r=%d\n",r);
		_w(1,r,i,0,3);V=i+k;
		for(int j=1;j<=lt;j++)
		{
			int x=tmp[j];
			if(tr[x].c[0]<=V)
			{
				int o=go(x);
				if(i-o+1>R-L+1)R=i,L=o;
				break;
			}
		}
	}
	printf("%d %d",L,R);
}


// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9, maxn=(1<<20)+5;

struct segm{
	int sum,lazy;
}se[maxn << 2];

void build(int x,int y,int num){
	se[num].sum = se[num].lazy = 0;
	if(x == y)return ;
	int mid=x+y>>1;
	build(x,mid,num<<1);build(mid+1,y,num<<1|1);
}

void pushdown(int num){
	if(!se[num].lazy)return ;
	se[num<<1].sum += se[num].lazy; se[num<<1].lazy += se[num].lazy;
	se[num<<1|1].sum += se[num].lazy; se[num<<1|1].lazy += se[num].lazy;
//	printf("%d %d %d\n",num<<1,se[num<<1].sum,se[num<<1].lazy);
//	printf("%d %d %d\n",num<<1|1,se[num<<1|1].sum,se[num<<1|1].lazy);
	se[num].lazy = 0;
}

void update(int l,int r,int x,int y,int to,int num){
	if(r<x || l>y)return ;
	if(x<=l && r<=y){se[num].sum += to;se[num].lazy += to;return ;}
	pushdown(num);
	int mid=l+r>>1;
	update(l,mid,x,y,to,num<<1);update(mid+1,r,x,y,to,num<<1|1);
	se[num].sum = min(se[num<<1].sum, se[num<<1|1].sum);
}

int query(int l,int r,int x,int y,int to,int num){
//	printf("%d %d %d %d\n",l,r,x,y);
	if(r<x || l>y || se[num].sum > to)return -1;
	if(l == r)return l;
	pushdown(num);
	int mid=l+r>>1;
	int lp = query(l,mid,x,y,to,num<<1);
//	printf("? %d\n",lp);
	return ~lp?lp:query(mid+1,r,x,y,to,num<<1|1);
}

int ans,mxlen;
void solve(int *a,int N,int K,int f){
	if(N<=mxlen)return ;
//	printf("N %d\n",N);
	static int b[maxn],c[maxn],lst[maxn],stk1[maxn],stk2[maxn];
	for(int i=1;i<=N;i++)b[i] = a[i];
	sort(b+1,b+N+1);
	int m=unique(b+1,b+N+1)-(b+1);
	for(int i=1;i<=N;i++)
		c[i] = lower_bound(b+1,b+m+1,a[i])-b;
	for(int i=1;i<=m;i++)lst[i] = 0;
	int minl=1, tp1=0, tp2=0;
	build(1,N,1);
//	printf("M %d\n",m);
	for(int i=1;i<=N;i++){
		minl = max(minl, lst[c[i]]+1);
//        printf("%d\n",minl);
		lst[c[i]] = i;
		for(;tp1&&a[stk1[tp1]] <= a[i];--tp1)
			update(1,N,stk1[tp1-1]+1,stk1[tp1],a[i]-a[stk1[tp1]],1);
		for(;tp2&&a[stk1[tp2]] >= a[i];--tp2)
			update(1,N,stk2[tp2-1]+1,stk2[tp2],a[stk2[tp2]]-a[i],1);
		stk1[++tp1]=stk2[++tp2] = i;
		update(1,N,i,i,i,1);
		int lp = query(1,N,minl,i,K+i,1);
//		printf("! %d %d\n",i,K+i);
		if(~lp && mxlen<i-lp+1){
			mxlen=i-lp+1;
			ans = lp+f;
		}
	}
}

int n,k,d,a[maxn],cl,r[maxn],b[maxn],t;
int main(){
//	freopen("E.in","r",stdin);
	scanf("%d%d%d",&n,&k,&d);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	if(d == 0){
		int ans=1,lst=a[1],cl = 0,ansi=1;
		for(int i=2;i<=n;i++){
			if(a[i] == lst)++ cl;
			else lst = a[i], cl = 1;
			if(cl > ans)ans = cl, ansi = i-ans+1;
		}
		printf("%d %d\n",ansi,ansi+ans-1);

		return 0;
	}
	for(int i=1;i<=n;i++)r[i] = (a[i]%d+d)%d;
	for(int i=1;i<=n;i++){
		b[++ t] = (a[i]-r[i])/d;
		if(i == n||r[i] != r[i+1])solve(b,t,k,i-t), t = 0;
	}
	printf("%d %d\n",ans,ans+mxlen-1);

	return 0;
}


// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9, maxn=(1<<20)+5;

struct segm{
	int sum,lazy;
}se[maxn << 2];

void build(int x,int y,int num){
	se[num].sum = se[num].lazy = 0;
	if(x == y)return ;
	int mid=x+y>>1;
	build(x,mid,num<<1);build(mid+1,y,num<<1|1);
}

void pushdown(int num){
	if(!se[num].lazy)return ;
	se[num<<1].sum += se[num].lazy; se[num<<1].lazy += se[num].lazy;
	se[num<<1|1].sum += se[num].lazy; se[num<<1|1].lazy += se[num].lazy;
//	printf("%d %d %d\n",num<<1,se[num<<1].sum,se[num<<1].lazy);
//	printf("%d %d %d\n",num<<1|1,se[num<<1|1].sum,se[num<<1|1].lazy);
	se[num].lazy = 0;
}

void update(int l,int r,int x,int y,int to,int num){
	if(r<x || l>y)return ;
	if(x<=l && r<=y){se[num].sum += to;se[num].lazy += to;return ;}
	pushdown(num);
	int mid=l+r>>1;
	update(l,mid,x,y,to,num<<1);update(mid+1,r,x,y,to,num<<1|1);
	se[num].sum = min(se[num<<1].sum, se[num<<1|1].sum);
}

int query(int l,int r,int x,int y,int to,int num){
//	printf("%d %d %d %d\n",l,r,x,y);
	if(r<x || l>y || se[num].sum > to)return -1;
	if(l == r)return l;
	pushdown(num);
	int mid=l+r>>1;
	int lp = query(l,mid,x,y,to,num<<1);
//	printf("? %d\n",lp);
	return ~lp?lp:query(mid+1,r,x,y,to,num<<1|1);
}

int ans,mxlen;
void solve(int *a,int N,int K,int f){
	if(N<=mxlen)return ;
//	printf("N %d\n",N);
	static int b[maxn],c[maxn],lst[maxn],stk1[maxn],stk2[maxn];
	for(int i=1;i<=N;i++)b[i] = a[i];
	sort(b+1,b+N+1);
	int m=unique(b+1,b+N+1)-(b+1);
	for(int i=1;i<=N;i++)
		c[i] = lower_bound(b+1,b+m+1,a[i])-b;
	for(int i=1;i<=m;i++)lst[i] = 0;
	int minl=1, tp1=0, tp2=0;
	build(1,N,1);
//	printf("M %d\n",m);
	for(int i=1;i<=N;i++){
		minl = max(minl, lst[c[i]]+1);
//        printf("%d\n",minl);
		lst[c[i]] = i;
		for(;tp1&&a[stk1[tp1]] <= a[i];--tp1)
			update(1,N,stk1[tp1-1]+1,stk1[tp1],a[i]-a[stk1[tp1]],1);
		for(;tp2&&a[stk2[tp2]] >= a[i];--tp2)
			update(1,N,stk2[tp2-1]+1,stk2[tp2],a[stk2[tp2]]-a[i],1);
		stk1[++tp1]=stk2[++tp2] = i;
		update(1,N,i,i,i,1);
		int lp = query(1,N,minl,i,K+i,1);
//		printf("! %d %d\n",i,K+i);
		if(~lp && mxlen<i-lp+1){
			mxlen=i-lp+1;
			ans = lp+f;
		}
	}
}

int n,k,d,a[maxn],cl,r[maxn],b[maxn],t;
int main(){
//	freopen("E.in","r",stdin);
	scanf("%d%d%d",&n,&k,&d);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	if(d == 0){
		int ans=1,lst=a[1],cl = 0,ansi=1;
		for(int i=2;i<=n;i++){
			if(a[i] == lst)++ cl;
			else lst = a[i], cl = 1;
			if(cl > ans)ans = cl, ansi = i-ans+1;
		}
		printf("%d %d\n",ansi,ansi+ans-1);

		return 0;
	}
	for(int i=1;i<=n;i++)r[i] = (a[i]%d+d)%d;
	for(int i=1;i<=n;i++){
		b[++ t] = (a[i]-r[i])/d;
		if(i == n||r[i] != r[i+1])solve(b,t,k,i-t), t = 0;
	}
	printf("%d %d\n",ans,ans+mxlen-1);

	return 0;
}


// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9, maxn=2e5+5;

struct segm{
	int sum,lazy;
}se[maxn << 2];

void build(int x,int y,int num){
	se[num].sum = se[num].lazy = 0;
	if(x == y)return ;
	int mid=x+y>>1;
	build(x,mid,num<<1);build(mid+1,y,num<<1|1);
}

void pushdown(int num){
	if(!se[num].lazy)return ;
	se[num<<1].sum += se[num].lazy; se[num<<1].lazy += se[num].lazy;
	se[num<<1|1].sum += se[num].lazy; se[num<<1|1].lazy += se[num].lazy;
//	printf("%d %d %d\n",num<<1,se[num<<1].sum,se[num<<1].lazy);
//	printf("%d %d %d\n",num<<1|1,se[num<<1|1].sum,se[num<<1|1].lazy);
	se[num].lazy = 0;
}

void update(int l,int r,int x,int y,int to,int num){
	if(r<x || l>y)return ;
	if(x<=l && r<=y){se[num].sum += to;se[num].lazy += to;return ;}
	pushdown(num);
	int mid=l+r>>1;
	update(l,mid,x,y,to,num<<1);update(mid+1,r,x,y,to,num<<1|1);
	se[num].sum = min(se[num<<1].sum, se[num<<1|1].sum);
}

int query(int l,int r,int x,int y,int to,int num){
//	printf("%d %d %d %d\n",l,r,x,y);
	if(r<x || l>y || se[num].sum > to)return -1;
	if(l == r)return l;
	pushdown(num);
	int mid=l+r>>1;
	int lp = query(l,mid,x,y,to,num<<1);
//	printf("? %d\n",lp);
	return ~lp?lp:query(mid+1,r,x,y,to,num<<1|1);
}

int ans,mxlen;
void solve(int *a,int N,int K,int f){
	if(N<=mxlen)return ;
//	printf("N %d\n",N);
	static int b[maxn],c[maxn],lst[maxn],stk1[maxn],stk2[maxn];
	for(int i=1;i<=N;i++)b[i] = a[i];
	sort(b+1,b+N+1);
	int m=unique(b+1,b+N+1)-(b+1);
	for(int i=1;i<=N;i++)
		c[i] = lower_bound(b+1,b+m+1,a[i])-b;
	for(int i=1;i<=m;i++)lst[i] = 0;
	int minl=1, tp1=0, tp2=0;
	build(1,N,1);
//	printf("M %d\n",m);
	for(int i=1;i<=N;i++){
		minl = max(minl, lst[c[i]]+1);
//        printf("%d\n",minl);
		lst[c[i]] = i;
		for(;tp1&&a[stk1[tp1]] <= a[i];--tp1)
			update(1,N,stk1[tp1-1]+1,stk1[tp1],a[i]-a[stk1[tp1]],1);
		for(;tp2&&a[stk1[tp2]] >= a[i];--tp2)
			update(1,N,stk2[tp2-1]+1,stk2[tp2],a[stk2[tp2]]-a[i],1);
		stk1[++tp1]=stk2[++tp2] = i;
		update(1,N,i,i,i,1);
		int lp = query(1,N,minl,i,K+i,1);
//		printf("! %d %d\n",i,K+i);
		if(~lp && mxlen<i-lp+1){
			mxlen=i-lp+1;
			ans = lp+f;
		}
	}
}

int n,k,d,a[maxn],cl,r[maxn],b[maxn],t;
int main(){
//	freopen("E.in","r",stdin);
	scanf("%d%d%d",&n,&k,&d);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	if(d == 0){
		int ans=1,lst=a[1],cl = 0,ansi=1;
		for(int i=2;i<=n;i++){
			if(a[i] == lst)++ cl;
			else lst = a[i], cl = 1;
			if(cl > ans)ans = cl, ansi = i-ans+1;
		}
		printf("%d %d\n",ansi,ansi+ans-1);

		return 0;
	}
	for(int i=1;i<=n;i++)r[i] = (a[i]%d+d)%d;
	for(int i=1;i<=n;i++){
		b[++ t] = (a[i]-r[i])/d;
		if(i == n||r[i] != r[i+1])solve(b,t,k,i-t), t = 0;
	}
	printf("%d %d\n",ans,ans+mxlen-1);

	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, k, d, num[200007], res[2], st1[200007], st2[200007], tp1, tp2;
int t[800007], tag[800007];
map<int, int>lst;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int mtree(int w, int l, int r)
{
	t[w] = 1e9; tag[w] = 0;
	if (l == r)return 0;
	int mid = (l + r) / 2;
	mtree(2 * w, l, mid);
	mtree(2 * w + 1, mid + 1, r);
	return 0;
}
int down(int w)
{
	if (!tag[w])return 0;
	t[2 * w] += tag[w];
	t[2 * w + 1] += tag[w];
	tag[2 * w] += tag[w];
	tag[2 * w + 1] += tag[w];
	tag[w] = 0;
	return 0;
}
int reset(int w, int l, int r, int x)
{
	if (l == r)
	{
		t[w] = l;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)reset(2 * w, l, mid, x);
	else reset(2 * w + 1, mid + 1, r, x);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] += v;
		tag[w] += v;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int v)
{
	if (l == r)return l;
	int mid = (l + r) / 2;
	if (t[2 * w] <= v)return ask(2 * w, l, mid, v);
	else return ask(2 * w + 1, mid + 1, r, v);
}
int solve(int l, int r)
{
	lst.clear();
	mtree(1, l, r);
	st1[0] = st2[0] = l - 1;
	tp1 = tp2 = 0;
	for (int i = l; i <= r; i++)
	{
		reset(1, l, r, i);

		while (tp1 && num[st1[tp1]] >= num[i])
		{
			change(1, l, r, st1[tp1 - 1] + 1, st1[tp1], num[st1[tp1]] / d);
			tp1--;
		}
		st1[++tp1] = i;
		change(1, l, r, st1[tp1 - 1] + 1, i, -num[i] / d);

		while (tp2 && num[st2[tp2]] <= num[i])
		{
			change(1, l, r, st2[tp2 - 1] + 1, st2[tp2], -num[st2[tp2]] / d);
			tp2--;
		}
		st2[++tp2] = i;
		change(1, l, r, st2[tp2 - 1] + 1, i, num[i] / d);

		if (lst.count(num[i]))change(1, l, r, l, lst[num[i]], 1e9);
		lst[num[i]] = i;
		if (t[1] > i + k)continue;
		int ans = ask(1, l, r, i + k);
		if (i - ans > res[1] - res[0] || (i - ans == res[1] - res[0] && ans < res[0]))
			res[0] = ans, res[1] = i;
	}
	return 0;
}
signed main()
{
	n = read();
	k = read();
	d = read();
	for (int i = 1; i <= n; i++)
		num[i] = read();
	if (d == 0)
	{
		for (int i = 1, j; i <= n; i = j)
		{
			j = i;
			while (j <= n && num[j] == num[i])j++;
			if (j - i > res[1] - res[0] || (j - i == res[1] - res[0] && i < res[0]))
				res[0] = i, res[1] = j - 1;
		}
		cout << res[0] << ' ' << res[1] << endl;
		return 0;
	}
	for (int i = 1, j; i <= n; i = j)
	{
		j = i;
		while (j <= n && num[j] % d == num[i] % d)j++;
		solve(i, j - 1);
	}
	cout << res[0] << ' ' << res[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, k, d, num[200007], res[2] = { 1,0 }, st1[200007], st2[200007], tp1, tp2;
int t[800007], tag[800007];
map<int, int>lst;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int mtree(int w, int l, int r)
{
	t[w] = 1e9; tag[w] = 0;
	if (l == r)return 0;
	int mid = (l + r) / 2;
	mtree(2 * w, l, mid);
	mtree(2 * w + 1, mid + 1, r);
	return 0;
}
int down(int w)
{
	if (!tag[w])return 0;
	t[2 * w] += tag[w];
	t[2 * w + 1] += tag[w];
	tag[2 * w] += tag[w];
	tag[2 * w + 1] += tag[w];
	tag[w] = 0;
	return 0;
}
int reset(int w, int l, int r, int x)
{
	if (l == r)
	{
		t[w] = l;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)reset(2 * w, l, mid, x);
	else reset(2 * w + 1, mid + 1, r, x);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] += v;
		tag[w] += v;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int v)
{
	if (l == r)return l;
	down(w);
	int mid = (l + r) / 2;
	if (t[2 * w] <= v)return ask(2 * w, l, mid, v);
	else return ask(2 * w + 1, mid + 1, r, v);
}
int solve(int l, int r)
{
	lst.clear();
	mtree(1, l, r);
	st1[0] = st2[0] = l - 1;
	tp1 = tp2 = 0;
	for (int i = l; i <= r; i++)
	{
		reset(1, l, r, i);

		while (tp1 && num[st1[tp1]] >= num[i])
		{
			change(1, l, r, st1[tp1 - 1] + 1, st1[tp1], num[st1[tp1]] / d);
			tp1--;
		}
		st1[++tp1] = i;
		change(1, l, r, st1[tp1 - 1] + 1, i, -num[i] / d);

		while (tp2 && num[st2[tp2]] <= num[i])
		{
			change(1, l, r, st2[tp2 - 1] + 1, st2[tp2], -num[st2[tp2]] / d);
			tp2--;
		}
		st2[++tp2] = i;
		change(1, l, r, st2[tp2 - 1] + 1, i, num[i] / d);

		if (lst.count(num[i]))change(1, l, r, l, lst[num[i]], 1e9);
		lst[num[i]] = i;
		if (t[1] > i + k)continue;
		int ans = ask(1, l, r, i + k);
		if (i - ans > res[1] - res[0] || (i - ans == res[1] - res[0] && ans < res[0]))
			res[0] = ans, res[1] = i;
	}
	return 0;
}
signed main()
{
	n = read();
	k = read();
	d = read();
	for (int i = 1; i <= n; i++)
		num[i] = read();
	if (d == 0)
	{
		for (int i = 1, j; i <= n; i = j)
		{
			j = i;
			while (j <= n && num[j] == num[i])j++;
			if (j - i > res[1] - res[0] + 1 || (j - i == res[1] - res[0] + 1 && i < res[0]))
				res[0] = i, res[1] = j - 1;
		}
		cout << res[0] << ' ' << res[1] << endl;
		return 0;
	}
	for (int i = 1, j; i <= n; i = j)
	{
		j = i;
		while (j <= n && (num[j] % d + d) % d == (num[i] % d + d) % d)j++;
		solve(i, j - 1);
	}
	cout << res[0] << ' ' << res[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, k, d, num[200007], res[2] = { 1,0 }, st1[200007], st2[200007], tp1, tp2;
int t[800007], tag[800007];
map<int, int>lst;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int mtree(int w, int l, int r)
{
	t[w] = 1e9; tag[w] = 0;
	if (l == r)return 0;
	int mid = (l + r) / 2;
	mtree(2 * w, l, mid);
	mtree(2 * w + 1, mid + 1, r);
	return 0;
}
int down(int w)
{
	if (!tag[w])return 0;
	t[2 * w] += tag[w];
	t[2 * w + 1] += tag[w];
	tag[2 * w] += tag[w];
	tag[2 * w + 1] += tag[w];
	tag[w] = 0;
	return 0;
}
int reset(int w, int l, int r, int x)
{
	if (l == r)
	{
		t[w] = l;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)reset(2 * w, l, mid, x);
	else reset(2 * w + 1, mid + 1, r, x);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] += v;
		tag[w] += v;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int v)
{
	if (l == r)return l;
	down(w);
	int mid = (l + r) / 2;
	if (t[2 * w] <= v)return ask(2 * w, l, mid, v);
	else return ask(2 * w + 1, mid + 1, r, v);
}
int solve(int l, int r)
{
	lst.clear();
	mtree(1, l, r);
	st1[0] = st2[0] = l - 1;
	tp1 = tp2 = 0;
	for (int i = l; i <= r; i++)
	{
		reset(1, l, r, i);

		while (tp1 && num[st1[tp1]] >= num[i])
		{
			change(1, l, r, st1[tp1 - 1] + 1, st1[tp1], num[st1[tp1]] / d);
			tp1--;
		}
		st1[++tp1] = i;
		change(1, l, r, st1[tp1 - 1] + 1, i, -num[i] / d);

		while (tp2 && num[st2[tp2]] <= num[i])
		{
			change(1, l, r, st2[tp2 - 1] + 1, st2[tp2], -num[st2[tp2]] / d);
			tp2--;
		}
		st2[++tp2] = i;
		change(1, l, r, st2[tp2 - 1] + 1, i, num[i] / d);

		if (lst.count(num[i]))change(1, l, r, l, lst[num[i]], 1e9);
		lst[num[i]] = i;
		if (t[1] > i + k)continue;
		int ans = ask(1, l, r, i + k);
		if (i - ans > res[1] - res[0] || (i - ans == res[1] - res[0] && ans < res[0]))
			res[0] = ans, res[1] = i;
	}
	return 0;
}
signed main()
{
	n = read();
	k = read();
	d = read();
	for (int i = 1; i <= n; i++)
		num[i] = read();
	if (d == 0)
	{
		for (int i = 1, j; i <= n; i = j)
		{
			j = i;
			while (j <= n && num[j] == num[i])j++;
			if (j - i > res[1] - res[0] || (j - i == res[1] - res[0] && i < res[0]))
				res[0] = i, res[1] = j - 1;
		}
		cout << res[0] << ' ' << res[1] << endl;
		return 0;
	}
	for (int i = 1, j; i <= n; i = j)
	{
		j = i;
		while (j <= n && (num[j] % d + d) % d == (num[i] % d + d) % d)j++;
		solve(i, j - 1);
	}
	cout << res[0] << ' ' << res[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, k, d, num[200007], res[2] = { 1,0 }, st1[200007], st2[200007], tp1, tp2;
int t[800007], tag[800007];
map<int, int>lst;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int mtree(int w, int l, int r)
{
	t[w] = 1e9; tag[w] = 0;
	if (l == r)return 0;
	int mid = (l + r) / 2;
	mtree(2 * w, l, mid);
	mtree(2 * w + 1, mid + 1, r);
	return 0;
}
int down(int w)
{
	if (!tag[w])return 0;
	t[2 * w] += tag[w];
	t[2 * w + 1] += tag[w];
	tag[2 * w] += tag[w];
	tag[2 * w + 1] += tag[w];
	tag[w] = 0;
	return 0;
}
int reset(int w, int l, int r, int x)
{
	if (l == r)
	{
		t[w] = l;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)reset(2 * w, l, mid, x);
	else reset(2 * w + 1, mid + 1, r, x);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] += v;
		tag[w] += v;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int v)
{
	if (l == r)return l;
	int mid = (l + r) / 2;
	if (t[2 * w] <= v)return ask(2 * w, l, mid, v);
	else return ask(2 * w + 1, mid + 1, r, v);
}
int solve(int l, int r)
{
	lst.clear();
	mtree(1, l, r);
	st1[0] = st2[0] = l - 1;
	tp1 = tp2 = 0;
	for (int i = l; i <= r; i++)
	{
		reset(1, l, r, i);

		while (tp1 && num[st1[tp1]] >= num[i])
		{
			change(1, l, r, st1[tp1 - 1] + 1, st1[tp1], num[st1[tp1]] / d);
			tp1--;
		}
		st1[++tp1] = i;
		change(1, l, r, st1[tp1 - 1] + 1, i, -num[i] / d);

		while (tp2 && num[st2[tp2]] <= num[i])
		{
			change(1, l, r, st2[tp2 - 1] + 1, st2[tp2], -num[st2[tp2]] / d);
			tp2--;
		}
		st2[++tp2] = i;
		change(1, l, r, st2[tp2 - 1] + 1, i, num[i] / d);

		if (lst.count(num[i]))change(1, l, r, l, lst[num[i]], 1e9);
		lst[num[i]] = i;
		if (t[1] > i + k)continue;
		int ans = ask(1, l, r, i + k);
		if (i - ans > res[1] - res[0] || (i - ans == res[1] - res[0] && ans < res[0]))
			res[0] = ans, res[1] = i;
	}
	return 0;
}
signed main()
{
	n = read();
	k = read();
	d = read();
	for (int i = 1; i <= n; i++)
		num[i] = read();
	if (d == 0)
	{
		for (int i = 1, j; i <= n; i = j)
		{
			j = i;
			while (j <= n && num[j] == num[i])j++;
			if (j - i > res[1] - res[0] || (j - i == res[1] - res[0] && i < res[0]))
				res[0] = i, res[1] = j - 1;
		}
		cout << res[0] << ' ' << res[1] << endl;
		return 0;
	}
	for (int i = 1, j; i <= n; i = j)
	{
		j = i;
		while (j <= n && (num[j] % d + d) % d == (num[i] % d + d) % d)j++;
		solve(i, j - 1);
	}
	cout << res[0] << ' ' << res[1] << endl;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, k, d, num[200007], res[2], st1[200007], st2[200007], tp1, tp2;
int t[800007], tag[800007];
map<int, int>lst;
int read()
{
	int num = 0, f = 1;
	char c = getchar();
	while ((c < '0' || c>'9') && c != '-')c = getchar();
	if (c == '-')f = -1, c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num * f;
}
int mtree(int w, int l, int r)
{
	t[w] = 1e9; tag[w] = 0;
	if (l == r)return 0;
	int mid = (l + r) / 2;
	mtree(2 * w, l, mid);
	mtree(2 * w + 1, mid + 1, r);
	return 0;
}
int down(int w)
{
	if (!tag[w])return 0;
	t[2 * w] += tag[w];
	t[2 * w + 1] += tag[w];
	tag[2 * w] += tag[w];
	tag[2 * w + 1] += tag[w];
	tag[w] = 0;
	return 0;
}
int reset(int w, int l, int r, int x)
{
	if (l == r)
	{
		t[w] = l;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)reset(2 * w, l, mid, x);
	else reset(2 * w + 1, mid + 1, r, x);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int change(int w, int l, int r, int x, int y, int v)
{
	if (x <= l && r <= y)
	{
		t[w] += v;
		tag[w] += v;
		return 0;
	}
	down(w);
	int mid = (l + r) / 2;
	if (x <= mid)change(2 * w, l, mid, x, y, v);
	if (y > mid)change(2 * w + 1, mid + 1, r, x, y, v);
	t[w] = min(t[2 * w], t[2 * w + 1]);
	return 0;
}
int ask(int w, int l, int r, int v)
{
	if (l == r)return l;
	int mid = (l + r) / 2;
	if (t[2 * w] <= v)return ask(2 * w, l, mid, v);
	else return ask(2 * w + 1, mid + 1, r, v);
}
int solve(int l, int r)
{
	lst.clear();
	mtree(1, l, r);
	st1[0] = st2[0] = l - 1;
	tp1 = tp2 = 0;
	for (int i = l; i <= r; i++)
	{
		reset(1, l, r, i);

		while (tp1 && num[st1[tp1]] >= num[i])
		{
			change(1, l, r, st1[tp1 - 1] + 1, st1[tp1], num[st1[tp1]] / d);
			tp1--;
		}
		st1[++tp1] = i;
		change(1, l, r, st1[tp1 - 1] + 1, i, -num[i] / d);

		while (tp2 && num[st2[tp2]] <= num[i])
		{
			change(1, l, r, st2[tp2 - 1] + 1, st2[tp2], -num[st2[tp2]] / d);
			tp2--;
		}
		st2[++tp2] = i;
		change(1, l, r, st2[tp2 - 1] + 1, i, num[i] / d);

		if (lst.count(num[i]))change(1, l, r, l, lst[num[i]], 1e9);
		lst[num[i]] = i;
		if (t[1] > i + k)continue;
		int ans = ask(1, l, r, i + k);
		if (i - ans > res[1] - res[0] || (i - ans == res[1] - res[0] && ans < res[0]))
			res[0] = ans, res[1] = i;
	}
	return 0;
}
signed main()
{
	n = read();
	k = read();
	d = read();
	for (int i = 1; i <= n; i++)
		num[i] = read();
	if (d == 0)
	{
		for (int i = 1, j; i <= n; i = j)
		{
			j = i;
			while (j <= n && num[j] == num[i])j++;
			if (j - i > res[1] - res[0] || (j - i == res[1] - res[0] && i < res[0]))
				res[0] = i, res[1] = j;
		}
		cout << res[0] << ' ' << res[1] << endl;
		return 0;
	}
	for (int i = 1, j; i <= n; i = j)
	{
		j = i;
		while (j <= n && num[j] % d == num[i] % d)j++;
		solve(i, j - 1);
	}
	cout << res[0] << ' ' << res[1] << endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
int n,k,d;
int a[200010],pre[200010];//ÉÏÒ»¸öÏàµÈµÄÎ»ÖÃ
map<int,int>vis;
int stackmax[200010],stackmin[200010],topmax=0,topmin=0;
struct node{
	int l;
	int r;
	int minn;
	int add;
}tree[800010];
void build(int now,int l,int r){
	tree[now].l=l;
	tree[now].r=r;
	tree[now].minn=1e9;
	tree[now].add=0;
	if(l==r)return;
	int mid=(l+r)/2;
	build(now*2,l,mid);
	build(now*2+1,mid+1,r);
}
void add(int now,int x,int y,int ad){
	int l=tree[now].l;
	int r=tree[now].r;
	if(l==x&&r==y){
		tree[now].add+=ad;
		tree[now].minn+=ad;
		return;
	}
	int mid=(l+r)/2;
	if(tree[now].add){
		add(now*2,l,mid,tree[now].add);
		add(now*2+1,mid+1,r,tree[now].add);
		tree[now].add=0;
	}
	if(y<=mid){
		add(now*2,x,y,ad);
	}
	else if(x>mid){
		add(now*2+1,x,y,ad);
	}
	else{
		add(now*2,x,mid,ad);
		add(now*2+1,mid+1,y,ad);
	}
	tree[now].minn=min(tree[now*2].minn,tree[now*2+1].minn);
}
int check(int now,int x){
	int l=tree[now].l;
	int r=tree[now].r;
	if(l==r)return l;
	int lson=now*2;
	int rson=now*2+1;
	if(tree[lson].minn<=x)return check(lson,x);
	else return check(rson,x);
}
int main(){
	scanf("%d%d%d",&n,&k,&d);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	if(d==0){
		int maxn=0,now=0,l=0,r=0;
		for(int i=1;i<=n;i++){
			if(a[i]!=a[i-1])now=i;
			if(i-now+1>maxn){
				maxn=i-now+1;
				l=now;
				r=i;
			}
		}
		printf("%d %d\n",l,r);
		return 0;
	}
	for(int i=1;i<=n;i++){
		pre[i]=vis[a[i]];
		vis[a[i]]=i;
	}
	int pr=1;
	int maxn=0,l=0,r=0;
	build(1,1,n);
	for(int i=1;i<=n;i++){
		while(pr<=pre[i]||a[pr]%d!=a[i]%d){
			add(1,pr,pr,1e9);
			pr++;
		}
		add(1,i,i,-1e9+i);
		while(topmax>0&&a[stackmax[topmax]]<a[i]){
			add(1,stackmax[topmax-1]+1,stackmax[topmax],a[i]/d-a[stackmax[topmax]]/d);
			topmax--;
		}
		stackmax[++topmax]=i;
		while(topmin>0&&a[stackmin[topmin]]>a[i]){
			add(1,stackmin[topmin-1]+1,stackmin[topmin],a[stackmin[topmin]]/d-a[i]/d);
			topmin--;
		}
		stackmin[++topmin]=i;
		int nowl=check(1,i+k);
		if(i-nowl+1>maxn){
			maxn=i-nowl+1;
			l=nowl;
			r=i;
		}
	}
	printf("%d %d\n",l,r);
	return 0;
}


// Version.20.39.55.05.26.20.
#include <bits/stdc++.h>
#define N 200200
#define ls (pos << 1)
#define rs (pos << 1 | 1)
using namespace std;
typedef long long ll;
const ll INF = 1e17;

int ansl = 1, ansr = 1;
ll mi[N << 2], tg[N << 2];

void build(int l, int r, int pos) {
    tg[pos] = 0;
    if (l == r) return mi[pos] = l, void();
    int mid = (l + r) >> 1;
    build(l, mid, ls), build(mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

void add(int pos, int w) {
    mi[pos] += w, tg[pos] += w;
}

void pushdown(int pos) {
    if (tg[pos]) {
        add(ls, tg[pos]);
        add(rs, tg[pos]);
        tg[pos] = 0;
    }
}

void modify(int L, int R, ll w, int l, int r, int pos) {
    if (L <= l && r <= R) return add(pos, w);
    int mid = (l + r) >> 1;
    pushdown(pos);
    if (L <= mid) modify(L, R, w, l, mid, ls);
    if (mid < R) modify(L, R, w, mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

int query(int w, int l, int r, int pos) {
    if (l == r) return mi[pos] <= w ? l : -1;
    pushdown(pos);
    int mid = (l + r) >> 1;
    return mi[ls] <= w
        ? query(w, l, mid, ls)
        : query(w, mid + 1, r, rs);
}

void chk(int l, int r) {
    if (r - l > ansr - ansl || (r - l == ansr - ansl && l < ansl))
        ansl = l, ansr = r;
}

ll qmin(int x, int l, int r, int pos) {
    if (l == r) return mi[pos];
    int mid = (l + r) >> 1;
    return x <= mid ? qmin(x, l, mid, ls) : qmin(x, mid + 1, r, rs);
}

int smi[N], tmi, smx[N], tmx;
map<int, int> las;

void work(int *a, int n, int m, int dlt) {
    build(1, n, 1);
    tmi = tmx = 0, las.clear();
    int lasi = 1;
    for (int i = 1; i <= n; ++i) {
        while (tmi && a[smi[tmi]] > a[i])
            modify(smi[tmi - 1] + 1, smi[tmi], a[smi[tmi]], 1, n, 1), tmi--;
        modify(smi[tmi] + 1, i, -a[i], 1, n, 1), smi[++tmi] = i;
        while (tmx && a[smx[tmx]] < a[i])
            modify(smx[tmx - 1] + 1, smx[tmx], -a[smx[tmx]], 1, n, 1), tmx--;
        modify(smx[tmx] + 1, i, a[i], 1, n, 1), smx[++tmx] = i;
        if (int tmp = las[a[i]])
            if (lasi <= tmp) modify(lasi, tmp, INF, 1, n, 1), lasi = tmp;
        las[a[i]] = i;
        int l = query(m + i, 1, n, 1);
        // cout << qmin(l, 1, n, 1) << endl;
        assert(l);
        if (l > 0 && l <= i) chk(l + dlt, i + dlt);
    }
}

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    static int n, m, d, a[N];
    cin >> n >> m >> d;
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i);

    if (!d) {
        for (int l = 1, r; l <= n; l = r + 1) {
            for (r = l; r < n && a[r + 1] == a[l]; ++r);
            chk(l, r);
        }
        cout << ansl << " " << ansr << endl;
        return 0;
    }

    for (int l = 1, r; l <= n; l = r + 1) {
        for (r = l; r < n && (a[r + 1] % d + d) % d == (a[l] % d + d) % d; ++r);
        for (int i = l; i <= r; ++i)
            a[i] = (a[i] + INF) / d;
        work(a + l - 1, r - l + 1, m, l - 1);
    }

    cout << ansl << ' ' << ansr << endl;

    return 0;
}


// Version.20.39.55.05.26.20.
#include <bits/stdc++.h>
#define N 200200
#define ls (pos << 1)
#define rs (pos << 1 | 1)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int ansl = 1, ansr = 1;
ll mi[N], tg[N];

void build(int l, int r, int pos) {
    tg[pos] = 0;
    if (l == r) return mi[pos] = l, void();
    int mid = (l + r) >> 1;
    build(l, mid, ls), build(mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

void add(int pos, int w) {
    mi[pos] += w, tg[pos] += w;
}

void pushdown(int pos) {
    if (tg[pos]) {
        add(ls, tg[pos]);
        add(rs, tg[pos]);
        tg[pos] = 0;
    }
}

void modify(int L, int R, int w, int l, int r, int pos) {
    if (L <= l && r <= R) return add(pos, w);
    int mid = (l + r) >> 1;
    pushdown(pos);
    if (L <= mid) modify(L, R, w, l, mid, ls);
    if (mid < R) modify(L, R, w, mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

int query(int w, int l, int r, int pos) {
    if (l == r) return mi[pos] <= w ? l : -1;
    pushdown(pos);
    int mid = (l + r) >> 1;
    return mi[ls] <= w
        ? query(w, l, mid, ls)
        : query(w, mid + 1, r, rs);
}

void chk(int l, int r) {
    if (r - l > ansr - ansl || (r - l == ansr - ansl && l < ansl))
        ansl = l, ansr = r;
}

int smi[N], tmi, smx[N], tmx;
map<int, int> las;

void work(int *a, int n, int m, int dlt) {
    build(1, n, 1);
    tmi = tmx = 0, las.clear();
    for (int i = 1; i <= n; ++i) {
        while (tmi && a[smi[tmi]] >= a[i])
            modify(smi[tmi - 1] + 1, smi[tmi], a[smi[tmi]], 1, n, 1), tmi--;
        modify(smi[tmi] + 1, i, -a[i], 1, n, 1), smi[++tmi] = i;
        while (tmx && a[smx[tmx]] <= a[i])
            modify(smx[tmx - 1] + 1, smx[tmx], -a[smx[tmx]], 1, n, 1), tmx--;
        modify(smx[tmx] + 1, i, a[i], 1, n, 1), smx[++tmx] = i;
        if (int tmp = las[a[i]])
            modify(1, tmp, INF, 1, n, 1);
        las[a[i]] = i;
        int l = query(m + i, 1, n, 1);
        assert(l);
        if (l > 0) chk(l + dlt, i + dlt);
    }
}

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    static int n, m, d, a[N];
    cin >> n >> m >> d;
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i);

    if (!d) {
        for (int l = 1, r; l <= n; l = r + 1) {
            for (r = l; r < n && a[r + 1] == a[l]; ++r);
            chk(l, r);
        }
        cout << ansl << " " << ansr << endl;
        return 0;
    }

    for (int l = 1, r; l <= n; l = r + 1) {
        for (r = l; r < n && (a[r + 1] % d + d) % d == (a[l] % d + d) % d; ++r);
        for (int i = l; i <= r; ++i)
            a[i] = (a[i] + INF) / d;
        work(a + l - 1, r - l + 1, m, l - 1);
    }

    cout << ansl << ' ' << ansr << endl;

    return 0;
}


#include<bits/stdc++.h>
#define INF 0x7fffffff
#define inf 0x3f3f3f3f
#define love const
#define I inline
#define mid (l+r)/2
#define lc (now<<1)
#define rc (now<<1|1)
#define R register
#define lson lc,l,mid
#define int long long
#define rson rc,mid+1,r
#define rep(i,a,b)for(R int i=a;i<=b;i++)
#define per(i,a,b)for(R int i=a;i>=b;i--)
#define pii pair<int ,int >
#define re register
#define love const
#define debug cout<<"%"<<endl;
using namespace std;
namespace IO{
    const int IOsize=1<<21;
    I void read(){};I void Write(){};
    char buf[IOsize],*pa=buf,*pb=buf;
    char buffer[IOsize];int p1=-1;const int p2=(IOsize)-1;
    I char gc(){return pa==pb&&(pb=(pa=buf)+fread(buf,1,IOsize,stdin),pa==pb)?EOF:*pa++;}
    I void gchar(char s){s=gc();for(;!isalpha(s);s=gc());}
    template<typename T,typename... T2>I void read(T &x,T2 &... oth){
        x=0;R short y=0;R char ch=gc();
        for(;!isdigit(ch);ch=gc())y=ch=='-';
        for(;isdigit(ch);ch=gc())x=x*10+(ch^48);
        (y)&&(x=-x);read(oth...);return;}
    I void flush(){fwrite(buffer,1,p1+1,stdout);p1=-1;return;}
    I void pc(int ch){if(p1==p2)flush();buffer[++p1]=ch;return;}
    template<class T>I void write(T x){
        static char buf[20];static short len =-1;
        if(x>=0){do buf[++len]=(x%10)^48,x/=10;while(x);}
        else{pc     ('-');do buf[++len]=(-(x%10))^48,x/=10;while(x);}
        while(len>=0)pc(buf[len--]);return;}
    template<typename T,typename...T2>I void Write(T x,T2... oth){write(x),pc('\n'),Write(oth...);return;}
   }

using namespace IO;
love int N =5e5+50;
int n,m,ans,k,d,pos,vis[N],len1,len2,s[N],g[N],a[N],ans_l,ans_r,b[N];
map<int,int>cnt;
struct  Segment_Tree
{
    struct node{int v,tag;}tr[N<<1];
    I void pushup(int now){tr[now].v=min(tr[lc].v,tr[rc].v);}
  //  I void pushdown(int now, int l,int r);

    I void build(int now ,int l,int r){
        tr[now].v=0;tr[now].tag=0;
        if(l==r)return;
        build(lson);build(rson);
    }
    I void modify(int now ,int l,int r,int lx,int rx,int w){
        if(lx<=l && r<=rx){tr[now].v+=w;tr[now].tag+=w;return;}
        pushdown(now,l,r);
        if(lx<=mid)modify(lson,lx,rx,w);
        if(mid<rx)modify(rson,lx,rx,w);
        pushup(now);
    }
    I void pushdown(int now,int l,int r){
        if(!tr[now].tag)return;
        modify(lson,l,r,tr[now].tag);modify(rson,l,r,tr[now].tag);
        tr[now].tag=0;
    }
    I int find(int now ,int l,int r,int p){
        if(l==r){return tr[now].v<=k?l:-1;}
        pushdown(now,l,r);
        if(tr[lc].v<=k)return find(lson,p);
        if(mid<p)return find(rson,p);
        return -1;
    }
}seg;
I void solve(){
    int len = 1, now = -1, x = 0, pos = 0, L = 1, Ri = 1;
        for(int i = 1; i <= n; i++) {
             x=a[i];
            if(x != now) {
                if(len < i - pos)
                    len = i - pos, L = pos, Ri = i - 1;
                now = x, pos = i;
            }
        } if(len < n - pos + 1) L = pos, Ri = n;
        cout<<L<<" "<<Ri<<endl;
        return ;
}
I void work(int l,int r){
    seg.build(1,1,n);cnt.clear();m=0;len1=0;len2=0;int pos=0;
    rep(i,l,r)b[i-l+1]=a[i]/d;
    m=r-l+1;
    rep(i,1,m){
        int x=b[i];
        if(cnt.count(x)){
            seg.modify(1,1,n,pos+1,cnt[x],1000000000);
            pos=cnt[x];
        }
        seg.modify(1, 1, n, 1, n, -1);
        seg.modify(1, 1, n, i, i, i);
        cnt[x]=i;
        // s equal to max ,g equal to min
        while(len1>=1 && s[len1]<x){
            int pre = s[len1-1];
            seg.modify(1,1,n,pre+1,s[len1],-b[s[len1]]);
            len1--;
        }
        seg.modify(1,1,n,s[len1]+1,i,b[i]);
        s[++len1]=i;
        while(len2>=1 && g[len2]>x){
            int pre =g[len2-1];
            seg.modify(1,1,n,pre+1,g[len2],b[g[len2]]);
            len2--;
        }
        seg.modify(1,1,n,g[len2]+1,i,-b[i]);
        g[++len2]=i;int now =seg.find(1,1,n,i) ;
        if( now !=-1 &&  i-now+1>ans)ans=i-now+1,ans_l=now+l-1,ans_r=i+l-1;
    }
}
signed main(){
    read(n,k,d);int minn=INF;
    rep(i,1,n)read(a[i]),minn=min(minn,a[i]);
    if(!d){
        solve();
        return 0;
    }
    rep(i,1,n)a[i]-=minn-1;
    int now =a[1]%d;int pos=1;
    rep(i,2,n+1)
        if(now != a[i]%d || i==n+1)
            work(pos,i-1),pos=i,now=a[pos]%d;
    cout<<ans_l<<" "<<ans_r<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define INF 0x7fffffff
#define inf 0x3f3f3f3f
#define love const
#define I inline
#define mid (l+r)/2
#define lc (now<<1)
#define rc (now<<1|1)
#define R register
#define lson lc,l,mid
//#define int long long
#define rson rc,mid+1,r
#define rep(i,a,b)for(R int i=a;i<=b;i++)
#define per(i,a,b)for(R int i=a;i>=b;i--)
#define pii pair<int ,int >
#define re register
#define love const
#define debug cout<<"%"<<endl;
using namespace std;
namespace IO{
    const int IOsize=1<<21;
    I void read(){};I void Write(){};
    char buf[IOsize],*pa=buf,*pb=buf;
    char buffer[IOsize];int p1=-1;const int p2=(IOsize)-1;
    I char gc(){return pa==pb&&(pb=(pa=buf)+fread(buf,1,IOsize,stdin),pa==pb)?EOF:*pa++;}
    I void gchar(char s){s=gc();for(;!isalpha(s);s=gc());}
    template<typename T,typename... T2>I void read(T &x,T2 &... oth){
        x=0;R short y=0;R char ch=gc();
        for(;!isdigit(ch);ch=gc())y=ch=='-';
        for(;isdigit(ch);ch=gc())x=x*10+(ch^48);
        (y)&&(x=-x);read(oth...);return;}
    I void flush(){fwrite(buffer,1,p1+1,stdout);p1=-1;return;}
    I void pc(int ch){if(p1==p2)flush();buffer[++p1]=ch;return;}
    template<class T>I void write(T x){
        static char buf[20];static short len =-1;
        if(x>=0){do buf[++len]=(x%10)^48,x/=10;while(x);}
        else{pc     ('-');do buf[++len]=(-(x%10))^48,x/=10;while(x);}
        while(len>=0)pc(buf[len--]);return;}
    template<typename T,typename...T2>I void Write(T x,T2... oth){write(x),pc('\n'),Write(oth...);return;}
   }

using namespace IO;
love int N =2e5;
int n,m,ans,k,d,pos,vis[N],len1,len2,s[N],g[N],a[N],ans_l,ans_r,b[N];
map<int,int>cnt;
struct  Segment_Tree
{
    struct node{int v,tag;}tr[N<<1];
    I void pushup(int now){tr[now].v=min(tr[lc].v,tr[rc].v);}
  //  I void pushdown(int now, int l,int r);

    I void build(int now ,int l,int r){
        tr[now].v=0;tr[now].tag=0;
        if(l==r)return;
        build(lson);build(rson);
    }
    I void modify(int now ,int l,int r,int lx,int rx,int w){
        if(lx<=l && r<=rx){tr[now].v+=w;tr[now].tag+=w;return;}
        pushdown(now,l,r);
        if(lx<=mid)modify(lson,lx,rx,w);
        if(mid<rx)modify(rson,lx,rx,w);
        pushup(now);
    }
    I void pushdown(int now,int l,int r){
        if(!tr[now].tag)return;
        modify(lson,l,r,tr[now].tag);modify(rson,l,r,tr[now].tag);
        tr[now].tag=0;
    }
    I int find(int now ,int l,int r,int p){
        if(l==r){return tr[now].v<=k?l:-1;}
        pushdown(now,l,r);
        if(tr[lc].v<=k)return find(lson,p);
        if(mid<p)return find(rson,p);
        return -1;
    }
}seg;
I void solve(){
    int ans =0;int cnt=0;int now=0;
    ans=1;now=a[1];pos=1;cnt=1;
    rep(i,2,n){
        if(a[i]==now)cnt++,ans=max(ans,cnt);
        else cnt=1,now=a[i];
    }
    ans=max(ans,cnt);
    cout<<ans<<endl;
}
I void work(int l,int r){
    seg.build(1,1,n);cnt.clear();m=0;len1=0;len2=0;int pos=0;
    rep(i,l,r)b[i-l+1]=a[i]/d;
    m=r-l+1;
    rep(i,1,m){
        int x=b[i];
        if(cnt.count(x)){
            seg.modify(1,1,n,pos+1,cnt[x],INF);
            pos=cnt[x];
        }
        seg.modify(1, 1, n, 1, n, -1);
        seg.modify(1, 1, n, i, i, i);
        cnt[x]=i;
        // s equal to max ,g equal to min
        while(len1>=1 && s[len1]<x){
            int pre = s[len1-1];
            seg.modify(1,1,n,pre+1,s[len1],-b[s[len1]]);
            len1--;
        }
        seg.modify(1,1,n,s[len1]+1,i,b[i]);
        s[++len1]=i;
        while(len2>=1 && g[len2]>x){
            int pre =g[len2-1];
            seg.modify(1,1,n,pre+1,g[len2],b[g[len2]]);
            len2--;
        }
        seg.modify(1,1,n,g[len2]+1,i,-b[i]);
        g[++len2]=i;int now =seg.find(1,1,n,i) ;
        if( now !=-1 &&  i-now+1>ans)ans=i-now+1,ans_l=now+l-1,ans_r=i+l-1;
    }
}
signed main(){
    read(n,k,d);int minn=INF;
    rep(i,1,n)read(a[i]),minn=min(minn,a[i]);
    if(!d){
        solve();
        return 0;
    }
    rep(i,1,n)a[i]-=minn-1;
    int now =a[1]%d;int pos=1;
    rep(i,2,n+1)
        if(now != a[i]%d || i==n+1)
            work(pos,i-1),pos=i,now=a[pos]%d;
    cout<<ans_l<<" "<<ans_r<<endl;
    return 0;
}


// Version.20.39.55.05.26.20.
#include <bits/stdc++.h>
#define N 200200
#define ls (pos << 1)
#define rs (pos << 1 | 1)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int ansl = 1, ansr = 1;
ll mi[N], tg[N];

void build(int l, int r, int pos) {
    tg[pos] = 0;
    if (l == r) return mi[pos] = l, void();
    int mid = (l + r) >> 1;
    build(l, mid, ls), build(mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

void add(int pos, int w) {
    mi[pos] += w, tg[pos] += w;
}

void pushdown(int pos) {
    if (tg[pos]) {
        add(ls, tg[pos]);
        add(rs, tg[pos]);
        tg[pos] = 0;
    }
}

void modify(int L, int R, int w, int l, int r, int pos) {
    if (L <= l && r <= R) return add(pos, w);
    int mid = (l + r) >> 1;
    pushdown(pos);
    if (L <= mid) modify(L, R, w, l, mid, ls);
    if (mid < R) modify(L, R, w, mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

int query(int w, int l, int r, int pos) {
    if (l == r) return l;
    int mid = (l + r) >> 1;
    return mi[ls] <= w
        ? query(w, l, mid, ls)
        : query(w, mid + 1, r, rs);
}

void chk(int l, int r) {
    if (r - l > ansr - ansl || (r - l == ansr - ansl && l < ansl))
        ansl = l, ansr = r;
}

int smi[N], tmi, smx[N], tmx;
map<int, int> las;

void work(int *a, int n, int m, int dlt) {
    build(1, n, 1);
    tmi = tmx = 0, las.clear();
    for (int i = 1; i <= n; ++i) {
        while (tmi && a[smi[tmi]] >= a[i])
            modify(smi[tmi - 1] + 1, smi[tmi], a[smi[tmi]], 1, n, 1), tmi--;
        modify(smi[tmi] + 1, i, -a[i], 1, n, 1), smi[++tmi] = i;
        while (tmx && a[smx[tmx]] <= a[i])
            modify(smx[tmx - 1] + 1, smx[tmx], -a[smx[tmx]], 1, n, 1), tmx--;
        modify(smx[tmx] + 1, i, a[i], 1, n, 1), smx[++tmx] = i;
        if (int tmp = las[a[i]])
            modify(1, tmp, INF, 1, n, 1);
        las[a[i]] = i;
        int l = query(m + i, 1, n, 1);
        assert(l);
        chk(l + dlt, i + dlt);
    }
}

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    static int n, m, d, a[N];
    cin >> n >> m >> d;
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i);

    if (!d) {
        for (int l = 1, r; l <= n; l = r + 1) {
            for (r = l; r < n && a[r + 1] == a[l]; ++r);
            chk(l, r);
        }
        cout << ansl << " " << ansr << endl;
        return 0;
    }
    // XXX d = 0's condition

    for (int l = 1, r; l <= n; l = r + 1) {
        for (r = l; r < n && (a[r + 1] % d + d) % d == (a[l] % d + d) % d; ++r);
        for (int i = l; i <= r; ++i)
            a[i] = (a[i] + INF) / d;
        work(a + l - 1, r - l + 1, m, l - 1);
    }

    cout << ansl << ' ' << ansr << endl;

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;

const int maxn=200005;const ll inf=0x3F3F3F3F3F3F3F3Fll;
int n,k,d,A[maxn],Area[maxn],num,hed,til,top1,stk1[maxn],top2,stk2[maxn],ans,ansL,ansR;std::unordered_map<int,int> H;
inline int read()
{
    int ret=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9'){ret=ret*10+ch-'0';ch=getchar();}
    return ret*f;
}
struct SegmentTree
{
    struct Node{ll Mi,Ma,TagMi,TagMa,Val;}Tree[maxn*4];
    void PushUp(int rt)
    {
        Tree[rt].Mi=std::min(Tree[rt*2].Mi,Tree[rt*2+1].Mi);
        Tree[rt].Ma=std::max(Tree[rt*2].Ma,Tree[rt*2+1].Ma);
        Tree[rt].Val=std::min(Tree[rt*2].Val,Tree[rt*2+1].Val);
    }
    void PushDown(int rt)
    {
        Tree[rt*2].Mi+=Tree[rt].TagMi;Tree[rt*2].TagMi+=Tree[rt].TagMi;Tree[rt*2].Val-=Tree[rt].TagMi;
        Tree[rt*2].Ma+=Tree[rt].TagMa;Tree[rt*2].TagMa+=Tree[rt].TagMa;Tree[rt*2].Val+=Tree[rt].TagMa;
        Tree[rt*2+1].Mi+=Tree[rt].TagMi;Tree[rt*2+1].TagMi+=Tree[rt].TagMi;Tree[rt*2+1].Val-=Tree[rt].TagMi;
        Tree[rt*2+1].Ma+=Tree[rt].TagMa;Tree[rt*2+1].TagMa+=Tree[rt].TagMa;Tree[rt*2+1].Val+=Tree[rt].TagMa;
        Tree[rt].TagMi=Tree[rt].TagMa=0;
    }
    void RangeUpdateMin(int ll,int RR,int delta,int L=1,int R=n,int rt=1)
    {
        if(ll<=L&&R<=RR){Tree[rt].Mi+=delta;Tree[rt].TagMi+=delta;Tree[rt].Val-=delta;return;}
        PushDown(rt);
        int M=(L+R)/2;
        if(ll<=M) RangeUpdateMin(ll,RR,delta,L,M,rt*2);
        if(M<RR) RangeUpdateMin(ll,RR,delta,M+1,R,rt*2+1);
        PushUp(rt);
    }
    void RangeUpdateMax(int ll,int RR,int delta,int L=1,int R=n,int rt=1)
    {
        if(ll<=L&&R<=RR){Tree[rt].Ma+=delta;Tree[rt].TagMa+=delta;Tree[rt].Val+=delta;return;}
        PushDown(rt);
        int M=(L+R)/2;
        if(ll<=M) RangeUpdateMax(ll,RR,delta,L,M,rt*2);
        if(M<RR) RangeUpdateMax(ll,RR,delta,M+1,R,rt*2+1);
        PushUp(rt);
    }
    void Delete(int P,int L=1,int R=n,int rt=1)
    {
        if(L==P&&R==P){Tree[rt].Val=inf;return;}
        PushDown(rt);
        int M=(L+R)/2;
        if(P<=M) Delete(P,L,M,rt*2);
        if(M<P) Delete(P,M+1,R,rt*2+1);
        PushUp(rt);
    }
    void Build(int L=1,int R=n,int rt=1)
    {
        if(L==R){Tree[rt].Val=L;Tree[rt].Mi=Tree[rt].Ma=A[L];return;}
        int M=(L+R)/2;
        Build(L,M,rt*2);
        Build(M+1,R,rt*2+1);
        PushUp(rt);
    }
    ll Query(int num,int L=1,int R=n,int rt=1)
    {
        if(L==R) return L;
        int M=(L+R)/2;
        PushDown(rt);
        if(Tree[rt*2].Val<=num) return Query(num,L,M,rt*2);
        else return Query(num,M+1,R,rt*2+1);
    }
}T;
int main()
{
    n=read();k=read();d=read();
    for(int i=1;i<=n;i++) A[i]=read()+1000000000;
    if(!d)
    {
        for(int i=1,j;i<=n;)
        {
            j=i;
            while(j<n&&A[j+1]==A[i]) j++;
            if(j-i+1>ans){ans=j-i+1;ansL=i;ansR=j;}
            i=j+1;
        }
        printf("%d %d\n",ansL,ansR);
        return 0;
    }
    for(int i=1;i<=n;)
    {
        int j=i;Area[i]=i;
        while(j<n&&A[j+1]%d==A[i]%d){j++;Area[j]=i;}
        i=j+1;
    }
    til=1;T.Build();
    while(hed<n)
    {
        hed++;H[A[hed]]++;
        while(H[A[hed]]>1||Area[hed]!=Area[til]){T.Delete(til);H[A[til]]--;til++;}
        while(top1>0&&A[hed]<=A[stk1[top1]])
        {
            T.RangeUpdateMin(stk1[top1-1]+1,stk1[top1],A[hed]/d-A[stk1[top1]]/d);
            top1--;
        }
        stk1[++top1]=hed;
        while(top2>0&&A[hed]>=A[stk2[top2]])
        {
            T.RangeUpdateMax(stk2[top2-1]+1,stk2[top2],A[hed]/d-A[stk2[top2]]/d);
            top2--;
        }
        stk2[++top2]=hed;
        ll L=T.Query(hed+k);
        if(L>=til&&hed-L+1>ans){ans=hed-L+1;ansL=L;ansR=hed;}
    }
    printf("%d %d\n",ansL,ansR);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
const int N=2e5+10;
const int M=1000000000;
const int INF=1e18;
int a[N],b[N],s1[N],s2[N];
int n,m,k,d,top1,top2,ansr,ansl,sum[N],pos[N],t[N],mn[N];
map<int,int>mp;
void reset(int x){
	mn[x]=INF;
	for(int i=(x-1)*m+1;i<=min(n,x*m);i++) mn[x]=min(mn[x],t[i]+sum[x]);
}
inline void add(int l,int r,int c){
	for(int i=l;i<=min(r,pos[l]*m);i++) t[i]+=c;
	reset(pos[l]);
	if(pos[l]!=pos[r]){
		for(int i=(pos[r]-1)*m+1;i<=min(n,r);i++) t[i]+=c;
		reset(pos[r]);
	}
	for(int i=pos[l]+1;i<=pos[r]-1;i++) sum[i]+=c,mn[i]+=c;
}
inline int query(int l,int r,int c){
	for(int i=r;i>=max((pos[r]-1)*m+1,l);i--)
		if(t[i]+sum[pos[i]]<=c){ return i;}

	for(int i=pos[r]-1;i>=pos[l]+1;i--)
		if(mn[i]<=c)
			for(int j=i*m;j>=(i-1)*m+1;j--)
				if(t[j]+sum[pos[j]]<=c) {return j;}
	if(pos[l]!=pos[r]){
		for(int i=pos[l]*m;i>=l;i--) {
			if(t[i]+sum[pos[i]]<=c)return i;
		}
	}
}
inline void sol(int L,int R){
	if(L==R) return ;
	mp.clear();int r=R+1;
	top1=top2=0;s1[top1]=s2[top2]=R+1;
	for(int i=0;i<=pos[n];i++) sum[i]=0;
	for(int i=R;i>=L;i--){
		if(mp.count(a[i])) r=min(r,mp[a[i]]);
		while(top1 && a[i]>a[s1[top1]]){
			add(s1[top1],s1[top1-1]-1,-a[s1[top1]]);
			top1--;
		}
		s1[++top1]=i;
		add(s1[top1],s1[top1-1]-1,a[s1[top1]]);
		while(top2 && a[i]<a[s2[top2]]){
			add(s2[top2],s2[top2-1]-1,a[s2[top2]]);
			top2--;
		}
		s2[++top2]=i;
		add(s2[top2],s2[top2-1]-1,-a[s2[top2]]);
		int rr=query(i,r-1,k-i);
		if(rr-i>ansr-ansl || (rr-i==ansr-ansl && i<ansl) ) ansl=i,ansr=rr;
		mp[a[i]]=i;
	}
	return ;
}
int main(){
	scanf("%d%d%d",&n,&k,&d);
	if(d==0){
		for(int i=1;i<=n;i++) scanf("%d",&a[i]);
		int ansl=1;int ansr=1;int lst=1;
		for(int i=2;i<=n;i++){
			if(a[i]!=a[lst]){
				if(i-1-lst>ansr-ansl){ansl=lst;ansr=i-1;}
				lst=i;
			}
		}
		printf("%d %d\n",ansl,ansr);
		return 0;
	}
	ansl=n+1;ansr=0;m=sqrt(n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		b[i]=(a[i]+=M)%d;a[i]=(a[i])/d+1;
		pos[i]=(i-1)/m+1;t[i]=-i;
	}
	for(int i=1,j;i<=n;i=j){
		for(j=i+1;j<=n;j++){
			if(b[i]!=b[j]) break;
		}
		sol(i,j-1);
	}
	printf("%d %d\n",ansl,ansr);
	return 0;
}


// Version.20.39.55.05.26.20.
#include <bits/stdc++.h>
#define N 200200
#define ls (pos << 1)
#define rs (pos << 1 | 1)
using namespace std;
typedef long long ll;
const ll INF = 1e15;

int ansl = 1, ansr = 1;
ll mi[N << 2], tg[N << 2];

void build(int l, int r, int pos) {
    tg[pos] = 0;
    if (l == r) return mi[pos] = l, void();
    int mid = (l + r) >> 1;
    build(l, mid, ls), build(mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

void add(int pos, int w) {
    mi[pos] += w, tg[pos] += w;
}

void pushdown(int pos) {
    if (tg[pos]) {
        add(ls, tg[pos]);
        add(rs, tg[pos]);
        tg[pos] = 0;
    }
}

void modify(int L, int R, ll w, int l, int r, int pos) {
    if (L <= l && r <= R) return add(pos, w);
    int mid = (l + r) >> 1;
    pushdown(pos);
    if (L <= mid) modify(L, R, w, l, mid, ls);
    if (mid < R) modify(L, R, w, mid + 1, r, rs);
    mi[pos] = min(mi[ls], mi[rs]);
}

int query(int w, int l, int r, int pos) {
    if (l == r) return mi[pos] <= w ? l : -1;
    pushdown(pos);
    int mid = (l + r) >> 1;
    return mi[ls] <= w
        ? query(w, l, mid, ls)
        : query(w, mid + 1, r, rs);
}

void chk(int l, int r) {
    if (r - l > ansr - ansl || (r - l == ansr - ansl && l < ansl))
        ansl = l, ansr = r;
}

ll qmin(int x, int l, int r, int pos) {
    if (l == r) return mi[pos];
    int mid = (l + r) >> 1;
    return x <= mid ? qmin(x, l, mid, ls) : qmin(x, mid + 1, r, rs);
}

int smi[N], tmi, smx[N], tmx;
map<int, int> las;

void work(int *a, int n, int m, int dlt) {
    build(1, n, 1);
    tmi = tmx = 0, las.clear();
    int lasi = 1;
    for (int i = 1; i <= n; ++i) {
        while (tmi && a[smi[tmi]] > a[i])
            modify(smi[tmi - 1] + 1, smi[tmi], a[smi[tmi]], 1, n, 1), tmi--;
        modify(smi[tmi] + 1, i, -a[i], 1, n, 1), smi[++tmi] = i;
        while (tmx && a[smx[tmx]] < a[i])
            modify(smx[tmx - 1] + 1, smx[tmx], -a[smx[tmx]], 1, n, 1), tmx--;
        modify(smx[tmx] + 1, i, a[i], 1, n, 1), smx[++tmx] = i;
        if (int tmp = las[a[i]])
            if (lasi <= tmp) modify(lasi, tmp, INF, 1, n, 1), lasi = tmp;
        las[a[i]] = i;
        int l = query(m + i, 1, n, 1);
        // cout << qmin(l, 1, n, 1) << endl;
        assert(l);
        if (l > 0 && l <= i) chk(l + dlt, i + dlt);
    }
}

int main() {
#ifdef isLOCAL
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif

    static int n, m, d, a[N];
    cin >> n >> m >> d;
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i);

    if (!d) {
        for (int l = 1, r; l <= n; l = r + 1) {
            for (r = l; r < n && a[r + 1] == a[l]; ++r);
            chk(l, r);
        }
        cout << ansl << " " << ansr << endl;
        return 0;
    }

    for (int l = 1, r; l <= n; l = r + 1) {
        for (r = l; r < n && (a[r + 1] % d + d) % d == (a[l] % d + d) % d; ++r);
        for (int i = l; i <= r; ++i)
            a[i] = (a[i] + INF) / d;
        work(a + l - 1, r - l + 1, m, l - 1);
    }

    cout << ansl << ' ' << ansr << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define next Next
#define int long long
#define mid (l+r)/2
const int N=1e6+5;
int n,m,k,d,ans,l,r,top1,top2,ansL,ansR,a[N],zuo[N],gs[N],zhan1[N],zhan2[N];
int mi[N*4],ma[N*4],tree[N*4],tag1[N*4],tag2[N*4];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
void pushup(int nod)
{
	mi[nod]=min(mi[nod*2],mi[nod*2+1]);
	ma[nod]=max(ma[nod*2],ma[nod*2+1]);
	tree[nod]=min(tree[nod*2],tree[nod*2+1]);
}
void pushdown(int nod)
{
	mi[nod*2]+=tag1[nod];tag1[nod*2]+=tag1[nod];
	mi[nod*2+1]+=tag1[nod];tag1[nod*2+1]+=tag1[nod];
	tag1[nod]=0;
	ma[nod*2]+=tag2[nod];tag2[nod*2]+=tag2[nod];
	ma[nod*2+1]+=tag2[nod];tag2[nod*2+1]+=tag2[nod];
	tag2[nod]=0;
}
void build(int nod,int l,int r)
{
	if(l==r)
	{
		tree[nod]=l;
		mi[nod]=ma[nod]=a[l];
		return;
	}
	build(nod*2,l,mid);
	build(nod*2+1,mid+1,r);
	pushup(nod);
}
int find(int nod,int l,int r,int x)
{
	if(l==r)return l;
	pushdown(nod);
	if(tree[nod*2]<=x)return find(nod*2,l,mid,x);
	else return find(nod*2+1,mid+1,r,x);
}
void del(int nod,int l,int r,int x)
{
	if(l==r){tree[nod]=1e15;return;}
	if(x<=mid)del(nod*2,l,mid,x);
	else del(nod*2+1,mid+1,r,x);
	pushup(nod);
}
void change1(int nod,int l,int r,int L,int R,int val)
{
	if(l==L&&r==R)
	{
		mi[nod]+=val;
		tag1[nod]+=val;
		tree[nod]-=val;
		return;
	}
	pushdown(nod);
	if(R<=mid)change1(nod*2,l,mid,L,R,val);
	else if(L>mid)change1(nod*2+1,mid+1,r,L,R,val);
	else{
		change1(nod*2,l,mid,L,mid,val);
		change1(nod*2+1,mid+1,r,mid+1,R,val);
	}
	pushup(nod);
}
void change2(int nod,int l,int r,int L,int R,int val)
{
	if(l==L&&r==R)
	{
		ma[nod]+=val;
		tag2[nod]+=val;
		tree[nod]+=val;
		return;
	}
	pushdown(nod);
	if(R<=mid)change2(nod*2,l,mid,L,R,val);
	else if(L>mid)change2(nod*2+1,mid+1,r,L,R,val);
	else{
		change2(nod*2,l,mid,L,mid,val);
		change2(nod*2+1,mid+1,r,mid+1,R,val);
	}
	pushup(nod);
}
signed main()
{
	n=read();k=read();d=read();
	for(int i=1;i<=n;i++)a[i]=read();
	if(!d)
    {
        for(int i=1,j;i<=n;)
        {
            j=i;
            while(j<n&&a[j+1]==a[i])j++;
            if(j-i+1>ans){ans=j-i+1;ansL=i;ansR=j;}
            i=j+1;
        }
        printf("%lld %lld\n",ansL,ansR);
        return 0;
    }
	for(int i=1;i<=n;)
    {
        int j=i;
		zuo[i]=i;
        while(j<n&&a[j+1]%d==a[i]%d){j++;zuo[j]=i;}
        i=j+1;
    }
    build(1,1,n);
    while(l<n)
    {
        l++;gs[a[l]]++;
        while(gs[a[l]]>1||zuo[l]!=zuo[r])
		{
			del(1,1,n,r);
			gs[a[r]]--;
			r++;
		}
        while(top1>0&&a[l]<=a[zhan1[top1]])
        {
            change1(1,1,n,zhan1[top1-1]+1,zhan1[top1],a[l]/d-a[zhan1[top1]]/d);
            top1--;
        }
        zhan1[++top1]=l;
        while(top2>0&&a[l]>=a[zhan2[top2]])
        {
            change2(1,1,n,zhan2[top2-1]+1,zhan2[top2],a[l]/d-a[zhan2[top2]]/d);
            top2--;
        }
        zhan2[++top2]=l;
        int L=find(1,1,n,l+k);
        if(L>=r&&l-L+1>ans)
		{
			ans=l-L+1;
			ansL=L;ansR=l;
		}
    }
    printf("%lld %lld\n",ansL,ansR);
    return 0;
}
/*
*/


#include<map>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=200005;const LL inf=0x3F3F3F3F3F3F3F3Fll;
int n,k,d,A[maxn],Area[maxn],num,hed,til,top1,stk1[maxn],top2,stk2[maxn],ans,ansL,ansR;map<int,int> H;
inline int read()
{
	int ret=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9'){ret=ret*10+ch-'0';ch=getchar();}
	return ret*f;
}
struct SegmentTree
{
	struct Node{LL Mi,Ma,TagMi,TagMa,Val;}Tree[maxn*4];
	void PushUp(int rt)
	{
		Tree[rt].Mi=min(Tree[rt*2].Mi,Tree[rt*2+1].Mi);
		Tree[rt].Ma=max(Tree[rt*2].Ma,Tree[rt*2+1].Ma);
		Tree[rt].Val=min(Tree[rt*2].Val,Tree[rt*2+1].Val);
	}
	void PushDown(int rt)
	{
		Tree[rt*2].Mi+=Tree[rt].TagMi;Tree[rt*2].TagMi+=Tree[rt].TagMi;Tree[rt*2].Val-=Tree[rt].TagMi;
		Tree[rt*2].Ma+=Tree[rt].TagMa;Tree[rt*2].TagMa+=Tree[rt].TagMa;Tree[rt*2].Val+=Tree[rt].TagMa;
		Tree[rt*2+1].Mi+=Tree[rt].TagMi;Tree[rt*2+1].TagMi+=Tree[rt].TagMi;Tree[rt*2+1].Val-=Tree[rt].TagMi;
		Tree[rt*2+1].Ma+=Tree[rt].TagMa;Tree[rt*2+1].TagMa+=Tree[rt].TagMa;Tree[rt*2+1].Val+=Tree[rt].TagMa;
		Tree[rt].TagMi=Tree[rt].TagMa=0;
	}
	void RangeUpdateMin(int LL,int RR,int delta,int L=1,int R=n,int rt=1)
	{
		if(LL<=L&&R<=RR){Tree[rt].Mi+=delta;Tree[rt].TagMi+=delta;Tree[rt].Val-=delta;return;}
		PushDown(rt);
		int M=(L+R)/2;
		if(LL<=M) RangeUpdateMin(LL,RR,delta,L,M,rt*2);
		if(M<RR) RangeUpdateMin(LL,RR,delta,M+1,R,rt*2+1);
		PushUp(rt);
	}
	void RangeUpdateMax(int LL,int RR,int delta,int L=1,int R=n,int rt=1)
	{
		if(LL<=L&&R<=RR){Tree[rt].Ma+=delta;Tree[rt].TagMa+=delta;Tree[rt].Val+=delta;return;}
		PushDown(rt);
		int M=(L+R)/2;
		if(LL<=M) RangeUpdateMax(LL,RR,delta,L,M,rt*2);
		if(M<RR) RangeUpdateMax(LL,RR,delta,M+1,R,rt*2+1);
		PushUp(rt);
	}
	void Delete(int P,int L=1,int R=n,int rt=1)
	{
		if(L==P&&R==P){Tree[rt].Val=inf;return;}
		PushDown(rt);
		int M=(L+R)/2;
		if(P<=M) Delete(P,L,M,rt*2);
		if(M<P) Delete(P,M+1,R,rt*2+1);
		PushUp(rt);
	}
	void Build(int L=1,int R=n,int rt=1)
	{
		if(L==R){Tree[rt].Val=L;Tree[rt].Mi=Tree[rt].Ma=A[L];return;}
		int M=(L+R)/2;
		Build(L,M,rt*2);
		Build(M+1,R,rt*2+1);
		PushUp(rt);
	}
	LL Query(int num,int L=1,int R=n,int rt=1)
	{
		if(L==R) return L;
		int M=(L+R)/2;
		PushDown(rt);
		if(Tree[rt*2].Val<=num) return Query(num,L,M,rt*2);
		else return Query(num,M+1,R,rt*2+1);
	}
}T;
int main()
{
	n=read();k=read();d=read();
	for(int i=1;i<=n;i++) A[i]=read()+1000000000;
	if(!d)
	{
		for(int i=1,j;i<=n;)
		{
			j=i;
			while(j<n&&A[j+1]==A[i]) j++;
			if(j-i+1>ans){ans=j-i+1;ansL=i;ansR=j;}
			i=j+1;
		}
		printf("%d %d\n",ansL,ansR);
		return 0;
	}
	for(int i=1;i<=n;)
	{
		int j=i;Area[i]=i;
		while(j<n&&A[j+1]%d==A[i]%d){j++;Area[j]=i;}
		i=j+1;
	}
	til=1;T.Build();
	while(hed<n)
	{
		hed++;H[A[hed]]++;
		while(H[A[hed]]>1||Area[hed]!=Area[til]){T.Delete(til);H[A[til]]--;til++;}
		while(top1>0&&A[hed]<=A[stk1[top1]])
		{
			T.RangeUpdateMin(stk1[top1-1]+1,stk1[top1],A[hed]/d-A[stk1[top1]]/d);
			top1--;
		}
		stk1[++top1]=hed;
		while(top2>0&&A[hed]>=A[stk2[top2]])
		{
			T.RangeUpdateMax(stk2[top2-1]+1,stk2[top2],A[hed]/d-A[stk2[top2]]/d);
			top2--;
		}
		stk2[++top2]=hed;
		LL L=T.Query(hed+k);
		if(L>=til&&hed-L+1>ans){ans=hed-L+1;ansL=L;ansR=hed;}
	}
	printf("%d %d\n",ansL,ansR);
	return 0;
}


#include<bits/stdc++.h>
#define INF 0x7fffffff
#define inf 0x3f3f3f3f
#define love const
#define I inline
#define mid (l+r)/2
#define lc (now<<1)
#define rc (now<<1|1)
#define R register
#define lson lc,l,mid
#define int long long
#define rson rc,mid+1,r
#define rep(i,a,b)for(R int i=a;i<=b;i++)
#define per(i,a,b)for(R int i=a;i>=b;i--)
#define pii pair<int ,int >
#define re register
#define love const
#define debug cout<<"%"<<endl;
using namespace std;
namespace IO{
    const int IOsize=1<<21;
    I void read(){};I void Write(){};
    char buf[IOsize],*pa=buf,*pb=buf;
    char buffer[IOsize];int p1=-1;const int p2=(IOsize)-1;
    I char gc(){return pa==pb&&(pb=(pa=buf)+fread(buf,1,IOsize,stdin),pa==pb)?EOF:*pa++;}
    I void gchar(char s){s=gc();for(;!isalpha(s);s=gc());}
    template<typename T,typename... T2>I void read(T &x,T2 &... oth){
        x=0;R short y=0;R char ch=gc();
        for(;!isdigit(ch);ch=gc())y=ch=='-';
        for(;isdigit(ch);ch=gc())x=x*10+(ch^48);
        (y)&&(x=-x);read(oth...);return;}
    I void flush(){fwrite(buffer,1,p1+1,stdout);p1=-1;return;}
    I void pc(int ch){if(p1==p2)flush();buffer[++p1]=ch;return;}
    template<class T>I void write(T x){
        static char buf[20];static short len =-1;
        if(x>=0){do buf[++len]=(x%10)^48,x/=10;while(x);}
        else{pc     ('-');do buf[++len]=(-(x%10))^48,x/=10;while(x);}
        while(len>=0)pc(buf[len--]);return;}
    template<typename T,typename...T2>I void Write(T x,T2... oth){write(x),pc('\n'),Write(oth...);return;}
   }

using namespace IO;
love int N =5e5+50;
int n,m,ans,k,d,pos,vis[N],len1,len2,s[N],g[N],a[N],ans_l,ans_r,b[N];
map<int,int>cnt;
struct  Segment_Tree
{
    struct node{int v,tag;}tr[N<<1];
    I void pushup(int now){tr[now].v=min(tr[lc].v,tr[rc].v);}
  //  I void pushdown(int now, int l,int r);

    I void build(int now ,int l,int r){
        tr[now].v=0;tr[now].tag=0;
        if(l==r)return;
        build(lson);build(rson);
    }
    I void modify(int now ,int l,int r,int lx,int rx,int w){
        if(lx<=l && r<=rx){tr[now].v+=w;tr[now].tag+=w;return;}
        pushdown(now,l,r);
        if(lx<=mid)modify(lson,lx,rx,w);
        if(mid<rx)modify(rson,lx,rx,w);
        pushup(now);
    }
    I void pushdown(int now,int l,int r){
        if(!tr[now].tag)return;
        modify(lson,l,r,tr[now].tag);modify(rson,l,r,tr[now].tag);
        tr[now].tag=0;
    }
    I int find(int now ,int l,int r,int p){
        if(l==r){return tr[now].v<=k?l:-1;}
        pushdown(now,l,r);
        if(tr[lc].v<=k)return find(lson,p);
        if(mid<p)return find(rson,p);
        return -1;
    }
}seg;
I void solve(){
    int len = 1, now = -1, x = 0, pos = 0, L = 1, Ri = 1;
        for(int i = 1; i <= n; i++) {
             x=a[i];
            if(x != now) {
                if(len < i - pos)
                    len = i - pos, L = pos, Ri = i - 1;
                now = x, pos = i;
            }
        } if(len < n - pos + 1) L = pos, Ri = n;
        cout<<L<<" "<<Ri<<endl;
        return ;
}
I void work(int l,int r){
    seg.build(1,1,n);cnt.clear();m=0;len1=0;len2=0;int pos=0;
    rep(i,l,r)b[i-l+1]=a[i]/d;
    m=r-l+1;
    rep(i,1,m){
        int x=b[i];
        if(cnt.count(x)){
            seg.modify(1,1,n,pos+1,cnt[x],1000000000);
            pos=cnt[x];
        }
        seg.modify(1, 1, n, 1, n, -1);
        seg.modify(1, 1, n, i, i, i);
        cnt[x]=i;
        // s equal to max ,g equal to min
        while(len1>=1 && s[len1]<x){
            int pre = s[len1-1];
            seg.modify(1,1,n,pre+1,s[len1],-b[s[len1]]);
            len1--;
        }
        seg.modify(1,1,n,s[len1]+1,i,x);
        s[++len1]=i;
        while(len2>=1 && g[len2]>x){
            int pre =g[len2-1];
            seg.modify(1,1,n,pre+1,g[len2],b[g[len2]]);
            len2--;
        }
        seg.modify(1,1,n,g[len2]+1,i,-x);
        g[++len2]=i;int now =seg.find(1,1,n,i) ;
        if( (~now) &&  i-now+1>ans)ans=i-now+1,ans_l=now+l-1,ans_r=i+l-1;
    }
}
signed main(){
    read(n,k,d);int minn=2147483647;
    rep(i,1,n)read(a[i]),minn=min(minn,a[i]);
    if(!d){
        solve();
        return 0;
    }
    rep(i,1,n)a[i]-=minn-1  ;
    int now =a[1]%d;int pos=1;
    rep(i,2,n+1)
        if(now != a[i]%d || i==n+1)
            work(pos,i-1),pos=i,now=a[pos]%d;
    cout<<ans_l<<" "<<ans_r<<endl;
    return 0;
}


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R = -1, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void refresh() {
	Map.clear();
	memset(seg, 0, sizeof seg);
	memset(lazy, 0, sizeof lazy);
	mx.clear();
	mn.clear();
}

void shift (int id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	int mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

int get (int s = 0, int e = ind, int id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	int mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] = (Brr[i] - (Brr[i] % d + d) % d) / d;

	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);

		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			int en = 0;
			if (1 < mn.size())
				en = mn[mn.size() - 2] + 1;

			add(en, mn.back() + 1, +Brr[mn.back()] - Brr[i]);
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			int en = 0;
			if (1 < mx.size())
				en = mx[mx.size() - 2] + 1;

			add(en, mx.back() + 1, -Brr[mx.back()] + Brr[i]);
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k >> d;
	for (ll i = 0; i < n; i++)
		cin >> Arr[i];

	if (d == 0) {
		ind = 0;
		for (int i = 1; i < n; i++) {
			if (Arr[i] == Arr[i - 1])
				continue;

			if (i - ind > R - L) {
				R = i + 1;
				L = ind + 1;
			}

			ind = i;
		}

		if (n - 1 - ind > R - L) {
			R = n;
			L = ind + 1;
		}
		cout << L << " " << R << "\n";
		return 0;
	}
	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if ((Arr[i] % d + d) % d == (Arr[i - 1] % d + d) % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	cout << L << " " << R << "\n";
	return 0;
}

// 12:37 start;


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void refresh() {
	Map.clear();
	memset(seg, 0, sizeof seg);
	memset(lazy, 0, sizeof lazy);
	mx.clear();
	mn.clear();
}

void shift (int id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	int mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
}

int get (int s = 0, int e = n, int id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	int mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] /= d;

	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);
		ll en = i;
		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			add(mn.back(), en, +Brr[mn.back()] - Brr[i]);
			en = mn.back();
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		en = i;
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			add(mx.back(), en, -Brr[mn.back()] + Brr[i]);
			en = mx.back();
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k >> d;
	for (ll i = 0; i < n; i++)
		cin >> Arr[i];

	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if (Arr[i] % d == Arr[i - 1] % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	cout << L << " " << R << "\n";
	return 0;
}

// 12:37 start;


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R = -1, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void build (int s = 0, int e = ind, int id = 1) {
	if (e - s == 1) {
		seg[id] = lazy[id] = 0;
		return ;
	}

	int mid = e + s >> 1;
	build(s, mid, id << 1);
	build(mid, e, id << 1 | 1);
	seg[id] = lazy[id] = 0;
}

void refresh() {
	Map.clear();
	mx.clear();
	mn.clear();
}

void shift (ll id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	ll mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

ll get (ll s = 0, ll e = ind, ll id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	ll mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] = (Brr[i] - (Brr[i] % d + d) % d) / d;

	build();
	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);

		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			ll en = 0;
			if (1 < mn.size())
				en = mn[mn.size() - 2] + 1;

			add(en, mn.back() + 1, +Brr[mn.back()] - Brr[i]);
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			ll en = 0;
			if (1 < mx.size())
				en = mx[mx.size() - 2] + 1;

			add(en, mx.back() + 1, -Brr[mx.back()] + Brr[i]);
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	scanf("%lld %lld %lld", &n, &k, &d);
	for (ll i = 0; i < n; i++)
		scanf("%lld", &Arr[i]);

	if (d == 0) {
		ind = 0;
		for (ll i = 1; i < n; i++) {
			if (Arr[i] == Arr[i - 1])
				continue;

			if (i - 1 - ind > R - L) {
				R = i;
				L = ind + 1;
			}

			ind = i;
		}

		if (n - 1 - ind > R - L) {
			R = n;
			L = ind + 1;
		}
		printf("%lld %lld", L, R);
		return 0;
	}
	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if ((Arr[i] % d + d) % d == (Arr[i - 1] % d + d) % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	printf("%lld %lld", L, R);
	return 0;
}

// 12:37 start;


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R = -1, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void refresh() {
	Map.clear();
	memset(seg, 0, sizeof seg);
	memset(lazy, 0, sizeof lazy);
	mx.clear();
	mn.clear();
}

void shift (int id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	int mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

int get (int s = 0, int e = ind, int id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	int mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] = (Brr[i] - (Brr[i] % d + d) % d) / d;

	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);

		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			int en = 0;
			if (1 < mn.size())
				en = mn[mn.size() - 2] + 1;

			add(en, mn.back() + 1, +Brr[mn.back()] - Brr[i]);
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			int en = 0;
			if (1 < mx.size())
				en = mx[mx.size() - 2] + 1;

			add(en, mx.back() + 1, -Brr[mx.back()] + Brr[i]);
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k >> d;
	for (ll i = 0; i < n; i++)
		cin >> Arr[i];

	if (d == 0) {
		ind = 0;
		for (int i = 1; i < n; i++) {
			if (Arr[i] == Arr[i - 1])
				continue;

			if (i - 1 - ind > R - L) {
				R = i;
				L = ind + 1;
			}

			ind = i;
		}

		if (n - 1 - ind > R - L) {
			R = n;
			L = ind + 1;
		}
		cout << L << " " << R << "\n";
		return 0;
	}
	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if ((Arr[i] % d + d) % d == (Arr[i - 1] % d + d) % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	cout << L << " " << R << "\n";
	return 0;
}

// 12:37 start;


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R = -1, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void refresh() {
	Map.clear();
	memset(seg, 0, sizeof seg);
	memset(lazy, 0, sizeof lazy);
	mx.clear();
	mn.clear();
}

void shift (int id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	int mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

int get (int s = 0, int e = ind, int id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	int mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] = (Brr[i] - (Brr[i] % d + d) % d) / d;

	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);

		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			int en = 0;
			if (1 < mn.size())
				en = mn[mn.size() - 2] + 1;

			add(en, mn.back() + 1, +Brr[mn.back()] - Brr[i]);
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			int en = 0;
			if (1 < mx.size())
				en = mx[mx.size() - 2] + 1;

			add(en, mx.back() + 1, -Brr[mx.back()] + Brr[i]);
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> k >> d;
	for (ll i = 0; i < n; i++)
		cin >> Arr[i];

	if (d == 0) {
		ind = 0;
		for (int i = 1; i < n; i++) {
			if (Arr[i] == Arr[i - 1])
				continue;

			if (i - ind > R - L) {
				R = i;
				L = ind + 1;
			}

			ind = i;
		}

		if (n - 1 - ind > R - L) {
			R = n;
			L = ind + 1;
		}
		cout << L << " " << R << "\n";
		return 0;
	}
	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if ((Arr[i] % d + d) % d == (Arr[i - 1] % d + d) % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	cout << L << " " << R << "\n";
	return 0;
}

// 12:37 start;


#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

typedef long long ll;

inline char nc() {
    static char buf[200000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,200000,stdin),p1==p2)?EOF:*p1++;
}
ll rd() {
    ll x=0; char ch=nc();
    while(ch<'0'||ch>'9') ch=nc();
    while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=nc();
    return x;
}

const ll MAX_N = 2e5 + 10, inf = 1e9 + 7;
ll n, k, d, L, R = -1, ind, S;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll seg[MAX_N << 2];
ll lazy[MAX_N << 2];
unordered_map <ll, ll> Map;
vector <ll> mx, mn;

void refresh() {
	Map.clear();
	memset(seg, 0, sizeof seg);
	memset(lazy, 0, sizeof lazy);
	mx.clear();
	mn.clear();
}

void shift (ll id) {
	seg[id << 1] += lazy[id];
	lazy[id << 1] += lazy[id];

	seg[id << 1 | 1] += lazy[id];
	lazy[id << 1 | 1] += lazy[id];

	lazy[id] = 0;
}

void add (ll l, ll r, ll val, ll s = 0, ll e = ind, ll id = 1) {
	if (l <= s && e <= r) {
		seg[id] += val;
		lazy[id] += val;
		return ;
	}

	if (r <= s || e <= l)
		return ;

	shift(id);
	ll mid = e + s >> 1;
	add(l, r, val, s, mid, id << 1);
	add(l, r, val, mid, e, id << 1 | 1);
	seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
}

ll get (ll s = 0, ll e = ind, ll id = 1) {
	if (e - s == 1)
		return s;

	shift(id);
	ll mid = e + s >> 1;
	if (seg[id << 1] <= k)
		return get(s, mid, id << 1);
	return get(mid, e, id << 1 | 1);
}

void calc() {
	for (ll i = 0; i < ind; i++)
		Brr[i] = (Brr[i] - (Brr[i] % d + d) % d) / d;

	for (ll i = 0; i < ind; i++) {
		if (Map[Brr[i]])
			add(0, Map[Brr[i]], inf);

		add(0, i + 1, -1);
		add(i, i + 1, 1);

		/////// MIN:
		add(i, i + 1, -Brr[i]);

		while (mn.size() && Brr[mn.back()] >= Brr[i]) {
			ll en = 0;
			if (1 < mn.size())
				en = mn[mn.size() - 2] + 1;

			add(en, mn.back() + 1, +Brr[mn.back()] - Brr[i]);
			mn.pop_back();
		}
		mn.push_back(i);

		/////// MAX:
		add(i, i + 1, +Brr[i]);
		while (mx.size() && Brr[mx.back()] <= Brr[i]) {
			ll en = 0;
			if (1 < mx.size())
				en = mx[mx.size() - 2] + 1;

			add(en, mx.back() + 1, -Brr[mx.back()] + Brr[i]);
			mx.pop_back();
		}
		mx.push_back(i);

		ll tmp = get();
		if (R - L < i - tmp) {
			L = tmp + S;
			R = i + S;
		}

		Map[Brr[i]] = i + 1;
	}
	refresh();
}

int main() {
	n = rd();
	k = rd();
	d = rd();
	for (ll i = 0; i < n; i++)
		Arr[i] = rd();

	if (d == 0) {
		ind = 0;
		for (ll i = 1; i < n; i++) {
			if (Arr[i] == Arr[i - 1])
				continue;

			if (i - 1 - ind > R - L) {
				R = i;
				L = ind + 1;
			}

			ind = i;
		}

		if (n - 1 - ind > R - L) {
			R = n;
			L = ind + 1;
		}
		cout << L << " " << R << "\n";
		return 0;
	}
	ind = 1;
	S = 1;
	Brr[0] = Arr[0];
	for (ll i = 1; i < n; i++) {
		if ((Arr[i] % d + d) % d == (Arr[i - 1] % d + d) % d) {
			Brr[ind++] = Arr[i];
			continue;
		}

		calc();
		S = i + 1;
		Brr[0] = Arr[i];
		ind = 1;
	}
	calc();

	cout << L << " " << R << "\n";
	return 0;
}

// 12:37 start;


#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if
#define Lsn (x<<1)
#define Rsn (x<<1|1)
#define Mid ((L+R)>>1)

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> Vi;
typedef pair<int,int> pii;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;
const int top=1e9;

int A[N],B[N];
int n,k,d,L,R=-1;

ll mn[N*4],plu[N*4];
int Ql,Qr,Qx,ans;
ll Qv;

void Plus(int x,ll v){
	plu[x]+=v;
	mn[x]+=v;
}
void Down(int x){
	if (plu[x]){
		Plus(Lsn,plu[x]);
		Plus(Rsn,plu[x]);
		plu[x]=0;
	}
}
int Query2(int x,int L,int R){
	if (L==R) return L;
	Down(x);
	return mn[Lsn]<=Qv?Query2(Lsn,L,Mid):Query2(Rsn,Mid+1,R);
}
void Query(int x,int L,int R){
	if (ans) return;
	if (Ql<=L&&R<=Qr){
		if (mn[x]<=Qv) ans=Query2(x,L,R);
		return;
	}
	Down(x);
	if (Ql<=Mid) Query(Lsn,L,Mid);
	if (Qr>Mid) Query(Rsn,Mid+1,R);
}
void Modify(int x,int L,int R){
	if (Ql<=L&&R<=Qr){
		Plus(x,Qv);
		return;
	}
	Down(x);
	if (Ql<=Mid) Modify(Lsn,L,Mid);
	if (Qr>Mid) Modify(Rsn,Mid+1,R);
	mn[x]=min(mn[Lsn],mn[Rsn]);
}
void Renew(int x,int L,int R){
	if (L==R){
		mn[x]=L;
		return;
	}
	Down(x);
	Qx<=Mid?Renew(Lsn,L,Mid):Renew(Rsn,Mid+1,R);
	mn[x]=min(mn[Lsn],mn[Rsn]);
}

void Work(int le){
	static int stk1[N],stk2[N];
	int top1,top2,tmp;
	map<int,int> las;
	stk1[top1=1]=0;
	stk2[top2=1]=0;
	tmp=0;
	For(i,1,*B+1){
		for (;top1>=2&&B[i]>=B[stk1[top1]];top1--){
			Ql=stk1[top1-1]+1;
			Qr=stk1[top1];
			Qv=B[i]-B[stk1[top1]];
			Modify(1,1,*B);
		}
		stk1[++top1]=i;
		for (;top2>=2&&B[i]<=B[stk2[top2]];top2--){
			Ql=stk2[top2-1]+1;
			Qr=stk2[top2];
			Qv=B[stk2[top2]]-B[i];
			Modify(1,1,*B);
		}
		stk2[++top2]=i;
		Qx=i;
		Renew(1,1,*B);
		Ql=tmp=max(tmp,las[B[i]]+1);
		Qr=i;
		Qv=i+k;
		ans=0;
		Query(1,1,*B);
		if (ans&&i-ans+1>R-L+1){
			L=ans+le-1,R=i+le-1;
		}
		las[B[i]]=i;
	}
}

int main(){
	n=IN(),k=IN(),d=IN();
	For(i,1,n+1) A[i]=IN()+top;
	if (d==0){
		for (int l=1,r;l<=n;l=r+1){
			for (r=l;r+1<=n&&A[r+1]==A[l];r++);
			if (r-l+1>R-L+1){
				L=l,R=r;
			}
		}
	} else{
		for (int l=1,r;l<=n;l=r+1){
			for (r=l;r+1<=n&&A[r+1]%d==A[l]%d;r++);
			if (r-l+1>R-L+1){
				*B=0;
				For(i,l,r+1) B[++*B]=A[i]/d;
				Work(l);
			}
		}
	}
	printf("%d %d\n",L,R);
}


#include<bits/stdc++.h>
using namespace std;
#define next Next
#define int long long
#define mid (l+r)/2
const int N=1e6+5;
int n,m,k,d,ans,l,r,top1,top2,ansL,ansR,a[N],zuo[N],zhan1[N],zhan2[N];
int mi[N*4],ma[N*4],tree[N*4],tag1[N*4],tag2[N*4];
map<int,int>gs;
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
void pushup(int nod)
{
	mi[nod]=min(mi[nod*2],mi[nod*2+1]);
	ma[nod]=max(ma[nod*2],ma[nod*2+1]);
	tree[nod]=min(tree[nod*2],tree[nod*2+1]);
}
void pushdown(int nod)
{
	mi[nod*2]+=tag1[nod];tag1[nod*2]+=tag1[nod];
	mi[nod*2+1]+=tag1[nod];tag1[nod*2+1]+=tag1[nod];
	tag1[nod]=0;tree[nod*2]-=tag1[nod];tree[nod*2+1]-=tag1[nod];
	ma[nod*2]+=tag2[nod];tag2[nod*2]+=tag2[nod];
	ma[nod*2+1]+=tag2[nod];tag2[nod*2+1]+=tag2[nod];
	tag2[nod]=0;tree[nod*2]+=tag2[nod];tree[nod*2+1]+=tag2[nod];
}
void build(int nod,int l,int r)
{
	if(l==r)
	{
		tree[nod]=l;
		mi[nod]=ma[nod]=a[l];
		return;
	}
	build(nod*2,l,mid);
	build(nod*2+1,mid+1,r);
	pushup(nod);
}
int find(int nod,int l,int r,int x)
{
	if(l==r)return l;
	pushdown(nod);
	if(tree[nod*2]<=x)return find(nod*2,l,mid,x);
	else return find(nod*2+1,mid+1,r,x);
}
void del(int nod,int l,int r,int x)
{
	if(l==r){tree[nod]=1e15;return;}
	pushdown(nod);
	if(x<=mid)del(nod*2,l,mid,x);
	else del(nod*2+1,mid+1,r,x);
	pushup(nod);
}
void change1(int nod,int l,int r,int L,int R,int val)
{
	if(L<=l&&r<=R)
	{
		mi[nod]+=val;
		tag1[nod]+=val;
		tree[nod]-=val;
		return;
	}
	pushdown(nod);
	if(R<=mid)change1(nod*2,l,mid,L,R,val);
	else if(L>mid)change1(nod*2+1,mid+1,r,L,R,val);
	else{
		change1(nod*2,l,mid,L,mid,val);
		change1(nod*2+1,mid+1,r,mid+1,R,val);
	}
	pushup(nod);
}
void change2(int nod,int l,int r,int L,int R,int val)
{
	if(L<=l&&r<=R)
	{
		ma[nod]+=val;
		tag2[nod]+=val;
		tree[nod]+=val;
		return;
	}
	pushdown(nod);
	if(R<=mid)change2(nod*2,l,mid,L,R,val);
	else if(L>mid)change2(nod*2+1,mid+1,r,L,R,val);
	else{
		change2(nod*2,l,mid,L,mid,val);
		change2(nod*2+1,mid+1,r,mid+1,R,val);
	}
	pushup(nod);
}
signed main()
{
	n=read();k=read();d=read();
	for(int i=1;i<=n;i++)a[i]=read()+1e9;
	if(!d)
    {
        for(int i=1,j;i<=n;)
        {
            j=i;
            while(j<n&&a[j+1]==a[i])j++;
            if(j-i+1>ans){ans=j-i+1;ansL=i;ansR=j;}
            i=j+1;
        }
        printf("%lld %lld\n",ansL,ansR);
        return 0;
    }
	for(int i=1;i<=n;)
    {
        int j=i;
		zuo[i]=i;
        while(j<n&&a[j+1]%d==a[i]%d){j++;zuo[j]=i;}
        i=j+1;
    }
    r=1;
    build(1,1,n);
    while(l<n)
    {
        l++;gs[a[l]]++;
        while(gs[a[l]]>1||zuo[l]!=zuo[r])
		{
			del(1,1,n,r);
			gs[a[r]]--;
			r++;
		}
        while(top1>0&&a[l]<=a[zhan1[top1]])
        {
            change1(1,1,n,zhan1[top1-1]+1,zhan1[top1],a[l]/d-a[zhan1[top1]]/d);
            top1--;
        }
        zhan1[++top1]=l;
        while(top2>0&&a[l]>=a[zhan2[top2]])
        {
            change2(1,1,n,zhan2[top2-1]+1,zhan2[top2],a[l]/d-a[zhan2[top2]]/d);
            top2--;
        }
        zhan2[++top2]=l;
        int L=find(1,1,n,l+k);
        if(L>=r&&l-L+1>ans)
		{
			ans=l-L+1;
			ansL=L;ansR=l;
		}
    }
    printf("%lld %lld\n",ansL,ansR);
    return 0;
}
/*
*/