i am not able to share code through ide
#include
#include<bits/stdc++.h>
using namespace std;
bool negative;
int compare(string a,string b)
{
if(!negative)
return a.compare(b)>0?1:0;
else
return !a.compare(b)>0?1:0;
}
int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector<string> a;
for(int i=0;i<n;i++)
{ string b;
cin>>b;
if(b[0]=='-')
negative=true;
a.push_back(b);
}
sort(a.begin(),a.end(),compare);
for(int i=0;i<n;i++)
cout<<a[i];
cout<<endl;
}
return 0;
}