package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh ^ (pow(j+5) * uint64(b[i][j]))
					hhh ^= (pow(j+5) * uint64(v))
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint64 {
	h := uint64(11111111111111111011)
	for i := 0; i < len(s); i++ {
		h ^= (pow(i+5) * uint64(s[i]))
	}
	return h
}

var A uint64 = 1e9 + 7
var pp [2000020]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(17)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(17) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(257)
	base2     = uint64(311)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash2(hash(s, len(s)))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-hash2(uint64(s[i])*powerBase[n-1-i])+mod*mod)%mod + hash2(uint64(letters[j])*powerBase[n-1-i])) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func hash2(h uint64) uint64 {
	return h * base2 % mod
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash2(hash(s, len(s)))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t, lookupIndex := makeBloomFilter(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1 := rollingHash(s, 17, 1e9+7)
		h2 := rollingHash(s, 11, 998244353)

		p17 := make([]int64, len(s))
		p11 := make([]int64, len(s))

		p17[0], p11[0] = 1, 1
		for j := 1; j < len(s); j++ {
			p17[j] = (p17[j-1] * 17) % (1e9 + 7)
			p11[j] = (p11[j-1] * 11) % 998244353
		}

		found := false
		for j := 0; j < len(s) && !found; j++ {
			for ch := byte('a'); ch <= 'c'; ch++ {
				if ch == s[j] {
					continue
				}

				diff := int64(int(ch) - int(s[j]))
				a1 := (h1 + p17[j]*diff + 10*(1e9+7)) % (1e9 + 7)
				a2 := (h2 + p11[j]*diff + 10*998244353) % 998244353

				h := merge(a1, a2)
				if _, ok := t[len(s)][h]; ok == false {
					continue
				}
				for k, _ := range lookupIndex[h] {
					if eq(s, words[k]) {
						found = true
						break
					}
				}
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func eq(s, t string) bool {
	if len(s) != len(t) {
		return false
	}
	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			return true
		}
	}
	return false
}

func makeBloomFilter(words []string) (map[int]map[int64]bool, map[int64]map[int]bool) {
	t := make(map[int]map[int64]bool)
	idx := make(map[int64]map[int]bool)
	for i, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		h1 := rollingHash(w, 17, 1e9+7)
		h2 := rollingHash(w, 11, 998244353)
		h := merge(h1, h2)
		t[len(w)][h] = true
		if idx[h] == nil {
			idx[h] = make(map[int]bool)
		}
		idx[h][i] = true
	}
	return t, idx
}

func merge(a, b int64) int64 {
	return a*(1e9+9) + b
}

func rollingHash(s string, b, mod int64) int64 {
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		d := int64(s[i] - 'a' + 1)
		cur = (cur*b + d) % mod
	}
	return cur
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh ^ (pow(j+5) * uint64(b[i][j]))
					hhh ^= (pow(j+5) * uint64(v))
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint64 {
	h := A
	for i := 0; i < len(s); i++ {
		h ^= (pow(i+5) * uint64(s[i]))
	}
	return h
}

var A uint64 = 11111111111111111011
var pp [2000020]uint64

func pow(a int) uint64 {
	a %= len(pp)
	if a == 1 {
		return uint64(1117)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(1117) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(257)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := makeBloomFilter(words)

	fmt.Println(t)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1 := skipHashes(s, 4, int64(1e9)+7)
		h2 := skipHashes(s, 17, int64(1e9)+9)
		h3 := skipHashes(s, 256, 998244353)
		found := false
		for j := 0; j < len(h1); j++ {
			if t[len(s)][h1[j]] && t[len(s)][h2[j]] && t[len(s)][h3[j]] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func makeBloomFilter(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		for _, h := range skipHashes(w, 4, int64(1e9)+7) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 17, int64(1e9)+9) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 256, 998244353) {
			t[len(w)][h] = true
		}
	}
	return t
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		suff[i] = (cur*b + int64(s[i]-'a'+1)) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		pref = (pref + pws[i]*int64(s[i]-'a'+1)) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := MakeFingerprints(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1s := skipHashes(s, 4, int64(1e9)+7)
		h2s := skipHashes(s, 17, int64(1e9)+9)
		h3s := skipHashes(s, 256, int64(1e9)+9)
		found := false
		for j := 0; j < len(h1s); j++ {
			if t[len(s)][h1s[j]] && t[len(s)][h2s[j]] && t[len(s)][h3s[j]] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func MakeFingerprints(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		for _, h := range skipHashes(w, 4, int64(1e9)+7) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 17, int64(1e9)+9) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 256, int64(1e9)+9) {
			t[len(w)][h] = true
		}
	}
	return t
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		suff[i] = (cur*b + int64(s[i]-'a'+1)) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		pref = (pref + pws[i]*int64(s[i]-'a'+1)) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := MakeFingerprints(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1s := skipHashes(s, 4, int64(1e9)+7)
		h2s := skipHashes(s, 17, int64(1e9)+9)
		found := false
		for j := 0; j < len(h1s); j++ {
			if t[len(s)][h1s[j]] && t[len(s)][h2s[j]] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func MakeFingerprints(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		for _, h := range skipHashes(w, 4, int64(1e9)+7) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 17, int64(1e9)+9) {
			t[len(w)][h] = true
		}
	}
	return t
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		suff[i] = (cur*b + int64(s[i]-'a')) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
			skips = append(skips, skipHash)
		}
		pref = (pref + pws[i]*int64(s[i]-'a')) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := makeBloomFilter(words)
	// fmt.Println(t)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1 := skipHashes(s, 17, int64(1e9)+7)
		h2 := skipHashes(s, 11, 998244353)
		found := false
		for j := 0; j < len(h1); j++ {
			if t[len(s)][merge(h1[j], h2[j])] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func makeBloomFilter(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		h1 := skipHashes(w, 17, int64(1e9)+7)
		h2 := skipHashes(w, 11, 998244353)
		for j := 0; j < len(h1); j++ {
			// fmt.Printf("IDX(%d) [%d] [%d] -> %d\n", j, h1[j], h2[j], merge(h1[j], h2[j]))
			t[len(w)][merge(h1[j], h2[j])] = true
		}
	}
	return t
}

func merge(a, b int64) int64 {
	return a*(1e9+9) + b
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		d := int64(s[i] - 'a' + 1)
		suff[i] = (cur*b + d*d) % mod
		cur = suff[i]
	}

	// fmt.Println(suff)

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		d := int64(s[i] - 'a' + 1)
		pref = (pref + pws[i]*d*d) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t, lookupIndex := makeBloomFilter(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1 := skipHashes(s, 17, int64(1e9)+7)
		h2 := skipHashes(s, 11, 998244353)
		found := false
		for j := 0; j < len(h1); j++ {
			h := merge(h1[j], h2[j])
			if _, ok := t[len(s)][h]; ok == false {
				continue
			}
			for k, _ := range lookupIndex[h] {
				if eq(s, words[k]) {
					found = true
					break
				}
			}
			if found {
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func eq(s, t string) bool {
	if len(s) != len(t) {
		return false
	}
	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			return true
		}
	}
	return false
}

func makeBloomFilter(words []string) (map[int]map[int64]bool, map[int64]map[int]bool) {
	t := make(map[int]map[int64]bool)
	idx := make(map[int64]map[int]bool)
	for i, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		h1 := skipHashes(w, 17, int64(1e9)+7)
		h2 := skipHashes(w, 11, 998244353)
		for j := 0; j < len(h1); j++ {
			h := merge(h1[j], h2[j])
			t[len(w)][h] = true
			if idx[h] == nil {
				idx[h] = make(map[int]bool)
			}
			idx[h][i] = true
		}
	}
	return t, idx
}

func merge(a, b int64) int64 {
	return a*(1e9+9) + b
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		d := int64(s[i] - 'a' + 1)
		suff[i] = (cur*b + d*d) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		d := int64(s[i] - 'a' + 1)
		pref = (pref + pws[i]*d*d) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := MakeFingerprints(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1s := skipHashes(s, 4, int64(1e9)+7)
		h2s := skipHashes(s, 17, int64(1e9)+9)
		found := false
		for j := 0; j < len(h1s); j++ {
			if t[len(s)][h1s[j]] && t[len(s)][h2s[j]] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func MakeFingerprints(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		for _, h := range skipHashes(w, 4, int64(1e9)+7) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 17, int64(1e9)+9) {
			t[len(w)][h] = true
		}
	}
	return t
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		suff[i] = (cur*b + int64(s[i]-'a'+1)) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		pref = (pref + pws[i]*int64(s[i]-'a'+1)) % mod
	}

	return skips
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(t)]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

var A uint64 = 77777777977777777

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(9576890767)
	for i := 0; i < len(s); i++ {
		h += (pow(i%17) * uint64(s[i])) % A
		h %= A
	}
	return h
}

var pp [20]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(7)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = uint64(7) * pow(a-1)
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[string]string)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[a[i]] = a[i]
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			t[j] = 'a'
			if _, exists := ooo[string(t)]; exists {
				O("YES", "\n")
				break
			}
			t[j] = 'b'
			if _, exists := ooo[string(t)]; exists {
				O("YES", "\n")
				break
			}
			t[j] = 'c'
			if _, exists := ooo[string(t)]; exists {
				O("YES", "\n")
				break
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	bb := make([]string, m)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
	}
	ans := make(map[string]string)
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		bb[i] = b[i]
		ans[b[i]] = "NO"
	}
	sort.Strings(bb)
	for i := 0; i < n; i++ {
		for j := 0; j < len(a[i]); j++ {
			t := []byte(a[i])
			t[j] = 'a'
			o := sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
			}
			t[j] = 'b'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
			}
			t[j] = 'c'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
			}
		}
	}
	for i := 0; i < m; i++ {
		O(ans[b[i]], "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[string]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash(a[i])] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(string(t))]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}

		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s string) string {
	ss := make([]byte, 16)
	for i, v := range s {
		ss[i%16] = byte((int(v)*(1e5+7)>>7 + int(s[len(s)-1-i])) % 255)
	}
	return string(ss)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

type node struct {
	childs map[byte]*node
	isLeaf bool
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	t := &node{make(map[byte]*node), false}
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		t.add(a[i])
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		if res, o := t.query(b[i], 0); res && o == 1 {
			O("YES", "\n")
		} else {
			O("NO", "\n")
		}
	}
}

func (t *node) add(s string) {
	if len(s) == 0 {
		t.isLeaf = true
		return
	}
	if _, exists := t.childs[s[0]]; !exists {
		t.childs[s[0]] = &node{make(map[byte]*node), false}
	}
	t.childs[s[0]].add(s[1:])
}

func (t *node) query(s string, o int) (bool, int) {
	if len(s) == 0 {
		return t.isLeaf, o
	}
	if o <= 1 {
		for _, v := range "abc" {
			if p, exists := t.childs[byte(v)]; exists {
				oo := o
				if byte(v) != s[0] {
					oo++
				}
				q, oo := p.query(s[1:], oo)
				if q && oo <= 1 {
					return q, oo
				}
			}
		}
	}
	return false, 0
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh ^ (pow(j) * uint64(b[i][j]))
					hhh ^= (pow(j) * uint64(v))
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(77777777977777777)
	for i := 0; i < len(s); i++ {
		h ^= (pow(i) * uint64(s[i]))
	}
	return h
}

var A uint64 = 1e9 + 7
var pp [2000020]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(7)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(7) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"bufio"
	"crypto/md5"
	"encoding/binary"
	"fmt"
	"io"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint16]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash(a[i])] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(string(t))]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s string) uint16 {
	h := md5.New()
	io.WriteString(h, s)
	return binary.BigEndian.Uint16(h.Sum(nil)[:4])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	bb := make([]string, m)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
	}
	ans := make(map[string]string)
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		bb[i] = b[i]
		ans[b[i]] = "NO"
	}
	sort.Strings(bb)
	for i := 0; i < n; i++ {
		for j := 0; j < len(a[i]); j++ {
			t := []byte(a[i])
			t[j] = 'a'
			o := sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
				i--
				break
			}
			t[j] = 'b'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
				i--
				break
			}
			t[j] = 'c'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				bb = append(bb[:o], bb[o+1:]...)
				i--
				break
			}
		}
	}
	for i := 0; i < m; i++ {
		O(ans[b[i]], "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[string]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash(a[i])] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			if b[i][j] != 'a' {
				t[j] = 'a'
				if _, exists := ooo[hash(string(t))]; exists {
					O("YES", "\n")
					break
				}
			}
			if b[i][j] != 'b' {
				t[j] = 'b'
				if _, exists := ooo[hash(string(t))]; exists {
					O("YES", "\n")
					break
				}
			}
			if b[i][j] != 'c' {
				t[j] = 'c'
				if _, exists := ooo[hash(string(t))]; exists {
					O("YES", "\n")
					break
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s string) string {
	ss := make([]byte, 32)
	for i, v := range s {
		ss[i%32] = byte(((int(v)*(1e9+7))>>7 + int(s[len(s)-1-i])>>7) % 255)
	}
	return string(ss)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	bb := make([]string, m)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
	}
	ans := make(map[string]string)
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		bb[i] = b[i]
		ans[b[i]] = "NO"
	}
	sort.Strings(bb)
	for i := 0; i < n; i++ {
		for j := 0; j < len(a[i]); j++ {
			t := []byte(a[i])
			t[j] = 'a'
			o := sort.SearchStrings(bb, string(t))
			if o < len(b) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				break
			}
			t[j] = 'b'
			o = sort.SearchStrings(bb, string(t))
			if o < len(b) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				break
			}
			t[j] = 'c'
			o = sort.SearchStrings(bb, string(t))
			if o < len(b) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
				break
			}
		}
	}
	for i := 0; i < m; i++ {
		O(ans[b[i]], "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint32]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(t)]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint32 {
	h := uint32(17)
	for i := 0; i < len(s); i++ {
		h += h*fib(i%1000) + uint32(s[i])
		h %= uint32(1e9 + 7)
	}
	return h
}

var fi [1000]uint32

func fib(n int) uint32 {
	if n == 0 || n == 1 {
		return 1
	}
	if fi[n] == 0 {
		fi[n] = fib(n-1) + fib(n-2)
	}
	return fi[n]
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

type node struct {
	childs map[byte]*node
	isLeaf bool
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	t := &node{make(map[byte]*node), false}
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		t.add(a[i])
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		if res, o := t.query(b[i], 0); res && o == 1 {
			O("YES", "\n")
		} else {
			O("NO", "\n")
		}
	}
}

func (t *node) add(s string) {
	if len(s) == 0 {
		t.isLeaf = true
		return
	}
	if _, exists := t.childs[s[0]]; !exists {
		t.childs[s[0]] = &node{make(map[byte]*node), false}
	}
	t.childs[s[0]].add(s[1:])
}

func (t *node) query(s string, o int) (bool, int) {
	if len(s) == 0 {
		return t.isLeaf, o
	}
	qq := string(s[0]) + strings.Trim("abc", string(s[0]))
	if o <= 1 {
		for _, v := range qq {
			if p, exists := t.childs[byte(v)]; exists {
				oo := o
				if byte(v) != s[0] {
					oo++
				}
				q, oo := p.query(s[1:], oo)
				if q && oo <= 1 {
					return q, oo
				}
			}
		}
	}
	return false, o
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	bb := make([]string, m)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
	}
	ans := make(map[string]string)
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		bb[i] = b[i]
		ans[b[i]] = "NO"
	}
	sort.Strings(bb)
	for i := 0; i < n; i++ {
		for j := 0; j < len(a[i]); j++ {
			t := []byte(a[i])
			t[j] = 'a'
			o := sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
			}
			t[j] = 'b'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
			}
			t[j] = 'c'
			o = sort.SearchStrings(bb, string(t))
			if o < len(bb) && bb[o] == string(t) {
				ans[bb[o]] = "YES"
			}
		}
	}
	for i := 0; i < m; i++ {
		O(ans[b[i]], "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint32]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(t)]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint32 {
	h := uint32(17)
	for i := 0; i < len(s); i++ {
		h += h*fib(i%100) + uint32(s[i])
		h %= uint32(1e9 + 7)
	}
	return h
}

var fi [100]uint32

func fib(n int) uint32 {
	if n == 0 || n == 1 {
		return 1
	}
	if fi[n] == 0 {
		fi[n] = fib(n-1) + fib(n-2)
	}
	return fi[n]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[string]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash(a[i])] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(string(t))]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s string) string {
	ss := make([]byte, 64)
	for i, v := range s {
		ss[i%64] = byte((int(v)*(1e3+7)<<3*(i+1) + int(v)<<2 + int(s[len(s)-1-i])<<2*(i+1)) % 255)
	}
	return string(ss)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint32]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					t[j] = byte(v)
					if _, exists := ooo[hash(t)]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint32 {
	h := uint32(17)
	for i := 0; i < len(s); i++ {
		h += h*fib(i%1000) + uint32(s[i])
		h %= uint32(4*1e9 + 7)
	}
	return h
}

