private void checkDuplicates(List<Word> list1, List<Word> list2) {
        for (Word word1 : list1) {
            if (list2.contains(word1)) {
                throw new RuntimeException("Duplicate word: " + word1);
            }
        }
    }