import java.util.*;

class Main {
    public static void main(String[] args) {
        List lst = new ArrayList(Arrays.asList(new Object[]{1, Arrays.asList(new Object[]{2, 3}), 4, Arrays.asList(new Object[]{ Arrays.asList(new Object[]{5, Arrays.asList(new Object[]{6}) }), 7}), }));
        System.out.println("" + lst);
        System.out.println("" + selectOdd(lst));
    }
    public static Object selectOdd(Object x) {
        if (x instanceof Integer) {
            return (Integer)x % 2 == 1 ? x : null;
        } else if (x instanceof List) {
            List lst = new ArrayList();
            for (Object y : (List)x) {
                Object z = selectOdd(y);
                if (z != null) {
                    lst.add(z);
                }
            }
            return lst.isEmpty() ? null : lst;
        } else {
            return null;
        }
    }
}