#[allow(unused_imports)] use std::cmp::{max, min, Ordering}; #[allow(unused_imports)] use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque}; #[allow(unused_imports)] use std::iter::FromIterator; #[allow(unused_imports)] use std::io::stdin; mod util { use std::io::stdin; use std::str::FromStr; use std::fmt::Debug; #[allow(dead_code)] pub fn line() -> String { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.trim().to_string() } #[allow(dead_code)] pub fn gets() -> Vec where ::Err: Debug, { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse().unwrap()) .collect() } } #[allow(unused_macros)] macro_rules! get { ($t:ty) => { { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.trim().parse::<$t>().unwrap() } }; ($($t:ty),*) => { { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( $(iter.next().unwrap().parse::<$t>().unwrap(),)* ) } }; ($t:ty; $n:expr) => { (0..$n).map(|_| get!($t) ).collect::>() }; ($($t:ty),*; $n:expr) => { (0..$n).map(|_| get!($($t),*) ).collect::>() }; ($t:ty ;;) => { { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse::<$t>().unwrap()) .collect::>() } }; } #[allow(unused_macros)] macro_rules! debug { ($($a:expr),*) => { println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*); } } fn main() { let (h, w) = get!(usize, usize); let ss: Vec> = (0..h) .map(|_| util::line().chars().map(|c| c == '#').collect()) .collect(); for dy in 0..h { 'dx: for dx in 0..w { if dx == 0 && dy == 0 { continue; } let mut t = ss.clone(); for y in 0..h { for x in 0..w { if !t[y][x] { continue; } if t[y][x] && y + dy < h && x + dx < w && t[y + dy][x + dx] { t[y][x] = false; t[y + dy][x + dx] = false; } else { // debug!(dy, dx, y, x, &t); continue 'dx; } } } println!("YES"); return; } } println!("NO"); }