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.lazy.map { input.gets }.any?(/LOVE/) end input = StringIO.new(<<~EOS) 10 20 TEOWMZGTZKRECDSBYSUY IIXIGGXYZZOUGETSFZNH JELNHDQHYKFIUEQBNQZO PQJXLOVEBFHMJUCTASAY FIGZOZABPAQGQZEMDVOG AXSMSWFSPFSUPAVEZWFQ YXXQYDCBYTHBQCNKYSEP ZWLPXHVYFAPDYOVYRZAR SJSLLHVMZCDBYPQXWLYB NPGNDBMWAOPVXIGLPDXR EOS # puts calc(input) puts calc($stdin)