Longest Common Suffix Queries
Store the reversed container words in a trie, and keep at each node the shortest word (earliest on a tie) passing through it.
Store the reversed container words in a trie, and keep at each node the shortest word (earliest on a tie) passing through it.