#! -*- coding: UTF-8 -*- st=map(str,raw_input().strip().split()) for i in range(len(st)): if (st[i][0]=='q') or (st[i][0]=='Q'): print st[i]