import java.io.*;
class powerset
{
public static void main(String args[]) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i;char buff[]=new char[30];
String str[]=new String[1024];
str[0]="phi";
System.out.print("Enter the no. of elements in the set : ");
int x=Integer.parseInt(br.readLine());
System.out.println();
double n=Math.pow(2,x);
for(i=0;i<x;i++)
{
System.out.print("Enter the "+(i+1)+" element of the set : ");
String s=br.readLine();
buff[i]=s.charAt(0);
System.out.println();
}
for(i=1;i<n;i++)
{
str[i]=Integer.toString(i,2);
int z=str[i].length();
for(int j=0;j<x-z;j++)
str[i]="0"+str[i];
}
System.out.println("THE POWER SET IS : ");
System.out.println(str[0]);
for(i=1;i<n;i++)
{
for(int j=0;j<x;j++)
{
char chk=str[i].charAt(j);
if(chk=='1')
System.out.print(buff[j]);
}
System.out.println();
}
}
}