var fi [1000]uint32

func fib(n int) uint32 {
	if n == 0 || n == 1 {
		return 1
	}
	if fi[n] == 0 {
		fi[n] = fib(n-1) + fib(n-2)
	}
	return fi[n]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh
					hhh -= (pow(j) * uint64(b[i][j])) % A
					hhh += (pow(j) * uint64(v)) % A
					hhh %= A
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

var A uint64 = 77777777977777777

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(9576890767)
	for i := 0; i < len(s); i++ {
		h += (pow(i) * uint64(s[i])) % A
		h %= A
	}
	return h
}

var pp [2000020]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(3)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(3) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh ^ (pow(j%13) * uint64(b[i][j]))
					hhh ^= (pow(j%13) * uint64(v))
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(77777777977777777)
	for i := 0; i < len(s); i++ {
		h ^= (pow(i%13) * uint64(s[i]))
	}
	return h
}

var pp [30]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(5)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(5) * pow(a-1))
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	bb := make([]string, m)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
	}
	ans := make(map[string]string)
	ooo := make(map[string]string)
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
		bb[i] = b[i]
		ans[b[i]] = "NO"
		ooo[b[i]] = b[i]
	}
	sort.Strings(bb)
	for i := 0; i < n; i++ {
		for j := 0; j < len(a[i]); j++ {
			t := []byte(a[i])
			t[j] = 'a'
			if _, exists := ooo[string(t)]; exists {
				ans[string(t)] = "YES"
			}
			t[j] = 'b'
			if _, exists := ooo[string(t)]; exists {
				ans[string(t)] = "YES"
			}
			t[j] = 'c'
			if _, exists := ooo[string(t)]; exists {
				ans[string(t)] = "YES"
			}
		}
	}
	for i := 0; i < m; i++ {
		O(ans[b[i]], "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh
					hhh -= (pow(j%17) * uint64(b[i][j])) % A
					hhh += (pow(j%17) * uint64(v)) % A
					hhh %= A
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

var A uint64 = 77777777977777777

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(9576890767)
	for i := 0; i < len(s); i++ {
		h += (pow(i%17) * uint64(s[i])) % A
		h %= A
	}
	return h
}

var pp [20]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(7)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = uint64(7) * pow(a-1)
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		qq := false
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh
					hhh -= (pow(j) * uint64(b[i][j])) % A
					hhh += (pow(j) * uint64(v)) % A
					hhh %= A
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						qq = true
						break
					}
				}
			}
		}
		if !qq {
			O("NO", "\n")
		}
	}
}

