#include #include #include #include #include #include #include #include #include #include #define infile(filename) freopen(filename".in","r",stdin) #define outfile(filename) freopen(filename".out","w",stdout) #define usefile(filename) infile(filename),outfile(filename) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef __int128 I; namespace IO { const int BUF=1<<20; static char ch[BUF]={},out[BUF]={},*l=ch,*r=ch,*o=out; #define FASTIO #ifdef FASTIO inline char gc() { return (l==r&&(r=(l=ch)+fread(ch,1,BUF,stdin),l==r))?EOF:*l++; } #else inline char gc() { return getchar(); } #endif inline void flush() { fwrite(out,1,o-out,stdout),o=out; } inline void putc(char ch) { if(o==out+BUF) flush(); *o++=ch; } struct flusher{~flusher(){flush();}}_; }; using IO::gc; using IO::putc; template void read(T &a) { static char fushu,ch; a=fushu=0; do ch=gc(); while(ch!='-'&&(ch<48||ch>57)); if(ch=='-') ch=gc(),fushu=1; do a=(a<<1)+(a<<3)+(ch^48),ch=gc(); while(ch>47&&ch<58); if(fushu) a=-a; } template void read(T &a,Args &...args) { read(a),read(args...); } template void write(T a) { static char que[114]={},*p=que; if(!a) putc(48); if(a<0) putc('-'),a=-a; while(a) *p++=(a%10)^48,a/=10; while(p!=que) putc(*--p); putc(32); } template void write(T a,Args ...args) { write(a),write(args...); } const int N=400099; int T,n,A,B,a[N]={},b[N]={},c[N]={}; namespace taskBF { bool ind[N]={},flag; int calc(int a[]) { static int f[N]={}; int i,j,maxn=0; for(i=1;i<=n;++i) { f[i]=0; for(j=1;jn) { if(calc(a)==A&&calc(b)==B) { flag=true; int i; printf("Yes\n"); for(i=1;i<=n;++i) printf("%d ",a[i]); printf("\n"); for(i=1;i<=n;++i) printf("%d ",b[i]); printf("\n"); } return ; } for(int i=1;i<=2*n&&!flag;++i) if(!ind[i]) for(int j=i+1;j<=2*n&&!flag;++j) if(!ind[j]) { ind[i]=ind[j]=true; if(c[x]) b[x]=j,a[x]=i; else b[x]=i,a[x]=j; dg(x+1); ind[i]=ind[j]=false; } return ; } void solve() { flag=false,dg(1); if(!flag) printf("No\n"); } } namespace taskA1 { int cnta[N]={},cntb[N]={},plan[N]={}; void solve(int tag) { int i,j; if(B==1) { for(i=1;i0)+(cntb[i]>0)<=B&&B<=cnta[i]+cntb[i]) { int pa=(cnta[i]>0),pb=(cntb[i]>0); if(pa+pb