#include
using namespace std;
void helper(int* a,int j,int* input,int i,int* b,int k,int n,int &sum1,int &sum2){
//base case
if(i==n){
if(sum1==sum2){
for(int p=0;p<j;p++){
cout<<a[p]<<" ";
}cout<<"and “;
for(int s=0;s<k;s++){
cout<<b[s]<<” ";
}
cout<<endl;
}
return ;
}
//recursive case
a[j]=input[i];
sum1=a[j]+input[i];
helper(a,j+1,input,i,b,k,n,sum1,sum2);
b[k]=input[i];
sum2=b[k]+input[i];
helper(a,j,input,i+1,b,k+1,n,sum1,sum2);
}
int main() {
int n;
cin>>n;
int input[n];
for(int i=0;i<n;i++){
cin>>input[i];
}
int a[n];
int b[n];
int sum1=0;
int sum2=0;
helper(a,0,input,0,b,0,n,sum1,sum2);
}