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