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