#!/usr/bin/python # -*- coding: UTF-8 -*- str1=map(str,raw_input().strip().split()) str2=[] for str2 in str1: if str2[0]=='Q' or str2[0]=='q': print str2