func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   map<pair<int, int>, int> rel;   vector<int> x, y, color[4];   int pos[N], block[N];   char s[N];   inline int read() {     int x = 0, f = 1;     char ch = getchar();     for (; ch <  0  || ch >  9 ; ch = getchar())       if (ch ==  - ) f = -1;     for (; ch >=  0  && ch <=  9 ; ch = getchar())       x = (x << 1) + (x << 3) + ch -  0 ;     return x * f;   }   void query() {     if (x.size() == 0) return;     printf( Q %d  , x.size());     for (int i = 0, len = x.size(); i < len; ++i) printf( %d %d  , x[i], y[i]);     puts(  );     fflush(stdout);     scanf( %s , s);     for (int i = 0, len = x.size(); i < len; ++i) {       rel[make_pair(x[i], y[i])] = s[i] -  0 ;       rel[make_pair(y[i], x[i])] = s[i] -  0 ;     }     x.clear();     y.clear();   }   void answer() {     printf( A  );     for (int i = 1; i <= 3; ++i) printf( %d  , color[i].size());     puts(  );     for (int i = 1; i <= 3; ++i) {       for (int j = 0, len = color[i].size(); j < len; ++j)         printf( %d  , color[i][j]);       puts(  );     }     fflush(stdout);   }   int main() {     int T = read();     while (T--) {       int n = read();       rel.clear();       memset(pos, 0, sizeof pos);       memset(block, 0, sizeof block);       for (int i = 1; i < n; i += 2) {         x.push_back(i);         y.push_back(i + 1);       }       query();       for (int i = 2; i < n; i += 2) {         x.push_back(i);         y.push_back(i + 1);       }       query();       int tot = pos[1] = 1;       for (int i = 2; i <= n; ++i)         if (!rel[make_pair(i - 1, i)]) pos[++tot] = i;       for (int i = 1; i < tot - 1; i += 4) {         x.push_back(pos[i]);         y.push_back(pos[i + 2]);       }       for (int i = 2; i < tot - 1; i += 4) {         x.push_back(pos[i]);         y.push_back(pos[i + 2]);       }       query();       for (int i = 3; i < tot - 1; i += 4) {         x.push_back(pos[i]);         y.push_back(pos[i + 2]);       }       for (int i = 4; i < tot - 1; i += 4) {         x.push_back(pos[i]);         y.push_back(pos[i + 2]);       }       query();       block[1] = 1;       block[2] = tot > 1 ? 2 : 0;       for (int i = 3; i <= tot; ++i) {         if (rel[make_pair(pos[i], pos[i - 2])])           block[i] = block[i - 2];         else           block[i] = 6 - block[i - 1] - block[i - 2];       }       for (int i = 1; i <= 3; ++i) color[i].clear();       for (int i = 1, j = 1; i <= tot; ++i)         while (j ^ pos[i + 1] && j <= n) color[block[i]].push_back(j++);       answer();     }     return 0;   }   