Help me in solving MISSP problem

My issue

getting right output ,but after submitting says wrong. somebody please help me how to do this.

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t; 
	int count;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int a[n];
	   for(int i=0;i<n;i++)
	   {
	       cin>>a[i];
	       
	   }
	   sort(a,a+n);
	   
	   for(int i=0;i<n;i++){
	      for(int j=i+1;j<=n;j++){
	          if(a[i]==a[j])
	           i++;
	          else
	            cout<<a[i];
	            break;
	           
	       }
	       
	   }
	   
	}

}

Problem Link: Chef and Dolls Practice Coding Problem