You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 1702F.go
    path of file: ./repos/codeforces-go/main/1700-1799
    
    the code of the file until where you have to start completion: package main

import (
	"bufio"
	. "fmt"
	"io"
	"math/bits"
	"time"
)

// https://space.bilibili.com/206214
type node02 struct {
	lr       [2]*node02
	priority uint
	key      int
	keyCnt   int
	subCnt   in
    
func CF1702F(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n, v int
o:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		a := newTreap()
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			a.put(v>>bits.TrailingZeros(uint(v)), 1)
		}
		b := newTreap()
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			b.put(v>>bits.TrailingZeros(uint(v)), 1)
		}

		for a.size() > 0 {
			p := b.max()
			q := a.max()
			if p.key < q.key {
				Fprintln(out, "NO")
				continue o
			}
			if p.key == q.key {
				if p.keyCnt < q.keyCnt {
					Fprintln(out, "NO")
					continue o
				}
				a.delete(q.key, q.keyCnt)
				b.delete(p.key, p.keyCnt)
				if p.keyCnt > q.keyCnt {
					b.put(p.key>>1, p.keyCnt-q.keyCnt)
				}
			} else {
				b.delete(p.key, p.keyCnt)
				b.put(p.key>>1, p.keyCnt)
			}
		}
		Fprintln(out, "YES")
	}
}