#! ruby # Try yukicoder # author: Leornadone @ NEETSDKASU N = gets.to_i S = gets.chomp # S[i,j] # S[j+1,j+(j+1-i)] = S[j+1,j+1+(j-i)] m = Hash.new N.times do |i| i.upto(N) do |j| k =S[i..j] if m.include? k b = (j - 1) - (j - i) if m[k].include? b puts "YES" exit end m[k][i] = true else m[k] = {i => true} end end end puts "NO"