require "stringio" class TrueClass def to_s "YES" end end class FalseClass def to_s "NO" end end def calc(input) n, m = input.gets.split.map(&:to_i) n.times.map { input.gets }.any?(/LOVE/) end input = StringIO.new(<<~EOS) 2 6 FJSYSK RLOVER EOS # input = StringIO.new(<<~EOS) # 10 20 # TEOWMZGTZKRECDSBYSUY # IIXIGGXYZZOUGETSFZNH # JELNHDQHYKFIUEQBNQZO # PQJXUCRABFHMJUCTASAY # FIGZOZABPAQGQZEMDVOG # AXSMSWFSPFSUPAVEZWFQ # YXXQYDCBYTHBQCNKYSEP # ZWLPXHVYFAPDYOVYRZAR # SJSLLHVMZCDBYPQXWLYB # NPGNDBMWAOPVXIGLPDXR # EOS # puts calc(input) puts calc($stdin)