func_code_string: #include <bits/stdc++.h>   using namespace std;      const long long MOD = 998244353;      int a[1005][505];   vector<int> pos[505][505];   bool removed[505];      void remove1(int x, int n, int layerNum = 0){       if(removed[x]){return;}       removed[x] = true;          vector<int> toRemove;       for(int j = 1; j <= n; j ++){           auto it = find(pos[j][a[x][j]].begin(), pos[j][a[x][j]].end(), x);           if(layerNum == 0){               if(it != pos[j][a[x][j]].end()){                   for(int k: pos[j][a[x][j]]){                       if(k != x){                           toRemove.push_back(k);                       }                   }                   pos[j][a[x][j]] = vector<int>();               }           }else{               if(it != pos[j][a[x][j]].end()){                   pos[j][a[x][j]].erase(it);               }           }       }          for(int k: toRemove){           remove1(k, n, 1);       }   }      void printPosState(int n){       for(int i = 1; i <= n; i ++){           for(int j = 1; j <= n; j ++){               printf( (%d, %d):  , i, j);                  for(int k: pos[i][j]){                   printf( %d  , k);               }                  printf(  n );           }       }   }      int main(){       int t;       scanf( %d , &t);          while(t --){           int n;           scanf( %d , &n);              memset(removed, false, sizeof(removed));              for(int i = 1; i <= n; i ++){               for(int j = 1; j <= n; j ++){                   pos[i][j] = vector<int>();               }           }              for(int i = 1; i <= 2*n; i ++){               for(int j = 1; j <= n; j ++){                   scanf( %d , &a[i][j]);                   pos[j][a[i][j]].push_back(i);               }           }              vector<int> res;              //printPosState(n);              int cnt = 0;           while(1){               bool found = false;               for(int i = 1; i <= n; i ++){                   for(int j = 1; j <= n; j ++){                       if((int)pos[i][j].size() == 1){                           int x = pos[i][j][0];                           remove1(x, n);                           //printf( %d removed n n , x);                           //printPosState(n);                           res.push_back(x);                           found = true;                           break;                       }                   }                   if(found){break;}               }               if(!found){                   cnt ++;                   for(int i = 1; i <= n; i ++){                       for(int j = 1; j <= n; j ++){                           if((int)pos[i][j].size() == 2){                               int x = pos[i][j][0];                               remove1(x, n);                               //printf( %d removed n n , x);                               //printPosState(n);                               res.push_back(x);                               found = true;                               break;                           }                       }                       if(found){break;}                   }               }                  if(!found){break;}           }              //printf( cnt=%d n , cnt);              long long ans = 1;           for(int i = 1; i < cnt; i ++){               ans = (ans+ans)%MOD;           }              printf( %lld n , ans);           for(int x: res){               printf( %d  , x);           }           printf(  n );       }          return 0;   }   