#include using namespace std; typedef long long int uli; const int mx=456; vectorg[mx]; vectore[mx]; bool vise[mx*mx]; int ne; vector >cycles; stacks; bool instack[456]; int n; int inv(int x){ if(xcycle; int v; do{ v=s.top(); instack[v]=false; s.pop(); cycle.push_back(v); }while(v!=u); cycles.push_back(cycle); cycles.push_back(cycle); } while(!g[u].empty()){ int v=g[u].back(); int edge=e[u].back(); g[u].pop_back(); e[u].pop_back(); if(vise[edge])continue; vise[edge]=true; s.push(u); instack[u]=true; dfs(v); } } int main(){ int t; scanf("%d",&t); while(t--){ scanf("%d",&n); assert(s.empty()); cycles.clear(); ne=0; if(n&1){ for(int u:{0,n}){ int v=u; vectorcycle; for(int i=0;icycle; int u=0; do{ u=nxt(u); cycle.push_back(u); }while(u!=0); cycles.push_back(cycle); for(int i=0;i=n)rotate(cycle.begin(),cycle.begin()+1,cycle.end()); int sz=cycle.size(); printf("%d\n",sz/2); for(int i=0;i