package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}

    toExplore := []int64{1}
    var explore func()
    explore = func() {
        tmp := []int64{}
        for _, i := range toExplore {
            for k := range matrix[i] {
                if nodes[k] != nil {
                    continue
                }
                nodes[k] = &Node{
                    Val:    k,
                    Parent: nodes[i],
                }
                tmp = append(tmp, k)
            }
        }
        if len(tmp) > 0 {
            toExplore = tmp
            explore()
        }
    }
	explore()

    for ; m > 0; m-- {
        writer.Printf("%s\n", sol(nodes))
    }
}

func sol(nodes map[int64]*Node) string {
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
			return "NO"
		}
		tail = newTail
	}
	return "YES"
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}

    toExplore := []int64{1}
    var explore func()
    explore = func() {
        tmp := []int64{}
        for _, i := range toExplore {
            for k := range matrix[i] {
                if nodes[k] != nil {
                    continue
                }
                nodes[k] = &Node{
                    Val:    k,
                    Parent: nodes[i],
                }
                tmp = append(tmp, k)
            }
        }
        if len(tmp) > 0 {
            toExplore = tmp
            explore()
        }
    }
	explore()

    for ; m > 0; m-- {
        writer.Printf("%s\n", sol(nodes))
    }
}

func sol(nodes map[int64]*Node) string {
    ret := "YES"
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
            ret = "NO"
		}
		tail = newTail
	}
	return ret
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}

    var explore func(int64)
    explore = func(i int64) {
        for k := range matrix[i] {
            if nodes[k] != nil {
                continue
            }
            nodes[k] = &Node{
                Val:    k,
                Parent: nodes[i],
            }
            explore(k)
        }
    }
	explore(1)

    for ; m > 0; m-- {
        writer.Printf("%s\n", sol(nodes))
    }
}

func sol(nodes map[int64]*Node) string {
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
			return "NO"
		}
		tail = newTail
	}
	return "YES"
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}

    toExplore := []int64{1}
    var explore func()
    explore = func() {
        tmp := []int64{}
        for _, i := range toExplore {
            for k := range matrix[i] {
                if nodes[k] != nil {
                    continue
                }
                nodes[k] = &Node{
                    Val:    k,
                    Parent: nodes[i],
                }
                tmp = append(tmp, k)
            }
        }
        if len(tmp) > 0 {
            toExplore = tmp
            explore()
        }
    }
	explore()

    for ; m > 0; m-- {
        writer.Printf("%s\n", sol(nodes))
    }
}

func sol(nodes map[int64]*Node) string {
    ret := "YES"
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
        if ret == "NO" {
            continue
        }
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
            ret = "NO"
		}
		tail = newTail
	}
	return ret
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if nodes[u] == nil && nodes[v] == nil {
			panic("no node to attach to")
		}
		if nodes[u] != nil && nodes[v] != nil {
			//panic("edge already exists") // should not happen?
		}
		if nodes[v] == nil {
			nodes[v] = &Node{
				Val:    v,
				Parent: nodes[u],
			}
		}
		if nodes[u] == nil {
			nodes[u] = &Node{
				Val:    u,
				Parent: nodes[v],
			}
		}
	}
	for ; m > 0; m-- {
		writer.Printf("%s\n", sol(nodes))
	}
}

func sol(nodes map[int64]*Node) string {
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
			return "NO"
		}
		tail = newTail
	}
	return "YES"
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if nodes[u] == nil {
			panic("no node to attach to")
		}
		nodes[v] = &Node{
			Val:    v,
			Parent: nodes[u],
		}
	}
	for ; m > 0; m-- {
		writer.Printf("%s\n", sol(nodes))
	}
}

func sol(nodes map[int64]*Node) string {
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
        if tmp[curr.Val] {
            continue
        }
        newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
			return "NO"
		}
        tail = newTail
	}
	return "YES"
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Val    int64
	Parent *Node
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}
	nodes := map[int64]*Node{
		1: &Node{
			Val:    1,
			Parent: nil,
		},
	}

    var explore func(int64)
    explore = func(i int64) {
        for k := range matrix[i] {
            if nodes[k] != nil {
                continue
            }
            fmt.Printf("%d\n", k)
            nodes[k] = &Node{
                Val:    k,
                Parent: nodes[i],
            }
            explore(k)
        }
    }
	explore(1)

    for ; m > 0; m-- {
        writer.Printf("%s\n", sol(nodes))
    }
}

