static boolean isMultiplicityFree(int[] elements) {
        int v = vexillarity(elements);
        int inv = inversions(elements);
        if (inv == 0) return true;
        HashSet<Tableau> tableaux = new HashSet<Tableau>();
        HashSet<AW> shapes = new HashSet<AW>();
        createStack(inv);
        int reducedWordCount = 0;
        int nextPush = 0;
        while (true) {
//            System.out.println(Arrays.toString(elements) + " " + stackTop + " " + nextPush + " " + reducedWordCount);
            if (stackTop == inv - 1) {
                // Now we need to compute the tableau associated with the stack
                // Add it to the collected tableaux 
//                System.out.println("Added word");
//                System.out.println(Arrays.toString(stack));
//                Tableau t = new Tableau(stack);
//                System.out.println(t);
                Tableau t = new Tableau(stack);
                if (!tableaux.contains(t)) {
                    AW st = new AW(t.shape());
                    if (shapes.contains(st)) return false;
                    tableaux.add(t);
                    shapes.add(st);
                }
//                System.out.println();
                
                nextPush = pop(elements);
//                System.out.println("A" + " " + Arrays.toString(elements));
                continue;
            }
            while (nextPush < elements.length - 1 && elements[nextPush] < elements[nextPush + 1]) {
                nextPush++;
            }
            if (nextPush >= elements.length - 1) {
                nextPush = pop(elements);
//                System.out.println("B " + " " + Arrays.toString(elements));
                if (nextPush == Integer.MIN_VALUE) {
                    return true;
                }
                continue;
            }
            push(nextPush, elements);
//            System.out.println("C" + " " + Arrays.toString(elements));
            nextPush = 0;
        }
    }