#include<stdio.h>
int main(){
int T,N,M,x1,y1,x2,y2;
scanf("%d",&T);
while(T--)
{
scanf("%d%d",&N,&M);
scanf("%d%d",&x1,&y1); //input FS x1 and y1
scanf("%d%d",&x2,&y2); //input girl x2 and y2
if(x2>=x1&&y2>=y1) //if girl located at bottom or right of FS
printf("%d\n",(x2-x1)+(y2-y1)); //if yes output step
else
printf("Single dog!\n"); //if no output string
}
return 0;
}