func sol(nodes map[int64]*Node) string {
	k := reader.NextInt64()
	tmp := map[int64]bool{1: true}
	tail := int64(1)
	for ; k > 0; k-- {
		v := reader.NextInt64()
		if tmp[v] {
			continue
		}
		curr := nodes[v].Parent // start with parent
		if tmp[curr.Val] {
			continue
		}
		newTail := curr.Val
		for !tmp[curr.Val] {
			tmp[curr.Val] = true
			curr = curr.Parent
		}
		if curr.Val != tail {
			return "NO"
		}
		tail = newTail
	}
	return "YES"
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

type Node struct {
	Parent int64
	In     int64
	Out    int64
}

type counter struct {
	val int64
}

func (c *counter) Next() int64 {
	c.val++
	return c.val
}

func main() {
	defer writer.Flush()
	n, m := reader.NextInt64(), reader.NextInt64()
	matrix := map[int64]map[int64]bool{}
	for ; n > 1; n-- {
		u, v := reader.NextInt64(), reader.NextInt64()
		if matrix[u] == nil {
			matrix[u] = map[int64]bool{}
		}
		if matrix[v] == nil {
			matrix[v] = map[int64]bool{}
		}
		matrix[u][v] = true
		matrix[v][u] = true
	}

	nodes := map[int64]*Node{}
	c := &counter{}
	var dfs func(int64, int64)
	dfs = func(from, to int64) {
		nodes[to] = &Node{Parent: from}
		nodes[to].In = c.Next()
		for k := range matrix[to] {
			if nodes[k] == nil {
				dfs(to, k)
			}
		}
		nodes[to].Out = c.Next()
	}
	dfs(-1, 1)

	for ; m > 0; m-- {
		writer.Printf("%s\n", sol(nodes))
	}
}

func sol(nodes map[int64]*Node) string {
    k := reader.NextInt64()
    vv := []int64{}
    for ; k > 0; k-- {
        vv = append(vv, reader.NextInt64())
    }
    minSoFar := nodes[1].In
    maxSoFar := nodes[1].Out
    for _, v := range vv {
        if nodes[v] == nil {
            // should not happen
            return "NO"
        }
        if v == 1 {
            continue
        }
        parent := nodes[nodes[v].Parent]
        if parent.In > minSoFar && parent.Out < maxSoFar {
            minSoFar = parent.In
            maxSoFar = parent.Out
            continue
        }
        if parent.In <= minSoFar && parent.Out >= maxSoFar {
            continue
        }
        return "NO"
    }
	return "YES"
}


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
import collections,threading
sys.setrecursionlimit(10**9)
threading.stack_size(10**8)

def main():
    class Graph(object):
        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            if node not in self.neighbours:
                self.neighbours[node] = []
            else:
                raise Exception("Node %s is already in graph" % node)

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def neighbors(self, node):
            if node not in self.neighbours:
                raise "Node %s not in graph" % node
            return self.neighbours[node]

    def dfs(g, v, visited, parent):
        visited[v] = 1
        intime[v-1] = timer[0]
        timer[0] += 1
        parents[v] = parent
        for i in range(len(g.neighbors(v))):
            child = g.neighbours[v][i]
            if child not in visited:
                dfs(g,child,visited,v)
        outtime[v-1] = timer[0]
        timer[0] += 1

    def inPath(x, y):
        return intime[x-1] <= intime[y-1] and outtime[x-1] >= outtime[y-1]

    g = Graph()
    n,q=map(int,input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited = {}
    timer = [0]
    intime = [0]*n
    outtime = [0]*n
    parents = {}
    dfs(g, 1, visited, 1)
    for i in range(q):
        lis = list(map(int,input().split()))[1:]
        tmpPars = [parents[x] for x in lis]
        tmpPars = list(set(tmpPars))
        tmpPars.sort()
        for j in range(len(tmpPars) - 1):
            if not inPath(tmpPars[j], tmpPars[j + 1]):
                print("NO")
                break
        else:
            print("YES")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

threading.Thread(target=main).start()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    from types import GeneratorType
    def bootstrap(f, stack=[]):
        def wrappedfunc(*args, **kwargs):
            if stack:
                return f(*args, **kwargs)
            else:
                to = f(*args, **kwargs)
                while True:
                    if type(to) is GeneratorType:
                        stack.append(to)
                        to = next(to)
                    else:
                        stack.pop()
                        if not stack:
                            break
                        to = stack[-1].send(to)
                return to
        return wrappedfunc
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        @bootstrap
        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    yield self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1
            yield

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit((10 ** 5)*5)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit((10 ** 5)*3)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):
        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            if node not in self.neighbours:
                self.neighbours[node] = []
            else:
                raise Exception("Node %s is already in graph" % node)

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def neighbors(self, node):
            if node not in self.neighbours:
                raise "Node %s not in graph" % node
            return self.neighbours[node]

        def dfs(self, v, visited, parent):
            visited[v] = 1
            intime[v-1] = timer[0]
            timer[0] += 1
            parents[v] = parent
            for i in range(len(self.neighbors(v))):
                child = self.neighbours[v][i]
                if child not in visited:
                    self.dfs(child,visited,v)
            outtime[v-1] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        if intime[x-1] <= intime[y-1] and outtime[x-1] >= outtime[y-1]:
            return True
        return False

    g = Graph()
    n,q=map(int,input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited = {}
    timer = [0]
    intime = [0]*n
    outtime = [0]*n
    parents = {}
    g.dfs(1, visited, 1)
    for i in range(q):
        lis = list(map(int,input().split()))[1:]
        tmpPars = [parents[x] for x in lis]
        tmpPars = list(set(tmpPars))
        tmpPars.sort()
        for j in range(len(tmpPars) - 1):
            if not inPath(tmpPars[j], tmpPars[j + 1]):
                print("NO")
                break
        else:
            print("YES")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 6)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit((10 ** 5)*2)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    sys.setrecursionlimit(10 ** 6)
    from types import GeneratorType
    def bootstrap(f, stack=[]):
        def wrappedfunc(*args, **kwargs):
            if stack:
                return f(*args, **kwargs)
            else:
                to = f(*args, **kwargs)
                while True:
                    if type(to) is GeneratorType:
                        stack.append(to)
                        to = next(to)
                    else:
                        stack.pop()
                        if not stack:
                            break
                        to = stack[-1].send(to)
                return to
        return wrappedfunc
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        @bootstrap
        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    yield self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1
            yield

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    from types import GeneratorType
    def bootstrap(f, stack=[]):
        def wrappedfunc(*args, **kwargs):
            if stack:
                return f(*args, **kwargs)
            else:
                to = f(*args, **kwargs)
                while True:
                    if type(to) is GeneratorType:
                        stack.append(to)
                        to = next(to)
                    else:
                        stack.pop()
                        if not stack:
                            break
                        to = stack[-1].send(to)
                return to
        return wrappedfunc
    class Graph(object):
        DEFAULT_WEIGHT = 1
        DIRECTED = False

        def __init__(self):
            self.neighbours = {}

        def __str__(self):
            return "Undirected Graph \nNodes: %s \nEdges: %s" % (self.nodes(), self.edges())

        def add_nodes(self, nodes):
            for node in nodes:
                self.add_node(node)

        def add_node(self, node):
            if node not in self.neighbours:
                self.neighbours[node] = []
            else:
                raise Exception("Node %s is already in graph" % node)

        def has_node(self, node):
            return node in self.neighbours

        def add_edges(self, edges):
            for edge in edges:
                self.add_edge(edge)

        def add_edge(self, edge, wt=DEFAULT_WEIGHT):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def has_edge(self, edge):
            u, v = edge
            return v in self.neighbours.get(u,[])

        def nodes(self):
            return self.neighbours.keys()

        def neighbors(self, node):
            if node not in self.neighbours:
                raise "Node %s not in graph" % node
            return self.neighbours[node]

        def edges(self):
            edge_list = []
            for node in self.nodes():
                edges = [(node,each) for each in self.neighbors(node)]
                edge_list.extend(edges)
            return edge_list

        @bootstrap
        def dfs(self, v, visited, parent):
            visited[v] = 1
            intime[v-1] = timer[0]
            timer[0] += 1
            parents[v] = parent
            for i in range(len(self.neighbors(v))):
                child = self.neighbours[v][i]
                if child not in visited:
                    yield self.dfs(child,visited,v)
            outtime[v-1] = timer[0]
            timer[0] += 1
            yield

    def inPath(x, y):
        if intime[x-1] < intime[y-1] and outtime[x-1] > outtime[y-1]:
            return True
        return False

    g = Graph()
    n,q=map(int,input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited = {}
    timer = [0]
    intime = [0]*n
    outtime = [0]*n
    parents = {}
    g.dfs(1, visited, 1)
    for i in range(q):
        lis = list(map(int,input().split()))[1:]
        tmpPars = [parents[x] for x in lis]
        tmpPars = list(set(tmpPars))
        tmpPars.sort()
        for j in range(len(tmpPars) - 1):
            if not inPath(tmpPars[j], tmpPars[j + 1]):
                print("NO")
                break
        else:
            print("YES")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):

        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            self.neighbours[node] = []

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def dfs(self, v, parent, depth=0):
            parents[v] = parent
            depths[v] = depth
            visited[v] = 1
            intime[v] = timer[0]
            timer[0] += 1
            for child in self.neighbours[v]:
                if visited[child] == 0:
                    self.dfs(child, v, depth + 1)
            outtime[v] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        return intime[x] <= intime[y] and outtime[x] >= outtime[y]

    g = Graph()
    n, q = map(int, input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited, intime, outtime = [0] * (n + 1), [0] * (n + 1), [0] * (n + 1)
    timer = [0]
    parents, depths = {}, {}
    g.dfs(1, -1)
    for i in range(q):
        lis = list(map(int, input().split()))[1:]
        deep = lis[0]
        for j in lis:
            if depths[deep] < depths[j]:
                deep = j
        for j in range(len(lis)):
            if lis[j] == deep:
                continue
            if parents[lis[j]]!=-1:
                lis[j] = parents[lis[j]]
        ok = True
        for j in lis:
            ok = ok & inPath(j, deep)
        print("YES") if ok else print("NO")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(10**6)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    class Graph(object):
        def __init__(self):
            self.neighbours = {}

        def add_node(self, node):
            if node not in self.neighbours:
                self.neighbours[node] = []
            else:
                raise Exception("Node %s is already in graph" % node)

        def add_edge(self, edge):
            u, v = edge
            self.neighbours[u].append(v)
            self.neighbours[v].append(u)

        def neighbors(self, node):
            if node not in self.neighbours:
                raise "Node %s not in graph" % node
            return self.neighbours[node]

        def dfs(self, v, visited, parent):
            visited[v] = 1
            intime[v-1] = timer[0]
            timer[0] += 1
            parents[v] = parent
            for i in range(len(self.neighbors(v))):
                child = self.neighbours[v][i]
                if child not in visited:
                    self.dfs(child,visited,v)
            outtime[v-1] = timer[0]
            timer[0] += 1

    def inPath(x, y):
        if intime[x-1] <= intime[y-1] and outtime[x-1] >= outtime[y-1]:
            return True
        return False

    g = Graph()
    n,q=map(int,input().split())
    for i in range(n):
        g.add_node(i + 1)
    for i in range(n - 1):
        x, y = map(int, input().split())
        g.add_edge((x, y))
    visited = {}
    timer = [0]
    intime = [0]*n
    outtime = [0]*n
    parents = {}
    g.dfs(1, visited, 1)
    for i in range(q):
        lis = list(map(int,input().split()))[1:]
        tmpPars = [parents[x] for x in lis]
        tmpPars = list(set(tmpPars))
        tmpPars.sort()
        for j in range(len(tmpPars) - 1):
            if not inPath(tmpPars[j], tmpPars[j + 1]):
                print("NO")
                break
        else:
            print("YES")

# region fastio
# Credits
# # template credits to cheran-senthil's github Repo

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


from __future__ import division, print_function
from random import randint as rn
def main():
    from collections import deque
    class LCA:
        def __init__(self, n, edges):
            # Assuming Tree is rooted at 1
            q = deque()
            q.append(1)
            self.parents = [ [1]*30 for _ in range(n+1)]

            self.depth = [-1] * (n + 1)
            self.depth[1] = 0

            while q:
                u = q.popleft()
                for v in edges[u]:
                    if self.depth[v] == -1:
                        q.append(v)
                        self.depth[v] = self.depth[u] + 1
                        self.parents[v][0] = u

                        for i in range(1,30):
                            self.parents[v][i] = self.parents[self.parents[v][i-1]][i-1]

        def get_parent(self, node, dist):
            while dist:
                i = dist.bit_length() - 1
                node = self.parents[node][i]
                dist ^= 1 << i
            return node

        def get_lca(self, u, v):
            if self.depth[u] > self.depth[v]:
                u, v = v, u
            v = self.get_parent(v, self.depth[v] - self.depth[u])

            for i in reversed(range(30)):
                pu = self.parents[u][i]
                pv = self.parents[v][i]

                if pu!=pv:
                    u = pu
                    v = pv
            return u if u == v else self.parents[u][0]

    n, m = map(int, input().split())
    edges = [[] for _ in range(n+1)]
    for i in range(n-1):
        u, v = map(int, input().split())
        edges[u].append(v)
        edges[v].append(u)

    my_lca = LCA(n, edges)

    out = []
    for i in range(m):
        nodes = list(map(int, input().split()))
        nodes = nodes[1:]
        u = nodes[0]
        for v in nodes:
            if my_lca.depth[v] > my_lca.depth[u]:
                u = v
        flag = 0

        for v in nodes:
            common_parent = my_lca.get_lca(u, v)
            if common_parent == v or my_lca.parents[v][0] == common_parent:
                continue
            else:
                flag = 1
                break

        if flag == 1:
            out.append("NO")
        else:
            out.append("YES")

    print(*out, sep = "\n")

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()


from __future__ import division, print_function
from random import randint as rn
def main():
    from collections import deque
    class LCA:
        def __init__(self, n, edges):
            # Assuming Tree is rooted at 1
            q = deque()
            q.append(1)
            self.parents = [ [1]*30 for _ in range(n+1)]

            self.depth = [-1] * (n + 1)
            self.depth[1] = 0

            while q:
                u = q.popleft()
                for v in edges[u]:
                    if self.depth[v] == -1:
                        q.append(v)
                        self.depth[v] = self.depth[u] + 1
                        self.parents[v][0] = u
                        power = 2
                        i = 1
                        temp = self.depth[v]
                        while power <= temp:
                            self.parents[v][i] = self.parents[self.parents[v][i-1]][i-1]
                            power *= 2
                            i += 1

        def get_parent(self, node, dist):
            while dist:
                i = dist.bit_length() - 1
                node = self.parents[node][i]
                dist ^= 1 << i
            return node

        def get_lca(self, u, v):
            if self.depth[u] > self.depth[v]:
                u, v = v, u
            v = self.get_parent(v, self.depth[v] - self.depth[u])

            for i in reversed(range(30)):
                pu = self.parents[u][i]
                pv = self.parents[v][i]

                if pu!=pv:
                    u = pu
                    v = pv
            return u if u == v else self.parents[u][0]

    n, m = map(int, input().split())
    edges = [[] for _ in range(n+1)]
    for i in range(n-1):
        u, v = map(int, input().split())
        edges[u].append(v)
        edges[v].append(u)

    my_lca = LCA(n, edges)

    for i in range(m):
        nodes = list(map(int, input().split()))
        nodes = nodes[1:]
        u = nodes[0]
        for v in nodes:
            if my_lca.depth[v] > my_lca.depth[u]:
                u = v
        flag = 0

        for v in nodes:
            common_parent = my_lca.get_lca(u, v)
            if common_parent == v or my_lca.parents[v][0] == common_parent:
                continue
            else:
                flag = 1
                break

        if flag == 1:
            print("NO")
        else:
            print("YES")

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()


from __future__ import division, print_function
from random import randint as rn
def main():
    from collections import deque
    class LCA:
        def __init__(self, n, edges):
            # Assuming Tree is rooted at 1
            q = deque()
            q.append(1)
            self.parents = [ [1]*30 for _ in range(n+1)]

            self.depth = [-1] * (n + 1)
            self.depth[1] = 0

            while q:
                u = q.popleft()
                for v in edges[u]:
                    if self.depth[v] == -1:
                        q.append(v)
                        self.depth[v] = self.depth[u] + 1
                        self.parents[v][0] = u

                        power = 2
                        i = 1
                        temp = self.depth[v]
                        while power <= temp:
                            self.parents[v][i] = self.parents[self.parents[v][i-1]][i-1]
                            power *= 2
                            i += 1

        def get_parent(self, node, dist):
            while dist:
                i = dist.bit_length() - 1
                node = self.parents[node][i]
                dist ^= 1 << i
            return node

        def get_lca(self, u, v):
            if self.depth[u] > self.depth[v]:
                u, v = v, u
            v = self.get_parent(v, self.depth[v] - self.depth[u])

            for i in reversed(range(30)):
                pu = self.parents[u][i]
                pv = self.parents[v][i]

                if pu!=pv:
                    u = pu
                    v = pv
            return u if u == v else self.parents[u][0]

    n, m = map(int, input().split())
    edges = [[] for _ in range(n+1)]
    for i in range(n-1):
        u, v = map(int, input().split())
        edges[u].append(v)
        edges[v].append(u)

    my_lca = LCA(n, edges)

    out = []
    for i in range(m):
        nodes = list(map(int, input().split()))
        nodes = nodes[1:]
        u = nodes[0]
        for v in nodes:
            if my_lca.depth[v] > my_lca.depth[u]:
                u = v
        flag = 0

        for v in nodes:
            common_parent = my_lca.get_lca(u, v)
            if common_parent == v or my_lca.parents[v][0] == common_parent:
                continue
            else:
                flag = 1
                break

        if flag == 1:
            out.append("NO")
        else:
            out.append("YES")

    print(*out, sep = "\n")

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()


from __future__ import division, print_function
from random import randint as rn
def main():
    from collections import deque
    class LCA:
        def __init__(self, n, edges):
            # Assuming Tree is rooted at 1
            q = deque()
            q.append(1)
            self.parents = [ [1]*18 for _ in range(n+1)]

            self.depth = [-1] * (n + 1)
            self.depth[1] = 0

            while q:
                u = q.popleft()
                for v in edges[u]:
                    if self.depth[v] == -1:
                        q.append(v)
                        self.depth[v] = self.depth[u] + 1
                        self.parents[v][0] = u

                        for i in range(1,18):
                            self.parents[v][i] = self.parents[self.parents[v][i-1]][i-1]

        def get_parent(self, node, dist):
            while dist:
                i = dist.bit_length() - 1
                node = self.parents[node][i]
                dist ^= 1 << i
            return node

        def get_lca(self, u, v):
            if self.depth[u] > self.depth[v]:
                u, v = v, u
            v = self.get_parent(v, self.depth[v] - self.depth[u])

            for i in reversed(range(18)):
                pu = self.parents[u][i]
                pv = self.parents[v][i]

                if pu!=pv:
                    u = pu
                    v = pv
            return u if u == v else self.parents[u][0]

    n, m = map(int, input().split())
    edges = [[] for _ in range(n+1)]
    for i in range(n-1):
        u, v = map(int, input().split())
        edges[u].append(v)
        edges[v].append(u)

    my_lca = LCA(n, edges)

    out = []
    for i in range(m):
        nodes = list(map(int, input().split()))
        nodes = nodes[1:]
        u = nodes[0]
        for v in nodes:
            if my_lca.depth[v] > my_lca.depth[u]:
                u = v
        flag = 0

        for v in nodes:
            common_parent = my_lca.get_lca(u, v)
            if common_parent == v or my_lca.parents[v][0] == common_parent:
                continue
            else:
                flag = 1
                break

        if flag == 1:
            out.append("NO")
        else:
            out.append("YES")

    print(*out, sep = "\n")

######## Python 2 and 3 footer by Pajenegod and c1729

# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.

# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'

# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'0' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'0' [0]:
        A.append(sign*numb)
    return A

if __name__== "__main__":
  main()