print("===== 藏頭詩 =====")
initials = '天下為公'
for initialWord in initials:
text = ""
currentWord = initialWord
i = 0
while True:
i += 1
text += currentWord
if currentWord not in wordDict:
currentWord = initialWord
currentWord = retrieveRandomWord(wordDict[currentWord])
if currentWord == '\n': break
print(text)