array=raw_input().strip().split() for i in range(len(array)): if array[i][0]=="q" or array[i][0]=="Q": print array[i]