import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void run() { FastScanner sc = new FastScanner(); int N=sc.nextInt(); int[] val=new int[N]; char[] cs=new char[N+1]; for(int i=0;i