Basic prefix tree implementation