package main

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

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func out(x ...interface{}) {
	fmt.Fprint(wr, x...)
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

	t := nextInt()
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	n := nextInt64()

	if n&(n-1) != 0 {
		out("YES\n")
	} else {
		out("NO\n")
	}
}

package main

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

/*
6
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int64
		scanf("%d\n", &n)

		for n%2 == 0 && n != 2 {
			n = n / 2
		}

		if n%2 != 0 {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

type ti uint64

var scanner = bufio.NewScanner(os.Stdin)

// SplitNums splits a string into a slice of integers
func SplitNums(s string) []ti {
	nums := strings.Split(strings.TrimSpace(s), " ")
	var result []ti
	for _, n := range nums {
		result = append(result, ParseInt(n))
	}
	return result
}

// ParseInt converts a string into an integer
func ParseInt(s string) ti {
	num, _ := strconv.ParseInt(strings.TrimSpace(s), 10, 64)
	return ti(num)
}

// ReadInput reads the input and returns the text
func ReadInput() string {
	scanner.Scan()
	return scanner.Text()
}

func findOddDivisor(n ti) string {
	if n <= 2 {
		return "NO"
	}

	if n%2 != 0 {
		return "YES"
	}

	for cur := n / 2; cur >= 2; cur /= 2 {
		if cur%2 != 0 {
			return "YES"
		}
	}

	return "NO"
}

func main() {
	input := ReadInput()
	test_cases := ParseInt(input)

	for i := ti(0); i < test_cases; i++ {
		input := ReadInput()
		num := ParseInt(input)
		fmt.Println(findOddDivisor(num))
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	t   int
	n   int64
)

func main() {

	defer out.Flush()

	fmt.Fscan(in, &t)

	for ; t > 0; t-- {

		fmt.Fscan(in, &n)

		fmt.Fprintln(out, solve2(n))

	}

}

func solve2(n int64) string {

	num := int64(2)

	for num <= n {

		if num == n {
			return "NO"
		}

		num *= 2

	}

	return "YES"

}

func solve(n int64) string {

	if n%2 == 1 {
		return "YES"
	}

	d := int64(3)

	for d <= int64(math.Sqrt(float64(n))) {

		if n%d == 0 {
			return "YES"
		}

		d += 2

	}

	return "NO"

}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	// 读入一行数据
	// s, _ := in.ReadString('\n')
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func(t int) {
		var n int64
		fmt.Fscan(in, &n)
		if n & (n-1) > 0 {
			fmt.Fprintln(out, "YES")
		}else{
			fmt.Fprintln(out, "NO")
		}
	}

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++{
		solve(t)
	}
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

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

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func out(x ...interface{}) {
	fmt.Fprint(wr, x...)
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

	t := nextInt()
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	n := nextInt64()

	for n%2 == 0 {
		n /= 2
	}

	if n != 1 {
		out("YES\n")
	} else {
		out("NO\n")
	}
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int64
		Fscan(in, &n)

		if n & (n-1) != 0 {
			Fprintln(out, "YES")

		} else {
			Fprintln(out, "NO")
		}
	}

}

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

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int64
		Fscan(in, &n)

		for n & 0x1 == 0 {
			n >>= 1
		}
		if n == 1 {
			Fprintln(out, "NO")
		} else {
			Fprintln(out, "YES")
		}
	}

}

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

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n int64
		fmt.Scan(&n)

		if n&(n-1) != 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)
	for {
		var n int64
		fmt.Scanln(&n)
		for n%2 == 0 {
			n /= 2
		}
		if n != 1 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
		if t == 0 {
			break
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var N int
	var x int64
	Fscan(in, &N)
	for tt:=0; tt < N; tt ++ {
		Fscan(in, &x)
		for x>0 && x&1 == 0 {
			x = x >> 1
		}
		ans := "YES\n"
		if x == 1 {
			ans = "NO\n"
		}
		out.WriteString(ans)
	}
}

package main

import (
	"fmt"
)

func main() {
	var T int64
	fmt.Scan(&T)
	for ; T > 0; T-- {
		var n int64
		fmt.Scan(&n)
		for ; n%2 == 0; n >>= 1 {
		}
		if n == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	. "fmt"
)

func main(){
	var t int;
	Scan(&t);
	for i:=0;i<t;i++ {
		var n int64;
		Scan(&n);

		for ;n>1 && n%2 == 0; {
			n/=2;
		}
		if n == 1 {
			Println("NO");
		} else{
			Println("YES");
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func Max(x, y int64) int64 {
	if x < y {
		return y
	} else {
		return x
	}
}

func main() {
	t := 10000
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int64
		fmt.Fscan(in, &n)
		if n&(n-1) == 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"math/bits"
	"os"
)

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

func main() {
	defer writer.Flush()

	var t int
	fmt.Fscan(reader, &t)

	for i := 0; i < t; i++ {
		var n uint64
		fmt.Fscan(reader, &n)

		if bits.OnesCount64(n) == 1 {
			fmt.Fprintln(writer, "NO")
		} else {
			fmt.Fprintln(writer, "YES")
		}
	}
}

package main

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

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

func main() {
	defer writer.Flush()

	var t int
	fmt.Fscan(reader, &t)

	for i := 0; i < t; i++ {
		var n int64
		fmt.Fscan(reader, &n)

		var count int
		for n > 0 {
			if n&1 == 1 {
				count++
			}

			n >>= 1

			// fmt.Println("n: ", n)
		}

		if count == 1 {
			fmt.Fprintln(writer, "NO")
		} else {
			fmt.Fprintln(writer, "YES")
		}
	}
}

package main

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

func main() {
	a:=bufio.NewReader(os.Stdin)
	l, _ :=a.ReadString('\n')
	l=strings.Trim(strings.Trim(l,"\n"),"\r")
	ln, _ :=strconv.Atoi(l)
	for i:=0; i<ln;i++{
		s,_:=a.ReadString('\n')
		d, _ :=strconv.ParseInt(strings.Trim(strings.Trim(s,"\n"), "\r"),10 , 64)
		fmt.Printf("%s\n",fn(d))

	}
}

func fn(n int64) string {
	if n & (n - 1) == 0{
		return "NO"
	}
	return "YES"
}

// Written by : Syed Mujtaba
// Seek knowledge from the cradle to the grave
package main

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

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

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

func Abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	defer writer.Flush()

	var t int
	fmt.Scanf("%d\n", &t)
	for T := 0; T < t; T++ {
		var n int64
		scanf("%d\n", &n)
		for n%2 == 0 {
			n /= 2
		}
		if n == 1 {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}

package main

import (
  "fmt"
)

func main() {
  var T int
  fmt.Scanf("%d ", &T);
  for ;T>0;T-- {
    var n int;
    fmt.Scanf("%d ", &n);
    for ;n%2==0; {
      n /=2;
    }
    if(n==1) {
      fmt.Println("NO")
    } else {
      fmt.Println("YES")
    }
  }

}

package main

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

func solve(r *bufio.Reader) {
	var p int64
	fmt.Fscan(r, &p)

	for p%2 == 0 {
		p = p / 2
	}
	if p%2 == 1 && p != 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

import (
	"fmt"
)

func solve() {
	var n uint64
	fmt.Scanf("%d\n", &n)

	if n%2 == 1 {
		fmt.Println("YES")
		return
	} else {
		for n > 1 {
			if n%2 == 1 {
				fmt.Println("YES")
				return
			}
			n /= 2
		}
	}
	fmt.Println("NO")
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t > 0 {
		solve()
		t--
	}
}

package main

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

func solve(x int64) string {
	for x > 1 {
		if x%2 == 1 {
			return "YES"
		}
		x /= 2
	}
	return "NO"
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	tt := int64(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int64(0)
		fmt.Fscanf(in, "%d\n", &n)
		fmt.Fprintf(out, "%s\n", solve(n))
		tt--
	}
	out.Flush()
}

package main

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

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func scanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func scanInt() int {
	return int(scanInt64())
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	isPowerOf2 := map[int64]bool{}

	for i := 1; i < 63; i++ {
		isPowerOf2[1<<i] = true
	}

	for t := scanInt(); t > 0; t-- {
		n := scanInt64()

		if isPowerOf2[n] {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		var n uint64
		s, _ := reader.ReadBytes('\n')
		readUint64(s, 0, &n)
		res := solve(n)

		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n uint64) bool {
	if n == 1 {
		return false
	}
	return n&(n-1) > 0
}

package main

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

var sc = bufio.NewScanner(os.Stdin)
func slove() {
	sc.Scan()
	x , _ := strconv.ParseInt(sc.Text(), 10, 64)
	if (x & (x - 1) != 0) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
var T int
func main() {
	sc.Scan()
	T, _ := strconv.ParseInt(sc.Text(), 10, 32)
	for T > 0{
		T--
		slove()
	}
}

package main

import . "fmt"

func main() {
	var t int
	Scan(&t)
	solve := func() {
		var n int64
		Scan(&n)
		if n & (n - 1) > 0 {
			Println(`Yes`)
		} else {
			Println(`No`)
		}
	}
	for t > 0 {
		solve()
		t--
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		var x int64
		fmt.Scan(&x)
		for (x % 2 == 0) {
			x = x / 2
		}
		if (x == 1) {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import "fmt"

func check(n int64) bool {
    for n % 2 == 0 {
        n /= 2
    }
    return n != 1
}

func main() {
    var t int
    var n int64
    fmt.Scan(&t)
    for i := 0; i < t; i++ {
        fmt.Scan(&n)
        if check(n) {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

package main

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

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

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

func main() {
	defer writer.Flush()
	var t int
	var n int64
	scanf("%d\n", &t)
	for ; t > 0; t-- {
		scanf("%d\n", &n)
		for n % 2 == 0 {
			n /= 2
		}
		if n == 1 {
			printf("NO\n")
		} else {
			printf("YES\n")
		}
	}
}

package main

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

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

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

func min_int(a int, b int) int { if a < b { return a } else { return b } }
func min_int64(a int64, b int64) int64 { if a < b { return a } else { return b } }

func max_int(a int, b int) int { if a > b { return a } else { return b } }
func max_int64(a int64, b int64) int64 { if a > b { return a } else { return b } }

func main() {
	defer writer.Flush()

	var T int = 0
	scanf("%d\n", &T)

	for t := 0; t < T; t++ {

		var x uint64 = 0
		scanf("%d\n", &x)

		for x % 2 == 0 {
			x = x / 2
		}

		if x == 1 {
			printf("NO\n")
		} else if x % 2 != 0 {
			printf("YES\n")
		}
	}
}

package main

import "fmt"

func judge(x int64) (result bool) {
	for x > 1 {
		if x%2 == 0 {
			x = x / 2
		}
		if x%2 == 1 && x != 1 {
			return true
		}
	}
	return false
}
func main() {
	var t int
	fmt.Scan(&t)
	for t > 0 {
		t--
		var x int64
		fmt.Scan(&x)
		if judge(x) == true {
			fmt.Println("YES")
		}
		if judge(x) == false {
			fmt.Println("NO")
		}
	}
}

package main

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

func MIN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int64
		fmt.Fscan(input, &n)

		initial := n
		for i := 1; i < 100; i++ {
			if initial%2 == 0 {
				initial = initial / 2
			} else {
				break
			}
		}
		if initial == 1 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}

	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) {
		var n int64
		Fscan(in, &n)
		if n&(n-1) > 0 {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

	var t int
	Fscan(in, &t)
	for Case := 1; Case <= t; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

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

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int64
		scanf("%d\n", &n)

		if n&(n-1) != 0 {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

/*
6
*/

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int64
		scanf("%d\n", &n)

		for n%2 == 0 {
			n = n / 2
		}

		if n != 1 {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	var t = 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		var n int64
		scanf("%d\n", &n)

		found := false

		sqrt := int64(math.Ceil(math.Sqrt(float64(n))))

		for div1 := int64(1); div1 <= sqrt; div1++ {
			div2 := n / div1
			if n%div1 == 0 && ((n%div1 != 0 && div1 != 1) || div2%2 != 0) {
				found = true
				break
			}
		}

		if found {
			fmt.Fprintln(writer, "YES")
		} else {
			fmt.Fprintln(writer, "NO")
		}
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	maximum := nums[0]
	for _, num := range nums {
		if num > maximum {
			maximum = num
		}
	}
	return maximum
}

