#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
ll n, a[10000000];
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n-1;i++)
{
int flag=0;
for(int j=i+1;j<n;j++)
{
if(a[j] > a[i])
{
cout<<a[j]<<" ";
flag=1;
break;
}
}
if(flag==0)
cout<<"-1 ";
}
cout<<"-1\n";
}
return 0;
}
why i am getting segmentation fault using this code? is there anything wrong in the code. as per my knowledge there is nothing wrong in code. please do explain the fault...