import java.util.*; public class PSArrayList { private static ArrayList copy(ArrayList L){ ArrayList copy = new ArrayList(); for (int i : L) copy.add(i); return copy; } public static void ps(ArrayList L1,ArrayList L2){ if (L2.isEmpty()){System.out.println(L1); return;} int e = L2.get(0); // select first element of L2 ArrayList A = copy(L1); ArrayList B = copy(L2); A.add(e); B.remove((Integer) e); ps(A,B); // take e ps(L1,B); // don't take e } public static void main(String[] args){ int n = Integer.parseInt(args[0]); ArrayList A = new ArrayList(); ArrayList B = new ArrayList(); for (int i=0;i