import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main implements Runnable { //Runnableを実装する public static void main(String[] args) { new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行 } int dfs(char[][] str, char[] ans, int pos, int[] equiv) { int ret=0; if (pos==ans.length) return 1; for (int i=0;i<26;++i) { ans[pos]=(char)(i+'a'); int[] nequiv=Arrays.copyOf(equiv, equiv.length); boolean ok=true; for (int j=0;j