tries with patterns