var A uint64 = 9576890767

func hash(s []byte) uint64 {
	h := uint64(len(s)) ^ uint64(77777777977777777)
	for i := 0; i < len(s); i++ {
		h += (pow(i) * uint64(s[i])) % A
		h %= A
	}
	return h
}

var pp [2000020]uint64

func pow(a int) uint64 {
	if a == 1 {
		return uint64(13)
	}
	if a == 0 {
		return 1
	}
	if pp[a] == 0 {
		pp[a] = (uint64(13) * pow(a-1)) % A
	}
	return pp[a]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	a := make([]string, n)
	b := make([]string, m)
	ooo := make(map[uint64]bool)
	for i := 0; i < n; i++ {
		I(&a[i], "\n")
		ooo[hash([]byte(a[i]))] = true
	}
	for i := 0; i < m; i++ {
		I(&b[i], "\n")
	}
	for i := 0; i < m; i++ {
		var j int
		hh := hash([]byte(b[i]))
		for j = 0; j < len(b[i]); j++ {
			t := []byte(b[i])
			for _, v := range "abc" {
				if b[i][j] != byte(v) {
					hhh := hh ^ (uint64(77777777977777777) ^ (fib(3+j%7) * uint64(v))) ^ (uint64(77777777977777777) ^ (fib(3+j%7) * uint64(t[j])))
					t[j] = byte(v)
					if _, exists := ooo[hhh]; exists {
						O("YES", "\n")
						j = len(b[i])
						break
					}
				}
			}
		}
		if j == len(b[i]) {
			O("NO", "\n")
		}
	}
}

