public static void main (String args[]) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        while (true) {
            String line = reader.readLine();
            if (line == null || line.length() == 0) {
                break;
            }
            StringTokenizer tokenizer = new StringTokenizer(line);
            Tree tree = new Tree();
            tree.build(tokenizer.nextToken(), tokenizer.nextToken());
            System.out.println(tree.postorder());
        }
    }