#include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, l;
int t, n, m, q;
scanf("%d", &t);
for(int cl=0; cl<t; cl++) {
scanf("%d %d", &n, &m);
int a, b, c, d;
printf("SCAN %d %d\n", 1, 1);
fflush(stdout);
scanf("%d", &a);
printf("SCAN %d %d\n", 1, m);
fflush(stdout);
scanf("%d", &b);
int x = (a+b-2*(m-1))/4;
printf("SCAN %d %d\n", x+1, 1);
fflush(stdout);
scanf("%d", &c);
int x1 = (a-c)/2;
int x2 = (a+b-2*(m-1))/2-x1;
int y = (a-x1-x2)/2;
printf("SCAN %d %d\n", 1, y+1);
fflush(stdout);
scanf("%d", &d);
int y1 = (a-d)/2;
int y2 = (a-x1-x2)-y1;
printf("DIG %d %d\n", x1+1, y1+1);
fflush(stdout);
scanf("%d", &k);
if(k == 0) {
printf("DIG %d %d\n", x1+1, y2+1);
fflush(stdout);
scanf("%d", &k);
printf("DIG %d %d\n", x2+1, y1+1);
fflush(stdout);
scanf("%d", &k);
} else {
printf("DIG %d %d\n", x2+1, y2+1);
fflush(stdout);
scanf("%d", &k);
}
}
}
Partitioning binary strings | Special sets |
Smallest chosen word | Going to office |
Color the boxes | Missing numbers |
Maximum sum | 13 Reasons Why |
Friend's Relationship | Health of a person |
Divisibility | A. Movement |
Numbers in a matrix | Sequences |
Split houses | Divisible |
Three primes | Coprimes |
Cost of balloons | One String No Trouble |
Help Jarvis! | Lift queries |
Goki and his breakup | Ali and Helping innocent people |
Book of Potion making | Duration |
Birthday Party | e-maze-in |
Bricks Game | Char Sum |