func hash(s []byte) uint64 {
	h := uint64(9576890767)
	for i := 0; i < len(s); i++ {
		h ^= uint64(77777777977777777) ^ (fib(3+i%7) * uint64(s[i]))
	}
	return h
}

var fi [50]uint64

func fib(n int) uint64 {
	if n == 0 || n == 1 {
		return 1
	}
	if fi[n] == 0 {
		fi[n] = fib(n-1) + fib(n-2)
	}
	return fi[n]
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(191)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(65537)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(191)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	if hashes[originalHash] {
		return true
	}

	for i := range s {
		for j := range letters {
			newHash = originalHash - uint64(s[i])*powerBase[n-1-i] + uint64(letters[j])*powerBase[n-1-i]
			if hashes[newHash] {
				return true
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(251)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(378551)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(251)
	base2     = uint64(311)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash2(hash(s, len(s)))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-hash2(uint64(s[i])*powerBase[n-1-i])+mod*mod)%mod + hash2(uint64(letters[j])*powerBase[n-1-i])) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func hash2(h uint64) uint64 {
	return h * base2 % mod
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash2(hash(s, len(s)))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(311)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	if hashes[originalHash] {
		return true
	}

	for i := range s {
		for j := range letters {
			newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
			if hashes[newHash] {
				return true
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(821)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(1999)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(311)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(191)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash(s, len(s))

	if hashes[originalHash] {
		return true
	}

	for i := range s {
		for j := range letters {
			newHash = ((originalHash-uint64(s[i])*powerBase[n-1-i]+mod*mod)%mod + uint64(letters[j])*powerBase[n-1-i]) % mod
			if hashes[newHash] {
				return true
			}
		}
	}

	return false
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash(s, len(s))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	base      = uint64(311)
	base2     = uint64(1999)
	maxN      = int(1e7)
	mod       = uint64(1e9 + 7)
	powerBase = make([]uint64, maxN)
	hashed    = make([]uint64, maxN)
	hashes    = map[uint64]bool{}
	letters   = []byte{'a', 'b', 'c'}
)

func solve(s string, n int) bool {
	var newHash uint64
	originalHash := hash2(hash(s, len(s)))

	for i := range s {
		for j := range letters {
			if letters[j] != s[i] {
				newHash = ((originalHash-hash2(uint64(s[i])*powerBase[n-1-i])+mod*mod)%mod + hash2(uint64(letters[j])*powerBase[n-1-i])) % mod
				if hashes[newHash] {
					return true
				}
			}
		}
	}

	return false
}

func hash2(h uint64) uint64 {
	return h * base2 % mod
}

func initPowerBase() {
	powerBase[0] = 1

	for i := 1; i < maxN; i++ {
		powerBase[i] = powerBase[i-1] * base % mod
	}
}

func hash(s string, n int) uint64 {
	hashed[0] = uint64(s[0])

	for i := 1; i < n; i++ {
		hashed[i] = (hashed[i-1]*base + uint64(s[i])) % mod
	}

	return hashed[n-1]
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var s string
	initPowerBase()

	fmt.Fscanf(r, "%d %d\n", &n, &m)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		hashes[hash2(hash(s, len(s)))] = true
	}

	for i := 0; i < m; i++ {
		fmt.Fscanf(r, "%s\n", &s)
		found := solve(s, len(s))
		if found {
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
		} else {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%s\n", &words[i])
	}

	t := makeBloomFilter(words)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < m; i++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)

		if _, ok := t[len(s)]; ok == false {
			fmt.Fprintf(w, "NO\n")
			continue
		}

		h1 := skipHashes(s, 4, int64(1e9)+7)
		h2 := skipHashes(s, 17, int64(1e9)+9)
		h3 := skipHashes(s, 256, 998244353)
		found := false
		for j := 0; j < len(h1); j++ {
			if t[len(s)][h1[j]] && t[len(s)][h2[j]] && t[len(s)][h3[j]] {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintf(w, "YES\n")
		} else {
			fmt.Fprintf(w, "NO\n")
		}
	}
}

func makeBloomFilter(words []string) map[int]map[int64]bool {
	t := make(map[int]map[int64]bool)
	for _, w := range words {
		if _, ok := t[len(w)]; ok == false {
			t[len(w)] = make(map[int64]bool)
		}
		for _, h := range skipHashes(w, 4, int64(1e9)+7) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 17, int64(1e9)+9) {
			t[len(w)][h] = true
		}
		for _, h := range skipHashes(w, 256, 998244353) {
			t[len(w)][h] = true
		}
	}
	return t
}

func skipHashes(s string, b, mod int64) []int64 {
	suff := make([]int64, len(s))
	cur := int64(0)
	for i := len(s) - 1; i >= 0; i-- {
		suff[i] = (cur*b + int64(s[i]-'a'+1)) % mod
		cur = suff[i]
	}

	pws := make([]int64, len(s))
	pws[0] = 1
	for i := 1; i < len(s); i++ {
		pws[i] = (pws[i-1] * b) % mod
	}

	var skips []int64

	pref := int64(0)
	for i := 0; i < len(s); i++ {
		skipHash := pref
		if i+1 < len(s) {
			skipHash += (suff[i+1] * pws[i]) % mod
			skipHash %= mod
		}
		skips = append(skips, skipHash)
		pref = (pref + pws[i]*int64(s[i]-'a'+1)) % mod
	}

	return skips
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Int []int

func (m Int) Less(i, j int) bool {
	return m[i] <= m[j]
}
func (m Int) Swap(a, b int) {
	tmp := m[a]
	m[a] = m[b]
	m[b] = tmp
}
func (m Int) Len() int {
	return len(m)
}
func main() {
	buf := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make(Int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
	}
	sort.Sort(mat)
	res := int64(0)
	for i := 0;i < n-i-1;i++{
		tmp := int64(mat[i])+int64(mat[n-i-1])
		res += tmp*tmp
	}
	fmt.Printf("%d\n",res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	var vs = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &vs[i])
	}
	sort.Ints(vs)
	var ans int64
	for i := 0; i < n/2; i++ {
		ans += sqr(vs[i] + vs[n-i-1])
	}
	fmt.Println(ans)
}

func sqr(x int) int64 {
	return int64(x) * int64(x)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	hw := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &hw[i])
	}

	sort.Ints(hw)
	var count int64
	for i := 0; i < n/2; i++ {
		count += int64(math.Pow(float64(hw[i]+hw[n-i-1]), 2.00))
	}

	fmt.Println(count)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n int
	var t1, ans int64
	arr := []int{}
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%d ", &t1)
		arr = append(arr, int(t1))
	}
	sort.Ints(arr)
	for i := 0; i < n/2; i++ {
		t1 = int64(arr[i] + arr[n-i-1])
		t1 *= t1
		ans += t1
	}
	printf("%d", ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var result int64
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}
	sort.Ints(a)
	for i := 0; i < n/2; i++ {
		result += (int64(a[i]) + int64(a[n-i-1])) * (int64(a[i]) + int64(a[n-i-1]))
	}
	fmt.Println(result)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, res int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	for i := 0; i < n/2; i++ {
		res += (a[i] + a[n-i-1]) * (a[i] + a[n-i-1])
	}
	fmt.Println(res)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	hw := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &hw[i])
	}

	sort.Ints(hw)
	var count float64
	for i := 0; i < n/2; i++ {
		count += math.Pow(float64(hw[i]+hw[n-i-1]), 2.00)
	}

	fmt.Println(count)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

