#include #include #include #include #include using namespace std; int n,m,k; int main() { int t,len,cas=1,i,j; scanf("%d",&t); while (t--){ int x,y,sx,sy,ans,a,b; scanf("%d%d%d",&n,&m,&k); scanf("%d%d",&x,&y); scanf("%d%d",&sx,&sy); a=abs(x-sx);b=abs(y-sy) ; if ((a==2&&b==1&&(y==1||y==m))||(a==1&&b==2&&(x==1||x==n))) ans=2; else if(a==1&&b==1&&(x==1||x==n)&&(y==1||y==m)) ans=2; else if ((a==0&&b==1&&(y==1||y==m))||(a==1&&b==0&&(x==1||x==n))) ans=2 ; else { if (a0) ans++;} else {ans=a/3;if (a%3>0) ans++;} } printf("Case #%d:\n",cas++); if (ans>k) printf("OH,NO!\n"); else printf("%d\n",ans); } return 0; }