In FRGTNLNG question Which test case is getting failed?

iterations = int(input())
while iterations :
numberOfWords, numberOfLines = map(int, input().split())
wordsDictionary = {};
statusString = “”
for word in input().split():
wordsDictionary[ word ] = “NO”
#print( wordsDictionary )
while numberOfLines :
sentence = input().split()[ 1: ]
#print( line )
for sentenceWords in sentence:
if sentenceWords in wordsDictionary:
wordsDictionary[ sentenceWords ] = “YES”
numberOfLines -= 1
for word in wordsDictionary:
statusString += ( wordsDictionary[ word ] + " ")
print( statusString[ : -1 ] )
iterations -= 1

Dictionaries are not ordered in Python. There is no guarantee that you will get the entries back in the order that you added them.

EDIT: Actually, I may be out of date there. Dictionaries seem to have more creation order than formerly. However there was no guarantee in the problem that the forgotten language words would be unique in their list, in which case the second such instance would not be added to the dictionary.