s=raw_input().strip().split() l=len(s) for i in range(l+1): if s[i][0]=='q' or s[i][0]=='Q': print s[i]