const (
	MaxN = 1 << 18
)

type pos struct {
	val, index, sortIndex int64
}

var n, ans int64
var idx [MaxN]int64
var a [MaxN]pos
var b [MaxN]int64

func ask(k int64) int64 {
	return query(n) - query(k - 1)
}

func query(pos int64) int64 {
	cnt := int64(0)
	for pos > 0 {
		cnt += idx[pos]
		pos -= pos & -pos
	}
	return cnt
}

func update(pos int64) {
	for pos < MaxN {
		idx[pos]++
		pos += pos & -pos
	}
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	for i := int64(0); i < n; i++ {
		fmt.Fscanf(buf, "%d", &a[i].val)
		if a[i].val > n {
			a[i].val = n
		}
		b[i] = a[i].val
		a[i].index = i + 1
		a[i].sortIndex = min(i, a[i].val)
	}
	sort.Slice(a[:n], func(i, j int) bool {
		if a[i].sortIndex < a[j].sortIndex {
			return true
		}
		if a[i].sortIndex > a[j].sortIndex {
			return false
		}
		return a[i].index < a[j].index
	})
	k := int64(0)
	for i := int64(0); i < n; i++ {
		for k < n && a[k].sortIndex <= i {
			ans += ask(a[k].index)
			k++
		}
		update(b[i])
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"sort"
)

type stNode struct {
	l, r int
	vals []int
}
type segmentTree []stNode

func (t segmentTree) _pushUp(o int) []int {
	a, b := t[o<<1].vals, t[o<<1|1].vals
	i, n := 0, len(a)
	j, m := 0, len(b)
	res := make([]int, 0, n+m)
	for {
		if i == n {
			return append(res, b[j:]...)
		}
		if j == m {
			return append(res, a[i:]...)
		}
		if a[i] < b[j] {
			res = append(res, a[i])
			i++
		} else {
			res = append(res, b[j])
			j++
		}
	}
}

func (t segmentTree) _build(arr []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].vals = []int{arr[l-1]}
		return
	}
	m := (l + r) >> 1
	t._build(arr, o<<1, l, m)
	t._build(arr, o<<1|1, m+1, r)
	t[o].vals = t._pushUp(o)
}

