public void Query(List<K> pattern)
	{
		TrieNode<K,V> current= trie.getRoot();
		int size=pattern.size();
		int index=0;
		while(index<size){
			K k=pattern.get(index);
			TrieNode<K,V> node=current.getChildren().get(k);
			/**
			 * if pattern matched, move to next state.
			 */
			if(node !=null){
				if(node.getValue()!=null){
					output.add(node.getValue());
				}
				current=node;
				index++;
			}
			if(node==null){
				if(current.getFail()!=null){
					current=current.getFail();
					/**
					 * maybe the heading state is a word.
					 */
					if(current.getValue()!=null){
						output.add(current.getValue());
					}
				}
				else
				{
					/**
					 * if pattern not matched, and not transfer state found. then move to next state.
					 */
					current=trie.getRoot();
					index++;
				}
			}
			
		}
		
	}