//goland:noinspection GoUnusedFunction
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//goland:noinspection GoUnusedFunction
func isPrime(n int) bool {
	if n == 2 || n == 3 {
		return true
	}

	if n <= 1 || n%2 == 0 || n%3 == 0 {
		return false
	}

	for i := 5; i*i <= n; i += 6 {
		if n%i == 0 || n%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

// SplitNums splits a string into a slice of integers
func SplitNums(s string) []int {
	nums := strings.Split(strings.TrimSpace(s), " ")
	var result []int
	for _, n := range nums {
		result = append(result, ParseInt(n))
	}
	return result
}

// ParseInt converts a string into an integer
func ParseInt(s string) int {
	num, _ := strconv.Atoi(strings.TrimSpace(s))
	return num
}

// ReadInput reads the standard input and return it as a string
func ReadInput() string {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	return input
}

func findOddDivisor(n int) string {
	if n <= 2 {
		return "NO"
	}

	if n%2 != 0 {
		return "YES"
	}

	for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i == 0 && (n/i)%2 != 0 {
			return "YES"
		}
	}

	return "NO"
}

func main() {
	input := ReadInput()
	test_cases := ParseInt(input)

	for i := 0; i < test_cases; i++ {
		cur := ReadInput()
		fmt.Println(cur)
		num := ParseInt(cur)
		fmt.Println(findOddDivisor(num))
	}
}

package main

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

// SplitNums splits a string into a slice of integers
func SplitNums(s string) []int {
	nums := strings.Split(strings.TrimSpace(s), " ")
	var result []int
	for _, n := range nums {
		result = append(result, ParseInt(n))
	}
	return result
}

// ParseInt converts a string into an integer
func ParseInt(s string) int {
	num, _ := strconv.Atoi(strings.TrimSpace(s))
	return num
}

// ReadInput reads the standard input and return it as a string
func ReadInput() string {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	return input
}

func findOddDivisor(n int) string {
	fmt.Println(n)
	if n <= 2 {
		return "NO"
	}

	if n%2 != 0 {
		return "YES"
	}

	for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i == 0 && (n/i)%2 != 0 {
			return "YES"
		}
	}

	return "NO"
}

