#include
using namespace std;
int max3 (int, int, int);
int min3 (int, int, int);
int middle (int, int, int);
int main() {
int N;
cin>>N;
int ar[N],i,j,k,sm;
for(i=0;i<N;i++){
cin>>ar[i];
}
cin>>sm;
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
for(k=j+1;k<N;k++){
if(ar[i]+ar[j]+ar[k]==sm)
cout<<min3(ar[i],ar[j],ar[k])<<", “<<middle(ar[i],ar[j],ar[k])<<” and "<<max3(ar[i],ar[j],ar[k])<<endl;
}
}
}
return 0;
}
int max3 (int a, int b, int c) // int a, b, and c are parameters.
{
return max (a, max (b,c));
}
//function definition
int min3 (int a, int b, int c)
{
return min (a, min (b,c));
}
//function definition
int middle (int a, int b, int c) // int a, b, and c are parameters.
{
return (a + b + c) - (max (a, max (b,c)) + min (a, min (b,c)));
}