private static void write(AccountNumber next, PrintWriter writer) {
        if (next.isValid()) {
            writer.println(next.toString());
        } else if (next.hasOneOtherSolution()) {
            writer.println(next.firstPermutation().toString());
        } else if (next.isAmbiguous()) {
            writer.println(next.toString() + " AMB " + next.validPermutations());
        } else if (next.isIllegible()) {
            writer.println(next.toString() + " ILL");
        } else if (next.isInError()) {
            writer.println(next.toString() + " ERR");
        }
    }