public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); List<State> states = new ArrayList<State>(); int n = in.nextInt(); for (int i = 0; i < n; i++) { states.add(new State(i, in.nextInt(), in.nextInt())); } in.nextLine(); solve(states, in.nextLine().toCharArray()); }