func (t segmentTree) _query(o, l, r, x int) (res int) {
	if l <= t[o].l && t[o].r <= r {
		a := t[o].vals
		return len(a) - sort.SearchInts(a, x)
	}
	m := (t[o].l + t[o].r) >> 1
	if l <= m {
		res += t._query(o<<1, l, r, x)
	}
	if r > m {
		res += t._query(o<<1|1, l, r, x)
	}
	return
}

func (t segmentTree) init(arr []int)        { t._build(arr, 1, 1, len(arr)) }
func (t segmentTree) query(l, r, x int) int { return t._query(1, l, r, x) }

// github.com/EndlessCheng/codeforces-go
func CF961E(_r io.Reader, _w io.Writer) {
	min := func(a, b int) int {
		if a < b {
			return a
		}
		return b
	}
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}

	t := make(segmentTree, 4*n)
	t.init(a)
	ans := int64(0)
	for i, v := range a[:n-1] {
		if v > i+1 {
			ans += int64(t.query(i+2, min(v, n), i+1))
		}
	}
	Fprint(out, ans)
}

func main() {
	CF961E(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	MaxN = 1 << 18
)

var n, ans int64
var idx [MaxN]int64

func ask(i int64) int64 {
	return query(n+1) - query(i)
}

func query(pos int64) int64 {
	cnt := int64(0)
	for pos > 0 {
		cnt += idx[pos]
		pos -= pos & -pos
	}
	return cnt
}

func update(pos int64) {
	for pos < MaxN {
		idx[pos]++
		pos += pos & -pos
	}
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	for i := int64(0); i < n; i++ {
		var tmp int64
		fmt.Fscanf(buf, "%d", &tmp)
		if tmp > n {
			tmp = n
		}
		ans += ask(i)
		update(tmp)
	}
	fmt.Println(ans)
}


package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	inp := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	is, err := inp.ReadString('\n')
	if err != nil {
		out.WriteString("-1")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l1 := strings.Split(is, " ")
	if len(l1) != 2 {
		out.WriteString("-2")
		out.Flush()
		return
	}
	n, err := strconv.Atoi(l1[0])
	if err != nil {
		out.WriteString("-3")
		out.Flush()
		return
	}
	k, err := strconv.Atoi(l1[1])
	if err != nil {
		out.WriteString("-4")
		out.Flush()
		return
	}
	is, err = inp.ReadString('\n')
	if err != nil {
		out.WriteString("-5")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l2 := strings.Split(is, " ")
	if len(l2) != n {
		out.WriteString("-6")
		out.Flush()
		return
	}

	sum := int64(0)
	div := n - k + 1
	k = int(math.Min(float64(div), float64(k)))
	lb := k - 1
	rb := n - k
	for i := 0; i < n; i++ {
		a, err := strconv.Atoi(l2[i])
		if err != nil {
			out.WriteString("-7")
			out.Flush()
			return
		}
		if i < lb {
			sum += int64(a) * int64(i+1)
		} else if i > rb {
			k--
			sum += int64(a) * int64(k)
		} else {
			sum += int64(a) * int64(k)
		}
	}
	res := float64(sum) / float64(div)
	out.WriteString(strconv.FormatFloat(res, 'f', 10, 64))
	out.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n, k int
	var initSumm float64
	var total, tmp float64
	fmt.Scanf("%d %d\n", &n, &k)
	answer := make([]float64, n)
	summ := make([]float64, n-k+1)
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	for i, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
		tmp, _ = strconv.ParseFloat(j, 64)
		answer[i] = tmp
	}
	tmp = float64(n - k + 1)
	for h := 0; h < k; h++ {
		initSumm += answer[h]
	}
	summ[0] = initSumm
	for i := 1; i < (n - k + 1); i++ {
		initSumm = initSumm - answer[i-1]
		initSumm = initSumm + answer[i+k-1]
		summ[i] = initSumm
	}
	for _, j := range summ {
		total += j
	}
	fmt.Println(total / tmp)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n, k, tmp int
	var initSumm float64
	var total float64
	fmt.Scanf("%d %d\n", &n, &k)
	answer := make([]float64, n)
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	for i, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
		answer[i], _ = strconv.ParseFloat(j, 64)
	}
	tmp = n - k + 1
	for h := 0; h < k; h++ {
		initSumm += answer[h]
	}
	total += initSumm
	for i := 1; i < tmp; i++ {
		initSumm = initSumm - answer[i-1]
		initSumm = initSumm + answer[i+k-1]
		total += initSumm
	}
	fmt.Println(total / float64(tmp))
}

