a=raw_input() list1=a.split(" ") for i in range(len(list1)): if list1[i][0:1]=='q'or list1[i][0:1]=='Q': print list1[i]