For problem statement at 0-999/400-499/460-469/466/problemE.txt this is a correct solution, but verifier at 0-999/400-499/460-469/466/verifierE.go ends with All 100 tests passed can you fix the verifier? ```go
package main
import (
"bufio"
"os"
)
type Query struct {
x int
i int
}
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
nextInt := func() int {
sign := 1
val := 0
b, _ := in.ReadByte()
for (b < '0' || b > '9') && b != '-' {
b, _ = in.ReadByte()
}
if b == '-' {
sign = -1
b, _ = in.ReadByte()
}
for b >= '0' && b <= '9' {
val = val*10 + int(b-'0')
b, _ = in.ReadByte()
}
return val * sign
}
n := nextInt()
m := nextInt()
parent := make([]int, n+1)
tAssign := make([]int, n+1)
packetsStart := make([]int, 1, m+2)
packetsTime := make([]int, 1, m+2)
queries := make([]Query, 0, m)
eventIdx := 0
for i := 0; i < m; i++ {
t := nextInt()
eventIdx++
if t == 1 {
x := nextInt()
y := nextInt()
parent[x] = y
tAssign[x] = eventIdx
} else if t == 2 {
x := nextInt()
packetsStart = append(packetsStart, x)
packetsTime = append(packetsTime, eventIdx)
} else {
x := nextInt()
idx := nextInt()
queries = append(queries, Query{x: x, i: idx})
}
}
children := make([][]int, n+1)
for v := 1; v <= n; v++ {
if parent[v] != 0 {
children[parent[v]] = append(children[parent[v]], v)
}
}
const LOG = 20
up := make([][]int, LOG)
mx := make([][]int, LOG)
for k := 0; k < LOG; k++ {
up[k] = make([]int, n+1)
mx[k] = make([]int, n+1)
}
for v := 1; v <= n; v++ {
up[0][v] = parent[v]
mx[0][v] = tAssign[v]
}
for k := 1; k < LOG; k++ {
uk := up[k]
ukm1 := up[k-1]
mxk := mx[k]
mxm1 := mx[k-1]
for v := 1; v <= n; v++ {
p := ukm1[v]
uk[v] = ukm1[p]
a := mxm1[v]
b := 0
if p != 0 {
b = mxm1[p]
}
if a >= b {
mxk[v] = a
} else {
mxk[v] = b
}
}
}
tin := make([]int, n+1)
tout := make([]int, n+1)
depth := make([]int, n+1)
type frame struct {
v int
it int
}
timer := 0
for v := 1; v <= n; v++ {
if parent[v] == 0 {
stack := make([]frame, 0, 64)
stack = append(stack, frame{v: v, it: -1})
for len(stack) > 0 {
topIdx := len(stack) - 1
f := &stack[topIdx]
if f.it == -1 {
f.it = 0
timer++
tin[f.v] = timer
}
if f.it < len(children[f.v]) {
u := children[f.v][f.it]
f.it++
depth[u] = depth[f.v] + 1
stack = append(stack, frame{v: u, it: -1})
} else {
timer++
tout[f.v] = timer
stack = stack[:topIdx]
}
}
}
}
isAncestor := func(a, b int) bool {
return tin[a] <= tin[b] && tout[b] <= tout[a]
}
liftToLimit := func(s, T int) int {
cur := s
for k := LOG - 1; k >= 0; k-- {
anc := up[k][cur]
if anc != 0 && mx[k][cur] <= T {
cur = anc
}
}
return cur
}
buf := make([]byte, 0, len(queries)*4)
for _, q := range queries {
x := q.x
i := q.i
s := packetsStart[i]
T := packetsTime[i]
if !isAncestor(x, s) {
buf = append(buf, 'N', 'O', '\n')
continue
}
reach := liftToLimit(s, T)
if depth[x] >= depth[reach] {
buf = append(buf, 'Y', 'E', 'S', '\n')
} else {
buf = append(buf, 'N', 'O', '\n')
}
}
out.Write(buf)
}
```