package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	inp := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	is, err := inp.ReadString('\n')
	if err != nil {
		out.WriteString("-1")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l1 := strings.Split(is, " ")
	if len(l1) != 2 {
		out.WriteString("-2")
		out.Flush()
		return
	}
	n, err := strconv.Atoi(l1[0])
	if err != nil {
		out.WriteString("-3")
		out.Flush()
		return
	}
	k, err := strconv.Atoi(l1[1])
	if err != nil {
		out.WriteString("-4")
		out.Flush()
		return
	}
	is, err = inp.ReadString('\n')
	if err != nil {
		out.WriteString("-5")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l2 := strings.Split(is, " ")
	if len(l2) != n {
		out.WriteString("-6")
		out.Flush()
		return
	}

	sum := 0
	div := n - k + 1
	k = int(math.Min(float64(div), float64(k)))
	lb := k - 1
	rb := n - k
	for i := 0; i < n; i++ {
		a, err := strconv.Atoi(l2[i])
		if err != nil {
			out.WriteString("-7")
			out.Flush()
			return
		}
		if i < lb {
			sum += a * (i + 1)
		} else if i > rb {
			k--
			sum += a * k
		} else {
			sum += a * k
		}
	}
	res := float64(sum) / float64(div)
	out.WriteString(strconv.FormatFloat(res, 'f', 10, 64))
	out.Flush()
}

package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
)

