#!/usr/bin/env python3
(s := input()), print("yes" if 0 < sum([s.endswith(input()) for _ in range(int(input()))]) else "no")
