#include<bits/stdc++.h>
using namespace std;
const int N=6e5;
int T,n,m,k;
int a[N];
int flag=0;
int ans=0;
int vis[N];
int main(){
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	scanf("%d",&T);
	while(T--){
		memset(a,0,sizeof(a));
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=m;i++){
			scanf("%d",&a[i]);
		}
		if(n==2){
			for(int i=1;i<=n;i++){
				if(vis[a[i]]){
					int k=0;
					while(a[i+k]==a[vis[a[i]]+k]){
						k++;
					}
				}
				vis[a[i]]=i;
			}
		}
		else{
			printf("%d\n",m);
			printf("%d %d\n",1,n);
		}
	}
}