func main() {
	inp := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	is, err := inp.ReadString('\n')
	if err != nil {
		out.WriteString("-1")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l1 := strings.Split(is, " ")
	if len(l1) != 2 {
		out.WriteString("-2")
		out.Flush()
		return
	}
	n, err := strconv.Atoi(l1[0])
	if err != nil {
		out.WriteString("-3")
		out.Flush()
		return
	}
	k, err := strconv.Atoi(l1[1])
	if err != nil {
		out.WriteString("-4")
		out.Flush()
		return
	}
	is, err = inp.ReadString('\n')
	if err != nil {
		out.WriteString("-5")
		out.Flush()
		return
	}
	is = strings.TrimRight(is, "\n\r\t ")
	l2 := strings.Split(is, " ")
	if len(l2) != n {
		out.WriteString("-6")
		out.Flush()
		return
	}
	lb := k - 1
	rb := n - k
	sum := 0
	div := float64(n - k + 1)
	for i := 0; i < n; i++ {
		a, err := strconv.Atoi(l2[i])
		if err != nil {
			out.WriteString("-7")
			out.Flush()
			return
		}
		if i < lb {
			sum += a * (i + 1)
		} else if i > rb {
			k--
			sum += a * k
		} else {
			sum += a * k
		}
	}
	res := float64(sum) / div
	out.WriteString(strconv.FormatFloat(res, 'f', 16, 64))
	out.Flush()
}