LOVEGURU - Love Guru

no tags 

Recently after girls being allowed to get admitted into IUT, the number of couples in IUT(International University Of Technology) is gradually increasing. In last few months a problem has been noticed. More than one boy/girl had crush on same boy/girl. These created conflicts amongst students. To solve this problem, IUTRC(IUT Relationship Community) came up with a solution. They set up rules with whom a student can only get in a relationship. If your name and the other persons name has a common substing of length k , only then two you can engage yourselves in a relationship. Now, as a loveguru now students are coming to you for knowing if his relationship with his crush possible or not. Help them Love Guru.


First line contains two integer 0<n<10000 and 1<k<=n.

n refers the number of people came for your help and k refers the minimum common substring size.

Then next n lines contains two space separated strings each containing only lower case letters. Name of the boy and name of the girl. no name contains less than 2 characters or more than 100 characters.


For each case on each line print "Yes" if possible and "No" otherwise.


5 3
salman almiza
rizvi krizvia
abid nowmi
atondro iroboton
curlybraces hiscrush

hide comments
vaibhav2303: 2018-12-14 15:06:46

Never use printf/scanf and cin/cout together, leads to unnecessary WAs

Added by:Safayet
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)