static void validation(Trie trie, List<String> train, List<String> test){
        bm.start("[Validation]");
        Map<String,Integer> train_map = new HashMap<String, Integer>();

        for(String key : train){
            int id = trie.lookup(key);
            if (id == Trie.UNKNOWN_ID)
                throw new IllegalStateException("Invalid key-id pair in training keys: " + key + ", " + id);
            train_map.put(key, id);
        }

        boolean error = false;
        for(String key : test){
            int id = trie.lookup(key);
            if ((train_map.containsKey(key) && id == Trie.UNKNOWN_ID) ||
                    (! train_map.containsKey(key) && id > 0)){
                System.out.println("Invalid key-id pair in test keys.: " + key + ", " + id);
                error = true;
            }
        }
        if (error)
            throw new IllegalStateException("Some invalid keys has been found.");

        bm.stop();
    }