func main() {
	input := ReadInput()
	test_cases := ParseInt(input)

	for i := 0; i < test_cases; i++ {
		cur := ReadInput()
		num := ParseInt(cur)
		fmt.Println(findOddDivisor(num))
	}
}

package main

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

// SplitNums splits a string into a slice of integers
func SplitNums(s string) []int {
	nums := strings.Split(strings.TrimSpace(s), " ")
	var result []int
	for _, n := range nums {
		result = append(result, ParseInt(n))
	}
	return result
}

// ParseInt converts a string into an integer
func ParseInt(s string) int {
	num, _ := strconv.Atoi(strings.TrimSpace(s))
	return num
}

// ReadInput reads the standard input and return it as a string
func ReadInput() string {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	return input
}

func findOddDivisor(n int) string {
	if n <= 2 {
		return "NO"
	}

	if n%2 != 0 {
		return "YES"
	}

	for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
		if n%i == 0 && (n/i)%2 != 0 {
			return "YES"
		}
	}

	return "NO"
}

func main() {
	input := ReadInput()
	test_cases := ParseInt(input)

	for i := 0; i < test_cases; i++ {
		cur := ReadInput()
		num := ParseInt(cur)
		fmt.Println(findOddDivisor(num))
	}
}

package main

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

// SplitNums splits a string into a slice of integers
func SplitNums(s string) []int64 {
	nums := strings.Split(strings.TrimSpace(s), " ")
	var result []int64
	for _, n := range nums {
		result = append(result, ParseInt(n))
	}
	return result
}

// ParseInt converts a string into an integer
func ParseInt(s string) int64 {
	num, _ := strconv.ParseInt(strings.TrimSpace(s), 10, 64)
	return num
}

// ReadInput reads the standard input and return it as a string
func ReadInput() string {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	return input
}

func findOddDivisor(n int64) string {
	if n <= 2 {
		return "NO"
	}

	if n%2 != 0 {
		return "YES"
	}

	for i := 2; int64(i) <= int64(math.Sqrt(float64(n))); i++ {
		if n%int64(i) == 0 && (n/int64(i))%2 != 0 {
			return "YES"
		}
	}

	return "NO"
}

func main() {
	input := ReadInput()
	test_cases := ParseInt(input)

	for i := 0; int64(i) < test_cases; i++ {
		cur := ReadInput()
		num := ParseInt(cur)
		fmt.Println(findOddDivisor(num))
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
	t   int
	n   int64
)

func main() {

	defer out.Flush()

	fmt.Fscan(in, &t)

	for ; t > 0; t-- {

		fmt.Fscan(in, &n)

		fmt.Fprintln(out, solve(n))

	}

}

func solve(n int64) string {

	if n%2 == 1 {
		return "YES"
	}

	/*d := int64(3)

	for d <= int64(math.Sqrt(float64(n))) {

		if n%d == 0 {
			return "YES"
		}

		d += 2

	}*/

	return "NO"

}

package main

import "fmt"

func solve() {
	var n int64
	fmt.Scanln(&n)
	if n%2 == 1 {
		fmt.Println("YES")
		return
	}
	for j := int64(1); j*j <= n; j++ {
		if n%j == 0 {
			k := n / j
			if ((j&1) == 1 && j > 1) || ((k&1) == 1 && k > 1) {
				fmt.Println("YES")
				return
			}
		}
	}
	fmt.Println("NO")
}
func main() {
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		solve()
	}
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int64
		Fscan(in, &n)

		if n & (n-1) == 0 {
			Fprintln(out, "YES")

		} else {
			Fprintln(out, "NO")
		}
	}

}

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

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n int64
		fmt.Scan(&n)

		if n&(n-1) == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n int64
		fmt.Scan(&n)
		if n&1 == 1 && n > 2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import "fmt"

func main() {
	var t, n int
	fmt.Scanln(&t)
	for {
		fmt.Scanln(&n)
		for n%2 == 0 {
			n /= 2
		}
		if n != 1 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
		if t == 0 {
			break
		}
	}
}

package main

import "fmt"

