#include
using namespace std;
int main() {
int n,i,j,k;
int a[1000];
int target;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>target;
for(i=0;i<n-2;i++)
{
for(j=i+1;j<n-1;j++)
{
for(k=i+2;k<n;k++)
{
if(a[i]+a[j]+a[k]==target)
cout<<a[i]<<" , "<<a[j]<<" and "<<a[k]<<endl;
}
}
}
return 0;
}
//input
9
5
7
9
1
2
4
6
8
3
10
output
5 , 1 and 4
5 , 2 and 3
5 , 4 and 1
7 , 1 and 2
7 , 2 and 1
1 , 6 and 3
plz tell me how to compare a[i],a[j],a[k] to arrange them in increasing order
and also i get two repeated values 5,4,1 or 7,2,1