gets s=gets p r=0..3e3 puts s[?#]&&r.any?{|d|t=s*1 r.all?{|i|t[i]==?#?t[i-=~d]==?#&&t[i]=?::0}}?:YES:"NO"