func main() {
	t, n := 0, 0
	fmt.Scan(t)
	for t > 0 {
		fmt.Scan(n)
		for n%2 == 0 {
			n /= 2
		}
		if n != 1 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var N,x int
	Fscan(in, &N)
	for tt:=0; tt < N; tt ++ {
		Fscan(in, &x)
		for x>0 && x&1 == 0 {
			x = x >> 1
		}
		ans := "YES\n"
		if x == 1 {
			ans = "NO\n"
		}
		out.WriteString(ans)
	}
}

package main

import (
	. "fmt"
)

func main(){
	var t int;
	Scan(&t);
	for i:=0;i<t;i++ {
		var n int64;
		Scan(&n);
		if n%2 == 1 {
			Println("YES");
		} else{
			Println("NO");
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func Max(x, y int64) int64 {
	if x < y {
		return y
	} else {
		return x
	}
}

func main() {
	t := 10000
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		if n&(n-1) == 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

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

func main() {
	a:=bufio.NewReader(os.Stdin)
	l, _ :=a.ReadString('\n')
	l=strings.Trim(strings.Trim(l,"\n"),"\r")
	ln, _ :=strconv.Atoi(l)
	for i:=0; i<ln;i++{
		s,_:=a.ReadString('\n')
		d, _ :=strconv.ParseInt(strings.Trim(strings.Trim(s,"\n"), "\r"),10 , 64)
		fmt.Printf("%s\n",fn(d))

	}
}

func fn(n int64) string {
	if !(n%2==0) || n%6==0{
		return "YES"
	}
	return "NO"
}


package main

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

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

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

func main() {
	defer writer.Flush()
	var s string
	scanf("%s", &s)
	n := len(s)
	larr := make([]int, n+3)
	rarr := make([]int, n+3)

	cur := 0

	for i := 0; i < n; i++ {
		if s[i] == 'v' {
			cur++
			larr[i+1] = larr[i]
		} else {
			if cur > 0 {
				larr[i+1] = cur - 1 + larr[i]
			} else {
				larr[i+1] = larr[i]
			}
			cur = 0
		}
	}

	cur = 0

	for i := n - 1; i >= 0; i-- {
		if s[i] == 'v' {
			cur++
			rarr[i+1] = rarr[i+2]
		} else {
			if cur > 0 {
				rarr[i+1] = cur - 1 + rarr[i+2]
			} else {
				rarr[i+1] = rarr[i+2]
			}
			cur = 0
		}
	}
	ans := int64(0)

	//fmt.Println(larr, rarr)

	for i := 0; i < n; i++ {
		if s[i] == 'o' {
			ans += int64(larr[i+1]) * int64(rarr[i+1])
		}
	}

	printf("%d", ans)
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"reflect"
	"strconv"
	"unsafe"
)

var DEBUG = true

func main() {
	defer Flush()

	s := readb()

	var t []byte
	var i, j int
	for i < len(s) {
		if s[i] == 'v' {
			for j = i; j < len(s) && s[j] == 'v'; j++ {
			}
			for d := 0; d < (j - i - 1); d++ {
				t = append(t, 'w')
			}
			i = j
		} else if s[i] == 'o' {
			t = append(t, 'o')
			i++
		}
	}
	a := f(t)
	Reverse(t)
	b := f(t)
	Reverse(b)
	Reverse(t)

	var ans int64
	for i := 1; i < len(t)-1; i++ {
		if t[i] != 'o' {
			continue
		}
		ans += int64(a[i]) * int64(b[i])
	}
	println(ans)
}

func f(t []byte) []int {
	a := make([]int, len(t)+1)
	for i := range t {
		a[i+1] = a[i]
		if t[i] == 'w' {
			a[i+1]++
		}
	}
	return a
}

// =============================================================================

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// these functions are derived from sort in Go source.
// name of functions are changed

// The function panics if the provided interface is not a slice.
func Reverse(slice interface{}) {
	rv := reflect.ValueOf(slice)
	swap := _reverse_Swapper(slice)
	length := rv.Len()
	for i, j := 0, length-1; i < j; i, j = i+1, j-1 {
		swap(i, j)
	}
}

func _reverse_Swapper(slice interface{}) func(i, j int) {
	v := reflect.ValueOf(slice)
	vdata := v.Pointer()
	vlen := v.Len()
	vcap := v.Cap()

	sz := int(v.Type().Elem().Size())

	// for typical small elements
	switch sz {
	case 24: // for slice
		var s [][3]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 16: // for string
		var s [][2]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 8:
		var s []int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 4:
		var s []int32
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 2:
		var s []int16
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 1:
		var s []int8
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	}

	// for large elements
	if sz%16 == 0 {
		m := sz / 16
		var s [][2]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%8 == 0 {
		m := sz / 8
		var s []int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%4 == 0 {
		m := sz / 4
		var s []int32
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%2 == 0 {
		m := sz / 2
		var s []int16
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	} else {
		m := sz
		var s []int8
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
}

// =============================================================================

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

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

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

package main

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

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

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

func main() {
	defer writer.Flush()
	var s string
	scanf("%s", &s)
	n := len(s)
	larr := make([]int, n+3)
	rarr := make([]int, n+3)

	cur := 0

	for i := 0; i < n; i++ {
		if s[i] == 'v' {
			cur++
			larr[i+1] = larr[i]
		} else {
			if cur > 0 {
				larr[i+1] = cur - 1 + larr[i]
			} else {
				larr[i+1] = larr[i]
			}
			cur = 0
		}
	}

	cur = 0

	for i := n - 1; i >= 0; i-- {
		if s[i] == 'v' {
			cur++
			rarr[i+1] = rarr[i+2]
		} else {
			if cur > 0 {
				rarr[i+1] = cur - 1 + rarr[i+2]
			} else {
				rarr[i+1] = rarr[i+2]
			}
			cur = 0
		}
	}
	ans := int64(0)

	//fmt.Println(larr, rarr)

	for i := 0; i < n; i++ {
		if s[i] == 'o' {
			ans += int64(larr[i+1] * rarr[i+1])
		}
	}

	printf("%d", ans)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1132C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	type pair struct{ x, y int }

	var n, m, l, r, all int
	Fscan(in, &n, &m)
	ids := make([][]int, n+1)
	for i := 0; i < m; i++ {
		Fscan(in, &l, &r)
		for p := l; p <= r; p++ {
			if len(ids[p]) < 3 {
				ids[p] = append(ids[p], i)
			}
		}
	}
	c1 := make([]int, m)
	c2 := map[pair]int{}
	for _, id := range ids {
		if id == nil {
			continue
		}
		if len(id) == 1 {
			c1[id[0]]++
		} else if len(id) == 2 {
			c2[pair{id[0], id[1]}]++
		}
		all++
	}
	min := n
	for i, c := range c1 {
		for j := i + 1; j < m; j++ {
			if c := c + c1[j] + c2[pair{i, j}]; c < min {
				min = c
			}
		}
	}
	Fprint(out, all-min)
}

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

package main

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

func main() {
	read := bufio.NewReader(os.Stdin)
	write := bufio.NewWriter(os.Stdout)
	var n, q int
	fmt.Fscan(read, &n, &q)
	mlr := make([][2]int, q)
	zbr := make([]int, n)
	zbrtest := make([]int, n)
	nall := 0
	for i := 0; i < q; i++ {
		var l, r int
		fmt.Fscan(read, &l, &r)
		l = l - 1
		r = r - 1
		m := [2]int{l, r}
		mlr[i] = m
		for j := l; j <= r; j++ {
			if zbr[j] == 0 {
				nall = nall + 1
			}
			zbr[j] = zbr[j] + 1

		}
	}

	nmin := n + 1
	for i := 0; i < q-1; i++ {
		nminus1 := 0
		for k := mlr[i][0]; k <= mlr[i][1]; k++ {
			if zbr[k] == 1 {
				nminus1 = nminus1 + 1
			}
			if zbr[k] == 2 {
				zbrtest[k] = i + 1
			}
			//zbr[k] = zbr[k] - 1
		}
		if nminus1 >= nmin {
			continue
		}

		for j := i + 1; j < q; j++ {
			nminus2 := 0
			for k := mlr[j][0]; k <= mlr[j][1]; k++ {
				if zbr[k] == 1 {
					nminus2 = nminus2 + 1
				}
				if zbrtest[k] == (i + 1) {
					nminus2 = nminus2 + 1
				}
				if (nminus2 + nminus1) >= nmin {
					break
				}
			}
			if nminus1+nminus2 < nmin {
				nmin = nminus1 + nminus2
			}
			if nmin == 0 {
				break
			}
		}
		if nmin == 0 {
			break
		}
		//for k := mlr[i][0]; k <= mlr[i][1]; k++ {
		//	zbr[k] = zbr[k] + 1
		//}

	}

	/*
		fmt.Println(nall)
		fmt.Println(nmin)
		fmt.Println(zbr)
		fmt.Println(mlr[1], mlr[2])
	*/

	nall = nall - nmin
	fmt.Fprint(write, nall)
	write.Flush()
}

package main

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

var (
	tree []int
	ln   int
)

type Pair struct {
	l, r int
}

type SA []int

func (s SA) Len() int {
	return len(s)
}

func (s SA) Swap(a, b int) {
	tmp := s[a]
	s[a] = s[b]
	s[b] = tmp
}
func (s SA) Less(i, j int) bool {
	if s[i] < s[j] {
		return true
	}
	return false
}
func intect(x1, y1, x2, y2 int) (int, int) {
	x := x1
	if x < x2 {
		x = x2
	}
	y := y1
	if y > y2 {
		y = y2
	}
	return x, y
}
func leftR(x1, y1, x2, y2 int) (int, int) {
	if x1 > x2 {
		return leftR(x2, y2, x1, y1)
	}
	x := x1
	y := y1
	if x2-1 < y1 {
		y = x2 - 1
	}
	return x, y
}
func rightR(x1, y1, x2, y2 int) (int, int) {
	if y1 > y2 {
		return rightR(x2, y2, x1, y1)
	}
	x := x2
	y := y2
	if y1+1 > x2 {
		x = y1 + 1
	}
	return x, y
}
func main() {
	buf := bufio.NewReader(os.Stdin)
	var m int
	fmt.Fscanf(buf, "%d %d\n", &ln, &m)
	tree = make([]int, ln+1)
	rq := make([]*Pair, m)
	leftp := make(SA, m)
	rightp := make(SA, m)
	for i := 0; i < m; i++ {
		rq[i] = &Pair{
		}
		fmt.Fscanf(buf, "%d %d\n", &rq[i].l, &rq[i].r)
		leftp[i] = rq[i].l
		rightp[i] = rq[i].r
	}
	sort.Sort(leftp)
	sort.Sort(rightp)

	ones := make([]int, ln+1)
	two := make([]int, ln+1)
	tmp := 0
	lf := 0
	lr := 0
	total := 0
	for i := 1; i <= ln; i++ {
		for lf < m && leftp[lf] <= i {
			lf++
			tmp++
		}
		for lr < m && rightp[lr] < i {
			tmp--
			lr++
		}
//		fmt.Printf("%d ", tmp)
		if tmp == 1 {
			ones[i] = 1
		} else if tmp == 2 {
			two[i] = 1
		}
		if tmp > 0{
			total++
		}
		ones[i] += ones[i-1]
		two[i] += two[i-1]
	}
//	fmt.Printf("\n")
//	fmt.Printf("ones = %v\n",ones)
//	fmt.Printf("two = %v\n",two)
	ans := 0

	for i := 0; i < m; i++ {
		for j := i+1; j < m; j++ {
			tmp = 0
			x, y := intect(rq[i].l, rq[i].r, rq[j].l, rq[j].r)
			if x <= y {
				tmp += two[y] - two[x-1]
			}
			x, y = leftR(rq[i].l, rq[i].r, rq[j].l, rq[j].r)
			if x <= y {
				tmp += ones[y] - ones[x-1]
			}
			x, y = rightR(rq[i].l, rq[i].r, rq[j].l, rq[j].r)
			if x <= y {
				tmp += ones[y] - ones[x-1]
			}
			if total-tmp > ans {
				ans = total - tmp
			}
		}
	}
	fmt.Printf("%d\n", ans)
}

/**
0 0
0 1
3
UDD
 */

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1132C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	type pair struct{ x, y int }

	var n, m, l, r, all int
	Fscan(in, &n, &m)
	ids := make([][]int, n+1)
	for i := 1; i <= m; i++ {
		Fscan(in, &l, &r)
		for p := l; p <= r; p++ {
			if len(ids[p]) < 3 {
				ids[p] = append(ids[p], i)
			}
		}
	}
	cnt := map[pair]int{}
	for _, is := range ids {
		if is == nil {
			continue
		}
		if len(is) == 1 {
			cnt[pair{is[0], 0}]++
		} else if len(is) == 2 {
			cnt[pair{is[0], is[1]}]++
		}
		all++
	}
	min := n
	for i := 1; i < m; i++ {
		for j := i + 1; j <= m; j++ {
			if c := cnt[pair{i, 0}] + cnt[pair{j, 0}] + cnt[pair{i, j}]; c < min {
				min = c
			}
		}
	}
	Fprint(out, all-min)
}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, q := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &q)
	l := make([]int, q)
	r := make([]int, q)
	worker := make([][]int, n)
	for i := 0; i < n; i++ {
		worker[i] = make([]int, 0, q)
	}
	for i := 0; i < q; i++ {
		fmt.Fscanf(in, "%d %d\n", &l[i], &r[i])
		l[i]--
		r[i]--
		for j := l[i]; j <= r[i]; j++ {
			worker[j] = append(worker[j], i)
		}
	}
	unique := make([]int, q)
	pair := make([][]int, q)
	for i := 0; i < q; i++ {
		pair[i] = make([]int, q)
	}
	all := 0
	for i := 0; i < n; i++ {
		if len(worker[i]) > 0 {
			all++
		}
	}
	for i := 0; i < q; i++ {
		for j := l[i]; j <= r[i]; j++ {
			if len(worker[j]) == 1 {
				unique[i]++
			} else if len(worker[j]) == 2 {
				if worker[j][0] == i {
					pair[i][worker[j][1]]++
				} else {
					pair[i][worker[j][0]]++
				}
			}
		}
	}
	min := -1
	for i := 0; i < q; i++ {
		for j := i + 1; j < q; j++ {
			if unique[i]+unique[j]+pair[i][j] < min || min == -1 {
				min = unique[i] + unique[j] + pair[i][j]
			}
		}
	}
	fmt.Fprintf(out, "%d\n", all-min)
	return
}

func gcd(a, b int) int {
	if a < b {
		return gcd(b, a)
	}
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func solve(ang int) int {
	_ans := 180 / gcd(ang, 180)
	ans := _ans
	for ans*ang/180 > ans-2 {
		ans = ans + _ans
	}
	return ans
}


package main

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

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

const ISDEBUG = false

func readLine() string {
	r.Scan()
	return r.Text()
}

func readInt() int {
	r.Scan()
	x, _ := strconv.Atoi(r.Text())
	return x
}

func D() {
	n, k := readInt(), readInt()

	var M int64 = 998244353

	c := make([][][]int64, n+1)
	for i := 0; i <= n; i++ {
		c[i] = make([][]int64, 2*n+1)

		for j := 0; j <= 2*n; j++ {
			c[i][j] = make([]int64, 2)
		}
	}

	c[1][1][0] = 2
	c[1][2][1] = 2

	for i := 2; i <= n; i++ {
		for j := 1; j <= 2*i; j++ {
			c[i][j][0] = (c[i-1][j][0] + (c[i-1][j][1]*2)%M + c[i-1][j-1][0]) % M
			c[i][j][1] = (c[i-1][j][1] + (c[i-1][j-1][0]*2)%M) % M
			if j >= 2 {
				c[i][j][1] = (c[i][j][1] + c[i-1][j-2][1]) % M
			}
		}
	}

	var result int64 = 0
	for i := 0; i < 2; i++ {
		result = (result + c[n][k][i]) % M
	}
	w.WriteString(fmt.Sprintf("%v\n", result))
}

func main() {
	if ISDEBUG {
		fi, err := os.Open("input.txt")
		if err != nil {
			panic(err)
		}
		fo, _ := os.OpenFile("output.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
		r = bufio.NewScanner(fi)
		w = bufio.NewWriter(fo)

		defer fi.Close()
		defer fo.Close()
	} else {
		r = bufio.NewScanner(os.Stdin)
		w = bufio.NewWriter(os.Stdout)
	}
	r.Split(bufio.ScanWords)
	defer w.Flush()

	D()
}

package main

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

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

const ISDEBUG = false

func readLine() string {
	r.Scan()
	return r.Text()
}

func readInt() int {
	r.Scan()
	x, _ := strconv.Atoi(r.Text())
	return x
}

func D() {
	n, k := readInt(), readInt()

	M := 998244353

	c := make([][][]int, n+1)
	for i := 0; i <= n; i++ {
		c[i] = make([][]int, 2*n+1)

		for j := 0; j <= 2*n; j++ {
			c[i][j] = make([]int, 2)
		}
	}

	c[1][1][0] = 2
	c[1][2][1] = 2

	for i := 2; i <= n; i++ {
		for j := 1; j <= 2*i; j++ {
			c[i][j][0] = (c[i-1][j][0] + (c[i-1][j][1]*2)%M + c[i-1][j-1][0]) % M
			c[i][j][1] = (c[i-1][j][1] + (c[i-1][j-1][0]*2)%M) % M
			if j >= 2 {
				c[i][j][1] = (c[i][j][1] + c[i-1][j-2][1]) % M
			}
		}
	}

	result := 0
	for i := 0; i < 2; i++ {
		result = (result + c[n][k][i]) % M
	}
	w.WriteString(fmt.Sprintf("%v\n", result))
}

func main() {
	if ISDEBUG {
		fi, err := os.Open("input.txt")
		if err != nil {
			panic(err)
		}
		fo, _ := os.OpenFile("output.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
		r = bufio.NewScanner(fi)
		w = bufio.NewWriter(fo)

		defer fi.Close()
		defer fo.Close()
	} else {
		r = bufio.NewScanner(os.Stdin)
		w = bufio.NewWriter(os.Stdout)
	}
	r.Split(bufio.ScanWords)
	defer w.Flush()

	D()
}

package main

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

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

const ISDEBUG = false

func readLine() string {
	r.Scan()
	return r.Text()
}

func readInt() int {
	r.Scan()
	x, _ := strconv.Atoi(r.Text())
	return x
}

func D() {
	n, k := readInt(), readInt()

	M := 998244353

	c := make([][][]int, n+1)
	for i := 0; i <= n; i++ {
		c[i] = make([][]int, 2*n+1)

		for j := 0; j <= 2*n; j++ {
			c[i][j] = make([]int, 2)
		}
	}

	c[1][1][0] = 2
	c[1][2][1] = 2

	for i := 2; i <= n; i++ {
		for j := 1; j <= 2*i; j++ {
			c[i][j][0] = (c[i-1][j][0] + c[i-1][j][1]*2 + c[i-1][j-1][0]) % M
			c[i][j][1] = (c[i-1][j][1] + c[i-1][j-1][0]*2) % M
			if j >= 2 {
				c[i][j][1] = (c[i][j][1] + c[i-1][j-2][1]) % M
			}
		}
	}

	result := 0
	for i := 0; i < 2; i++ {
		result = (result + c[n][k][i]) % M
	}
	w.WriteString(fmt.Sprintf("%v\n", result))
}

func main() {
	if ISDEBUG {
		fi, err := os.Open("input.txt")
		if err != nil {
			panic(err)
		}
		fo, _ := os.OpenFile("output.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
		r = bufio.NewScanner(fi)
		w = bufio.NewWriter(fo)

		defer fi.Close()
		defer fo.Close()
	} else {
		r = bufio.NewScanner(os.Stdin)
		w = bufio.NewWriter(os.Stdout)
	}
	r.Split(bufio.ScanWords)
	defer w.Flush()

	D()
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1579F(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var T, n, d int
	var v bool
o:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &d)
		q := []int{}
		vis := make([]bool, n)
		for i := 0; i < n; i++ {
			if Fscan(in, &v); !v {
				q = append(q, i)
				vis[i] = true
			}
		}
		ans := -1
		for ; len(q) > 0; ans++ {
			tmp := q
			q = nil
			for _, v := range tmp {
				if w := (v + d) % n; !vis[w] {
					q = append(q, w)
					vis[w] = true
				}
			}
		}
		for _, v := range vis {
			if !v {
				Fprintln(out, -1)
				continue o
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1579F(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var T, n, d, v int
o:
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &d)
		q := []int{}
		vis := make([]bool, n)
		for i := 0; i < n; i++ {
			if Fscan(in, &v); v == 0 {
				q = append(q, i)
				vis[i] = true
			}
		}
		ans := -1
		for ; len(q) > 0; ans++ {
			tmp := q
			q = nil
			for _, v := range tmp {
				if w := (v + d) % n; !vis[w] {
					q = append(q, w)
					vis[w] = true
				}
			}
		}
		for _, v := range vis {
			if !v {
				Fprintln(out, -1)
				continue o
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

var n, d int

var a []int

var writer *bufio.Writer

func main() {

	read := bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)

	var t int
	fmt.Fscan(read, &t)

	for i := 0; i < t; i++ {
		fmt.Fscan(read, &n, &d)

		a = make([]int, n)

		for j := 0; j < n; j++ {
			fmt.Fscan(read, &a[j])
		}

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx int
}

type byV []*pair

func (a byV) Len() int           { return len(a) }
func (a byV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a byV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

var step []int
var seen []bool

func solve () int {
	//a^[i] = a[(i + n - d) % n]
	//i = (i + d) % n

	//1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0

	step = make([]int, n)
	seen = make([]bool, n)

	for i := 0; i < n; i++ {
		step[i] = -1
	}

	for i := n - 1; i >= 0; i-- {
		if a[i] == 1 {
			if seen[i] {
				continue
			}
			s := rec(i)

			if s == -1 {
				return -1
			}
		}
	}

	var max int

	for i := 0; i < n; i++ {
		if step[i] > max {
			max = step[i]
		}
	}

	return max
}

func rec(cur int) int {
	if seen[cur] {
		return -1
	}
	seen[cur] = true
	prevIdx := (cur - d + n) % n

	if a[prevIdx] == 1 {
		if step[prevIdx] != -1 {
			s := step[prevIdx]

			step[cur] = s + 1

			return s + 2
		}

		s := rec(prevIdx)

		if s == -1 {
			return -1
		}
		step[cur] = s

		return s + 1

	} else {
		step[cur] = 1

		return 2
	}
}


package main

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

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

	tc := readNum(reader)
	var buf bytes.Buffer
	for tc > 0 {
		tc--
		n := readNum(reader)
		G := make([]string, n)
		for i := 0; i < n; i++ {
			G[i], _ = reader.ReadString('\n')
		}
		res := solve(n, G)
		buf.WriteString(fmt.Sprintf("%d\n", len(res)))
		for i := 0; i < len(res); i++ {
			buf.WriteString(fmt.Sprintf("%d %d\n", res[i][0], res[i][1]))
		}
	}
	fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, G []string) [][]int {
	if G[0][1] == G[1][0] {
		// same top-left
		if G[n-1][n-2] == G[n-2][n-1] {
			if G[0][1] != G[n-1][n-2] {
				return nil
			}
			return [][]int{{n - 2 + 1, n - 1 + 1}, {n - 1 + 1, n - 2 + 1}}
		}
		if G[n-1][n-2] == G[0][1] {
			return [][]int{{n - 1 + 1, n - 2 + 1}}
		}
		return [][]int{{n - 2 + 1, n - 1 + 1}}
	}
	if G[n-1][n-2] == G[n-2][n-1] {
		if G[0][1] == G[n-1][n-2] {
			return [][]int{{1, 2}}
		}
		return [][]int{{2, 1}}
	}

	// both different
	//01  10
	if G[0][1] == G[n-1][n-2] {
		return [][]int{{1, 2}, {n - 1, n}}
	}
	return [][]int{{1, 2}, {n, n - 1}}
}

package main

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

var _r = bufio.NewReader(os.Stdin)
var _w = bufio.NewWriter(os.Stdout)

var T, n int

func main() {
	for _, _ = fmt.Fscan(_r, &T); T > 0; T-- {
		_, _ = fmt.Fscan(_r, &n)
		pic := make([]string, n)

		for i := 0; i < n; i++ {
			_, _ = fmt.Fscan(_r, &pic[i])
		}

		s1 := string(pic[0][1]) + string(pic[1][0])
		s2 := string(pic[n-1][n-2]) + string(pic[n-2][n-1])

		if s1[0] == s1[1] && s2[0] == s2[1] && s1[0] == s2[0] {
			_, _ = fmt.Fprintln(_w, 2)
			_, _ = fmt.Fprintln(_w, 1, 2)
			_, _ = fmt.Fprintln(_w, 2, 1)
			_ = _w.Flush()
			continue
		}

		if s1[0] == s1[1] && s2[0] == s2[1] {
			_, _ = fmt.Fprintln(_w, 0)
			_ = _w.Flush()
			continue
		}

		if (s1[0] != s1[1]) && (s2[0] != s2[1]) {
			_, _ = fmt.Fprintln(_w, 2)
			if s1[0] == '0' {
				_, _ = fmt.Fprintln(_w, 1, 2)
			} else {
				_, _ = fmt.Fprintln(_w, 2, 1)
			}
			if s2[0] == '1' {
				_, _ = fmt.Fprintln(_w, n, n-1)
			} else {
				_, _ = fmt.Fprintln(_w, n-1, n)
			}
			_ = _w.Flush()
			continue
		}

		if s1[0] == s1[1] {
			_, _ = fmt.Fprintln(_w, 1)
			if s2[0] == s1[0] {
				_, _ = fmt.Fprintln(_w, n, n-1)
			} else {
				_, _ = fmt.Fprintln(_w, n-1, n)
			}
			_ = _w.Flush()
			continue
		}

		if s2[0] == s2[1] {
			_, _ = fmt.Fprintln(_w, 1)
			if s1[0] == s2[0] {
				_, _ = fmt.Fprintln(_w, 1, 2)
			} else {
				_, _ = fmt.Fprintln(_w, 2, 1)
			}
			_ = _w.Flush()
			continue
		}

	}
}

package main

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

func main() {
	defer _w.Flush()
	t := ReadInt()
	for i := 0; i < t; i++ {
		n := ReadInt()
		grid := make([][]byte, n)
		for i := 0; i < n; i++ {
			grid[i] = []byte(ReadString())
		}
		solve(grid)
	}
}

func solve(grid [][]byte) {
	n := len(grid)
	cands := [][2]int{
		{0, 1}, {1, 0}, {n - 1, n - 2}, {n - 2, n - 1},
	}
	if isAns(grid) {
		println(0)
		return
	}
	var x, y int
	for i := 0; i < 3; i++ {
		for j := i + 1; j < 4; j++ {
			x, y = cands[i][0], cands[i][1]
			grid[y][x] = invert(grid[y][x])
			x, y = cands[j][0], cands[j][1]
			grid[y][x] = invert(grid[y][x])
			if isAns(grid) {
				println(2)
				println(cands[i][1]+1, cands[i][0]+1)
				println(cands[j][1]+1, cands[j][0]+1)
				return
			}
			x, y = cands[i][0], cands[i][1]
			grid[y][x] = invert(grid[y][x])
			x, y = cands[j][0], cands[j][1]
			grid[y][x] = invert(grid[y][x])
		}
	}
	for i := 0; i < 4; i++ {
		x, y = cands[i][0], cands[i][1]
		grid[y][x] = invert(grid[y][x])
		if isAns(grid) {
			println(1)
			println(cands[i][1]+1, cands[i][0]+1)
			return
		}
		x, y = cands[i][0], cands[i][1]
		grid[y][x] = invert(grid[y][x])
	}
	println(0)
}

func invert(c byte) byte {
	if c == '0' {
		return '1'
	}
	return '0'
}

// 0でも1でも到達できないならtrue
func isAns(grid [][]byte) bool {
	n := len(grid)
	{
		visited := make([][]bool, n)
		for i := 0; i < n; i++ {
			visited[i] = make([]bool, n)
		}
		if dfs(1, 0, grid, grid[0][1], visited) {
			return false
		}
	}
	{
		visited := make([][]bool, n)
		for i := 0; i < n; i++ {
			visited[i] = make([]bool, n)
		}
		if dfs(0, 1, grid, grid[1][0], visited) {
			return false
		}
	}
	return true
}

var dx = []int{1, 0, -1, 0}
var dy = []int{0, 1, 0, -1}

// ゴールまで行けたらtrue
func dfs(x, y int, grid [][]byte, sel byte, visited [][]bool) bool {
	n := len(grid)
	visited[y][x] = true
	for i := 0; i < 4; i++ {
		nx, ny := x+dx[i], y+dy[i]
		if 0 <= nx && nx < n && 0 <= ny && ny < n {
			if nx == n-1 && ny == n-1 {
				return true
			}
			if grid[ny][nx] == sel && !visited[ny][nx] {
				if dfs(nx, ny, grid, sel, visited) {
					return true
				}
			}
		}
	}
	return false
}

var _r, _w = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func print(a ...interface{})            { fmt.Fprint(_w, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(_w, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(_w, a...) }
func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(_r, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }
func ReadInt() (i int)       { Scan(&i); return }
func ReadInts(n int) (a []int) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt())
	}
	return
}
func ReadInt64() (i int64) { Scan(&i); return }
func ReadInt64s(n int) (a []int64) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt64())
	}
	return
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1421B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		a := make([]string, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		ans := [][2]int{}
		if a[0][1] == a[1][0] {
			if a[n-2][n-1] == a[0][1] {
				ans = append(ans, [2]int{n - 2, n - 1})
			}
			if a[n-1][n-2] == a[0][1] {
				ans = append(ans, [2]int{n - 1, n - 2})
			}
		} else if a[n-2][n-1] == a[n-1][n-2] {
			if a[n-2][n-1] == a[0][1] {
				ans = append(ans, [2]int{0, 1})
			}
			if a[n-2][n-1] == a[1][0] {
				ans = append(ans, [2]int{1, 0})
			}
		} else {
			ans = append(ans, [2]int{0, 1})
			if a[n-2][n-1] == a[1][0] {
				ans = append(ans, [2]int{n - 2, n - 1})
			} else {
				ans = append(ans, [2]int{n - 1, n - 2})
			}
		}
		Fprintln(out, len(ans))
		for _, p := range ans {
			Fprintln(out, p[0]+1, p[1]+1)
		}
	}
}

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