string=map(str,raw_input().strip().split()) for i in range(len(string)): if string[i][0]=='q' or string[i][0]=='Q':print string[i]