use std::fmt::Debug; use std::io::{self, Read}; use std::str::{FromStr, SplitWhitespace}; struct IoContent { s: String, } impl IoContent { fn new() -> IoContent { let mut s = String::new(); let _ = io::stdin().read_to_string(&mut s); IoContent { s: s } } } struct IoReader<'a> { inp: SplitWhitespace<'a>, } impl IoReader<'_> { fn new<'a>(inp: &'a IoContent) -> IoReader<'a> { IoReader { inp: inp.s.split_whitespace(), } } fn read(&mut self) -> T where T: std::str::FromStr, ::Err: Debug, { self.inp.next().unwrap().parse::().unwrap() } } fn solve(inp: &mut IoReader, n: u64) -> String { let x: u64 = inp.read(); let s = n.to_string(); let sx = x.to_string(); if sx.find(&s) != None || x % n == 0{ return "Yes".into(); } else { return "No".into(); } } fn main() { let inp = IoContent::new(); let mut inp = IoReader::new(&inp); let n: u64 = inp.read(); let q: usize = inp.read(); let mut ans = String::new(); for _ in 0..q { ans += &solve(&mut inp, n); ans += "\n"; } print!("{ans}"); }