func_code_string: #include<bits/stdc++.h>   using namespace std;   typedef long long ll;   typedef long double lf;   typedef unsigned long long ull;   typedef pair<ll,int>P;   const int inf = 0x7f7f7f7f;   const ll INF = 1e16;   const int N = 2e5+10;   const ull base = 131;   const ll mod =  1e9+7;   const double PI = acos(-1.0);   const double eps = 1e-4;      inline int read(){int x=0,f=1;char ch=getchar();while(ch< 0 ||ch> 9 ){if(ch== - )f=-1;ch=getchar();}while(ch>= 0 &&ch<= 9 ){x=x*10+ch- 0 ;ch=getchar();}return x*f;}   inline string readstring(){string str;char s=getchar();while(s==   ||s==  n ||s==  r ){s=getchar();}while(s!=   &&s!=  n &&s!=  r ){str+=s;s=getchar();}return str;}   int random(int n){return (int)(rand()*rand())%n;}   void writestring(string s){int n = s.size();for(int i = 0;i < n;i++){printf( %c ,s[i]);}}         int a[N];   int b[N],c[N];      void solve(){       int n = read();       memset(b,0,sizeof b);       memset(c,0,sizeof c);       set<int>st1,st2;       for(int i = 1;i <= n;i++){           st1.insert(i);           st2.insert(i);       }       for(int i = 1;i <= n;i++){           a[i] = read();       }       b[1] = c[1] = a[1];       st1.erase(a[1]);       st2.erase(a[1]);       for(int i = 2;i <= n;i++){           if(a[i] != a[i-1]){               b[i] = c[i] = a[i];               st1.erase(a[i]);               st2.erase(a[i]);           }       }             for(int i = 1;i <= n;i++){           if(b[i] == 0){               int x = *st1.begin();               b[i] = x;               //cout<<x<<endl;               st1.erase(x);           }              if(c[i] == 0){               auto it = st2.upper_bound(c[i-1]);               it--;               c[i] = *it;               st2.erase(c[i]);           }          }             for(int i = 1;i <= n;i++){           printf( %d  ,b[i]);       }       puts(  );       for(int i = 1;i <= n;i++){           printf( %d  ,c[i]);       }       puts(  );      }   int main(){       int t = read();       while(t--){           solve();       }       return 0;   }      