package main

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

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	var n, m, k, a, b int

	scan(&n, &m, &k)

	field := make([][]int, n)
	isLose := false

	for i := range field {
		field[i] = make([]int, m)
	}

	for move := 1; move <= k; move++ {
		scan(&a, &b)
		a--
		b--

		field[a][b] = 1
		isLose = false

		switch {
		case a > 0 && b > 0 && field[a-1][b-1] == 1 && field[a-1][b] == 1 && field[a][b-1] == 1:
			isLose = true
		case b > 0 && a < n-1 && field[a][b-1] == 1 && field[a+1][b-1] == 1 && field[a+1][b] == 1:
			isLose = true
		case a > 0 && b < m-1 && field[a-1][b] == 1 && field[a-1][b+1] == 1 && field[a][b+1] == 1:
			isLose = true
		case a < n-1 && b < m-1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1:
			isLose = true
		}

		if isLose {
			println(move)
			return
		}
	}

	println(0)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

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

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	var n, m, k, a, b int

	n, m, k = nextInt(), nextInt(), nextInt()

	field := make([][]int, n + 2)
	isLose := false

	for i := range field {
		field[i] = make([]int, m + 2)
	}

	for move := 1; move <= k; move++ {
		a, b = nextInt(), nextInt()

		field[a][b] = 1
		isLose = false

		switch {
		case field[a-1][b-1] == 1 && field[a-1][b] == 1 && field[a][b-1] == 1:
			isLose = true
		case field[a+1][b-1] == 1 && field[a+1][b] == 1 && field[a][b-1] == 1:
			isLose = true
		case field[a-1][b+1] == 1 && field[a-1][b] == 1 && field[a][b+1] == 1:
			isLose = true
		case field[a+1][b+1] == 1 && field[a+1][b] == 1 && field[a][b+1] == 1:
			isLose = true
		}

		if isLose {
			println(move)
			return
		}
	}

	println(0)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, m, k := nextInt(), nextInt(), nextInt()
	a, b := 0, 0
	field := make([][]int, n)
	isLose := false

	for i := range field {
		field[i] = make([]int, m)
	}

	for move := 1; move <= k; move++ {
		a, b = nextInt() - 1, nextInt() - 1

		field[a][b] = 1
		isLose = false

		switch {
			case a > 0 && b > 0 && field[a-1][b-1] == 1 && field[a-1][b] == 1 && field[a][b-1] == 1:
				isLose = true
			case b > 0 && a < n-1 && field[a][b-1] == 1 && field[a+1][b-1] == 1 && field[a+1][b] == 1:
				isLose = true
			case a > 0 && b < m-1 && field[a-1][b] == 1 && field[a-1][b+1] == 1 && field[a][b+1] == 1:
				isLose = true
			case a < n-1 && b < m-1 && field[a+1][b] == 1 && field[a][b+1] == 1 && field[a+1][b+1] == 1:
				isLose = true
		}

		if isLose {
			println(move)
			return
		}
	}

	println(0)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

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

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	var n, m, k, a, b int
	n, m, k = nextInt(), nextInt(), nextInt()
	field := [1005][1005]bool{}

	// field := make([][]bool, n + 2)
	isLose := false
	_, _ = n, m
	// for i := range field {
	// 	field[i] = make([]bool, m + 2)
	// }

	for move := 1; move <= k; move++ {
		a, b = nextInt(), nextInt()

		field[a][b] = true
		isLose = false

		switch {
		case field[a-1][b-1] && field[a-1][b] && field[a][b-1]:
			isLose = true
		case field[a+1][b-1] && field[a+1][b] && field[a][b-1]:
			isLose = true
		case field[a-1][b+1] && field[a-1][b] && field[a][b+1]:
			isLose = true
		case field[a+1][b+1] && field[a+1][b] && field[a][b+1]:
			isLose = true
		}

		if isLose {
			println(move)
			return
		}
	}

	println(0)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

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

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	var n, m, k, a, b int

	n, m, k = nextInt(), nextInt(), nextInt()

	field := make([][]bool, n + 2)
	isLose := false

	for i := range field {
		field[i] = make([]bool, m + 2)
	}

	for move := 1; move <= k; move++ {
		a, b = nextInt(), nextInt()

		field[a][b] = true
		isLose = false

		switch {
		case field[a-1][b-1] && field[a-1][b] && field[a][b-1]:
			isLose = true
		case field[a+1][b-1] && field[a+1][b] && field[a][b-1]:
			isLose = true
		case field[a-1][b+1] && field[a-1][b] && field[a][b+1]:
			isLose = true
		case field[a+1][b+1] && field[a+1][b] && field[a][b+1]:
			isLose = true
		}

		if isLose {
			println(move)
			return
		}
	}

	println(0)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

package main

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

var scanner *bufio.Scanner

func getI() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func geti() int {
  return int(getI())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  up := [][]int{ {-1, -1}, {-1, 0}, {0, -1}, {0, 0} }
  down := [][]int{ {0, 0}, {0, 1}, {1, 0}, {1, 1} }

  _, _, k := geti(), geti(), geti()
  points := map[[2]int]bool{}
  for i := 0; i < k; i++ {
    x, y := geti(), geti()
    point := [2]int{ x, y }
    points[point] = true
    for j := 0; j < 4; j++ {
      x0, y0 := x+up[j][0], y+up[j][1]
      okay := true
      for k := 0; k < 4; k++ {
        seek := [2]int{ x0+down[k][0], y0+down[k][1] }
        _, found := points[seek]
        if !found {
          okay = false
          break
        }
      }
      if okay {
        writer.WriteString(fmt.Sprintf("%d\n", i+1))
        return
      }
    }
  }
  writer.WriteString("0\n")
}

package main

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

func main() {
	var n, m, k int
	if _, err := fmt.Scanf("%d %d %d\n", &n, &m, &k); err != nil {
		return
	}

	board := make([][]int, n)
	for i := 0; i < n; i++ {
		board[i] = make([]int, m)
	}
	lost := false
	lost_at := -1

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

	for i := 0; i < k; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err != io.EOF {
				return
			}
		} else if lost {
			continue
		} else {
			s = re.ReplaceAllString(s, "")
			xy := strings.Split(s, " ")
			if len(xy) != 2 {
				return
			}

			x, err := strconv.Atoi(xy[0])
			if err != nil {
				return
			}
			y, err := strconv.Atoi(xy[1])
			if err != nil {
				return
			}
			board[x-1][y-1] = 1
			if lose(board, n, m, x-1, y-1) {
				lost = true
				lost_at = i + 1
			}
		}
	}

	if lost {
		fmt.Println(lost_at)
	} else {
		fmt.Println(0)
	}
}

func lose(b [][]int, n, m, x, y int) bool {
	if x > 0 && y > 0 {
		if b[x-1][y-1] == 1 && b[x-1][y] == 1 && b[x][y-1] == 1 {
			return true
		}
	}
	if x > 0 && y < m-1 {
		if b[x-1][y+1] == 1 && b[x-1][y] == 1 && b[x][y+1] == 1 {
			return true
		}
	}
	if x < n-1 && y < m-1 {
		if b[x+1][y+1] == 1 && b[x+1][y] == 1 && b[x][y+1] == 1 {
			return true
		}
	}
	if x < n-1 && y > 0 {
		if b[x+1][y-1] == 1 && b[x+1][y] == 1 && b[x][y-1] == 1 {
			return true
		}
	}
	return false
}

package main

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

var (
	n, m, k int
	mi, mj  []int
	board   [][]int
	result  int = 0
)

func in() {
	read(&n, &m, &k)
	mi = make([]int, k)
	mj = make([]int, k)
	for i := 0; i < k; i++ {
		read(&mi[i], &mj[i])
	}
}

func out() {
	println(result)
	defer output.Flush()
}

func run() {
	if n < 2 || m < 2 {
		return
	}

	board = make([][]int, n)
	for i := 0; i < n; i++ {
		board[i] = make([]int, m)
	}
	for i := 0; i < k; i++ {
		x := mi[i] - 1
		y := mj[i] - 1
		board[x][y] = 1
		if check(x, y) {
			result = i + 1
			return
		}
	}
}

func check(x, y int) bool {
	// left top
	if x > 0 && y > 0 {
		if board[x-1][y-1] == 1 && board[x][y-1] == 1 && board[x-1][y] == 1 {
			return true
		}
	}

	// right top
	if x > 0 && y < m-1 {
		if board[x-1][y+1] == 1 && board[x-1][y] == 1 && board[x][y+1] == 1 {
			return true
		}
	}

	// bottom left
	if x < n-1 && y > 0 {
		if board[x+1][y-1] == 1 && board[x+1][y] == 1 && board[x][y-1] == 1 {
			return true
		}
	}

	// bottom right
	if x < n-1 && y < m-1 {
		if board[x+1][y+1] == 1 && board[x+1][y] == 1 && board[x][y+1] == 1 {
			return true
		}
	}

	return false
}

/** main **/
func main() {
	in()
	run()
	out()
}

// Input & Output
var (
	input  = bufio.NewReader(os.Stdin)
	output = bufio.NewWriter(os.Stdout)
)

func read(a ...interface{}) {
	_, err := fmt.Fscan(input, a...)
	if err != nil {
		println(err)
	}
}

func println(a ...interface{}) {
	fmt.Fprintln(output, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(output, format, a...)
}

package main

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

func pp(in io.Reader) {
	b := [1000][1000]bool{}
	var n, m, k int
	fmt.Fscanf(in, "%d %d %d\n", &n, &m, &k)
	loses := func(i, j int) bool {
		if i < 0 || j < 0 || i+1 >= n || j+1 >= m {
			return false
		}
		return b[i][j] && b[i+1][j] && b[i+1][j+1] && b[i][j+1]
	}
	pb := func() {
		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				if b[i][j] {
					fmt.Print("x")
				} else {
					fmt.Print("_")
				}
			}
			fmt.Println()
		}
	}
	_ = pb
	for move := 1; move <= k; move++ {
		var i, j int
		fmt.Fscanf(in, "%d %d\n", &i, &j)
		i--
		j--
		// fmt.Println(i, j)
		b[i][j] = true
		if loses(i, j) || loses(i-1, j) || loses(i, j-1) || loses(i-1, j-1) {
			fmt.Println(move)
			return
		}
		// pb()
		// fmt.Println()
	}
	fmt.Println(0)
}

func main() {
	pp(os.Stdin)
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Split(bufio.ScanWords)
	if !sc.Scan() {
		panic("could not scan a word from the reader")
	}
	return sc.Text()
}

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

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

func nextLine() string {
	sc.Split(bufio.ScanLines)
	if !sc.Scan() {
		panic("could not scan a line from the reader")
	}
	return sc.Text()
}

func main() {
	_, _, K := nextInt(), nextInt(), nextInt()
	var f [1010][1010]int
	k := 1
	for ; k <= K; k++ {
		i, j := nextInt(), nextInt()
		f[i][j] = 1
		var dr = [4]int{0, 0, 1, 1}
		var dc = [4]int{0, 1, 0, 1}
		r0 := i - 1
		c0 := j - 1
		for i := 0; i < 4; i++ {
			r := r0 + dr[i]
			c := c0 + dc[i]
			b := 1
			for j := 0; j < 4; j++ {
				r1 := r + dr[j]
				c1 := c + dc[j]
				b &= f[r1][c1]
			}
			if b == 1 {
				fmt.Println(k)
				return
			}
		}
	}
	fmt.Println(0)
}

package main

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

func is_lose(img [][]int, x, y int) bool {
	ret := false
	if img[x-1][y-1]+img[x-1][y]+img[x][y-1]+img[x][y] == 4 {
		ret = true
	} else if img[x-1][y+1]+img[x-1][y]+img[x][y+1]+img[x][y] == 4 {
		ret = true
	} else if img[x+1][y-1]+img[x+1][y]+img[x][y-1]+img[x][y] == 4 {
		ret = true
	} else if img[x+1][y+1]+img[x+1][y]+img[x][y+1]+img[x][y] == 4 {
		ret = true
	}

	return ret
}

/*
func dump(img [][]int, n, m int) {
	for i := 0; i < n+2; i++ {
		for j := 0; j < m+2; j++ {
			fmt.Printf("%d ", img[i][j])
		}
		fmt.Println()
	}
}
*/

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	img := [][]int{}
	for i := 0; i <= n+1; i++ {
		row := make([]int, m+2, m+2)
		img = append(img, row)
	}

	ans := 0
	bs := bufio.NewScanner(os.Stdin)
	bs.Split(bufio.ScanWords)
	for i := 0; i < k; i++ {
		bs.Scan()
		x, _ := strconv.Atoi(bs.Text())
		bs.Scan()
		y, _ := strconv.Atoi(bs.Text())

		img[x][y] = 1
		//dump(img, n, m)
		if is_lose(img, x, y) {
			ans = i + 1
			break
		}
	}

	fmt.Println(ans)
}

package main

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

func is_lose(img [][]int, x, y int) bool {
	/*
		if img[x-1][y-1]+img[x-1][y]+img[x][y-1]+img[x][y] == 4 {
			return true
		}
		if img[x-1][y+1]+img[x-1][y]+img[x][y+1]+img[x][y] == 4 {
			return true
		}
		if img[x+1][y-1]+img[x+1][y]+img[x][y-1]+img[x][y] == 4 {
			return true
		}
		if img[x+1][y+1]+img[x+1][y]+img[x][y+1]+img[x][y] == 4 {
			return true
		}
	*/

	return false
}

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	img := [][]int{}
	for i := 0; i <= n+1; i++ {
		row := make([]int, m+2, m+2)
		img = append(img, row)
	}

	ans := 0
	bs := bufio.NewScanner(os.Stdin)
	bs.Split(bufio.ScanWords)
	for i := 0; i < k; i++ {
		bs.Scan()
		x, _ := strconv.Atoi(bs.Text())
		bs.Scan()
		y, _ := strconv.Atoi(bs.Text())

		img[x][y] = 1
		if is_lose(img, x, y) {
			ans = i + 1
		}
	}

	fmt.Println(ans)
}

package main

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

func is_lose(img [][]int, x, y int) bool {
	ret := false
	if img[x-1][y-1]+img[x-1][y]+img[x][y-1]+img[x][y] == 4 {
		ret = true
	} else if img[x-1][y+1]+img[x-1][y]+img[x][y+1]+img[x][y] == 4 {
		ret = true
	} else if img[x+1][y-1]+img[x+1][y]+img[x][y-1]+img[x][y] == 4 {
		ret = true
	} else if img[x+1][y+1]+img[x+1][y]+img[x][y+1]+img[x][y] == 4 {
		ret = true
	}

	return ret
}

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	img := [][]int{}
	for i := 0; i <= n+1; i++ {
		row := make([]int, m+2, m+2)
		img = append(img, row)
	}

	ans := 0
	bs := bufio.NewScanner(os.Stdin)
	bs.Split(bufio.ScanWords)
	for i := 0; i < k; i++ {
		bs.Scan()
		x, _ := strconv.Atoi(bs.Text())
		bs.Scan()
		y, _ := strconv.Atoi(bs.Text())

		img[x][y] = 1
		if is_lose(img, x, y) {
			ans = i + 1
		}
	}

	fmt.Println(ans)
}

package main

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

/*
func is_lose(img [][]int, x, y int) bool {
	if img[x-1][y-1]+img[x-1][y]+img[x][y-1]+img[x][y] == 4 {
		return true
	}
	if img[x-1][y+1]+img[x-1][y]+img[x][y+1]+img[x][y] == 4 {
		return true
	}
	if img[x+1][y-1]+img[x+1][y]+img[x][y-1]+img[x][y] == 4 {
		return true
	}
	if img[x+1][y+1]+img[x+1][y]+img[x][y+1]+img[x][y] == 4 {
		return true
	}

	return false
}
*/

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	img := [][]int{}
	for i := 0; i <= n+1; i++ {
		row := make([]int, m+2, m+2)
		img = append(img, row)
	}

	ans := 0
	/*
		bs := bufio.NewScanner(os.Stdin)
		bs.Split(bufio.ScanWords)
		for i := 0; i < k; i++ {
			bs.Scan()
			x, _ := strconv.Atoi(bs.Text())
			bs.Scan()
			y, _ := strconv.Atoi(bs.Text())

			img[x][y] = 1
			if is_lose(img, x, y) {
				ans = i + 1
			}
		}
	*/

	fmt.Println(ans)
}

package main

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

/*
func is_lose(img [][]int, x, y int) bool {
	if img[x-1][y-1]+img[x-1][y]+img[x][y-1]+img[x][y] == 4 {
		return true
	}
	if img[x-1][y+1]+img[x-1][y]+img[x][y+1]+img[x][y] == 4 {
		return true
	}
	if img[x+1][y-1]+img[x+1][y]+img[x][y-1]+img[x][y] == 4 {
		return true
	}
	if img[x+1][y+1]+img[x+1][y]+img[x][y+1]+img[x][y] == 4 {
		return true
	}

	return false
}
*/

func main() {
	var n, m, k int
	fmt.Scan(&n, &m, &k)

	img := [][]int{}
	for i := 0; i <= n+1; i++ {
		row := make([]int, m+2, m+2)
		img = append(img, row)
	}

	ans := 0
	bs := bufio.NewScanner(os.Stdin)
	bs.Split(bufio.ScanWords)
	for i := 0; i < k; i++ {
		bs.Scan()
		x, _ := strconv.Atoi(bs.Text())
		bs.Scan()
		y, _ := strconv.Atoi(bs.Text())

		img[x][y] = 1
		/*if is_lose(img, x, y) {
			ans = i + 1
		}*/
	}

	fmt.Println(ans)
}


package main

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

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

	for ; t>0; t-- {
		fmt.Fscan(io, &n)
		arr := make([]int, 0, n)
		counter = 0
		for i:=4*n; i>0 && counter<n; i-- {
			if i%2==0 {
				if len(arr) != 0 {
					for _, num := range arr {
						if num%i!=0 {
							arr = append(arr, i)
							fmt.Printf("%d ", i)
							counter++
							break
						}
					}
				} else {
					arr = append(arr, i)
					fmt.Printf("%d ", i)
					counter++
				}
			}
		}
		fmt.Println()
	}

}

package main
import "fmt"
func solution (n int) ([]int){
		sol:=make([]int,0)

	 for i:=4*n;i>=2*n;i=i-2 {
		 sol=append(sol,i)
		}
		  return  sol
}
func main() {
	var test=0
	fmt.Scanln(&test)
	for t:=1;t<=test;t++{
	var n =0
 fmt.Scanln(&n);
 sol:=solution(n)
 for i:=0;i<n;i++{
	 fmt.Printf("%d ",sol[i])
 }
 fmt.Println()
}

}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	var t int

	fmt.Fscan(reader, &t)

	for ; t > 0; t-- {
		var n int

		fmt.Fscan(reader, &n)

		var arr []int
		count := 0

		for i := 4 * n; i >= 4; i -= 2 {
			if count == 0 {
				arr = append(arr, i)
				count++
				continue
			}

			if check(i, arr) {
				arr = append(arr, i)
				count++
			}

			if count == n {
				break
			}
		}

		for i := range arr {
			fmt.Printf("%d ", arr[i])
		}

		fmt.Printf("\n")
	}

}

func check(n int, arr []int) bool {
	flag := true

	for i := range arr {
		if n%arr[i] == 0 {
			flag = false
			break
		}
	}

	return flag
}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	var t int

	fmt.Fscan(reader, &t)

	for ; t > 0; t-- {
		var n int

		fmt.Fscan(reader, &n)

		var arr []int
		count := 0

		for i := 4 * n; i >= 4; i -= 2 {
			if count == 0 {
				arr = append(arr, i)
				count++
				continue
			}

			//if check(i, arr) {
			arr = append(arr, i)
			count++
			//}

			if count == n {
				break
			}
		}

		for i := range arr {
			fmt.Printf("%d ", arr[i])
		}

		fmt.Printf("\n")
	}

}

func check(n int, arr []int) bool {
	flag := true

	for i := range arr {
		if n%arr[i] == 0 {
			flag = false
			break
		}
	}

	return flag
}

package main

import (
	"fmt"
)

func main() {

	var t int

	fmt.Scanf("%d\n", &t)

	for {
		if t == 0 {
			break
		}
		var n int
		fmt.Scanf("%d\n", &n)

		var mark = make([]int, 4*n+1)
		for i := 4 * n; i >= 4; i -= 2 {
			if mark[i] != 0 {
				continue
			}

			fmt.Print(i, " ")

			for j := i; j >= 4; j -= 2 {
				if i%j == 0 {
					mark[j] = 1
				}
			}
		}

		fmt.Println()
		t--
	}
}

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
)

func main() {
		var t int
    fmt.Scan(&t)
    for i := 0; i < t; i++ {
				var n int
				fmt.Scan(&n)
				for i := 4 * n; i > 2 * n; i -= 2 {
					fmt.Print(i)
					fmt.Print(" ")
				}
				fmt.Println()
    }
}

/*
URL:
https://codeforces.com/contest/1443/problem/A
*/

package main

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

var (
	t int
	n int
)

func main() {
	defer stdout.Flush()

	t = readi()
	for tc := 0; tc < t; tc++ {
		n = readi()

		solve()
	}
}

func solve() {
	A := []int{}

	for i := 0; i < n; i++ {
		val := 4*n - 2*i
		A = append(A, val)
	}

	fmt.Println(PrintIntsLine(A...))
}

/*******************************************************************/

/********** common constants **********/

const (
	MOD = 1000000000 + 7
	// MOD          = 998244353
	ALPH_N  = 26
	INF_I64 = math.MaxInt64
	INF_B60 = 1 << 60
	INF_I32 = math.MaxInt32
	INF_B30 = 1 << 30
	NIL     = -1
	EPS     = 1e-10
)

/********** bufio setting **********/

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	reads = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

// mod can calculate a right residual whether value is positive or negative.
func mod(val, m int) int {
	res := val % m
	if res < 0 {
		res += m
	}
	return res
}

// min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// chmin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func chmin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// chmax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func chmax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// sum returns multiple integers sum.
func sum(integers ...int) int {
	var s int
	s = 0

	for _, i := range integers {
		s += i
	}

	return s
}

// abs is integer version of math.Abs
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// pow is integer version of math.Pow
// pow calculate a power by Binary Power (二分累乗法(O(log e))).
func pow(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := pow(a, halfE)
		return half * half
	}

	return a * pow(a, e-1)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := reads()
//i := readi()
//X := readis(n)
//S := readrs()
//a := readf()
//A := readfs(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*********** Input ***********/

var (
	// reads returns a WORD string.
	reads  func() string
	stdout *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// readi returns an integer.
func readi() int {
	return int(_readInt64())
}
func readi2() (int, int) {
	return int(_readInt64()), int(_readInt64())
}
func readi3() (int, int, int) {
	return int(_readInt64()), int(_readInt64()), int(_readInt64())
}
func readi4() (int, int, int, int) {
	return int(_readInt64()), int(_readInt64()), int(_readInt64()), int(_readInt64())
}

// readll returns as integer as int64.
func readll() int64 {
	return _readInt64()
}
func readll2() (int64, int64) {
	return _readInt64(), _readInt64()
}
func readll3() (int64, int64, int64) {
	return _readInt64(), _readInt64(), _readInt64()
}
func readll4() (int64, int64, int64, int64) {
	return _readInt64(), _readInt64(), _readInt64(), _readInt64()
}

func _readInt64() int64 {
	i, err := strconv.ParseInt(reads(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// readis returns an integer slice that has n integers.
func readis(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readi()
	}
	return b
}

// readlls returns as int64 slice that has n integers.
func readlls(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = readll()
	}
	return b
}

// readf returns an float64.
func readf() float64 {
	return float64(_readFloat64())
}

func _readFloat64() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func readfs(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = readf()
	}
	return b
}

// readrs returns a rune slice.
func readrs() []rune {
	return []rune(reads())
}

/*********** Output ***********/

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// Printf is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func printf(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*********** Debugging ***********/

// debugf is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func debugf(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

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 N int
		scanf("%d\n", &N)

		res := make([]int, N)
		for i := 0; i < N; i++ {
			res[i] = 2*(2*N-i)
		}

		for i := 0; i < N; i++ {
			if i != N-1 {
				printf("%d ", res[i])
			} else {
				printf("%d\n", res[i])
			}
		}

	}

}

package main

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

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		solveSingle()
	}
}

func solveSingle() {
	n := readInt()
	up := (n * 4) - 2
	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Print(" ")
		}
		fmt.Print(up)
		up -= 2
	}
	fmt.Println()
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

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

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main
import "fmt"
func main() {
	q := 0
	fmt.Scan(&q)
	for t := 0; t < q; t++ {
		n := 0
		fmt.Scan(&n)
		for i := 2 * n + 2; i <= 4 * n; i += 2 {
			fmt.Print(i, " ")
		}
		fmt.Println()
	}
}

package main

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

func main() {
	//rd, _ := os.Open("input")
	//in := bufio.NewReader(rd)
	in := bufio.NewReader(os.Stdin)

	var t, n int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		result := ""
		for i := 0; i < n; i++ {
			result += strconv.Itoa(4*n-2*i) + " "
		}
		fmt.Println(result)
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func main() {
	var t int
	fmt.Fscan(reader, &t)

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

		for j, k := 0, 4*n; j < n; j, k = j+1, k-2 {
			fmt.Printf("%d ", k)
		}

		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)

	for count := 0; count < t; count++ {
		var q int
		fmt.Scanf("%d\n", &q)

		base := 2 * q

		for i := 0; i < q; i++ {
			fmt.Printf("%d ", base)
			base += 2
			// if i >= 1 {
			// 	base += 2
			// }

		}
		fmt.Println("")

	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func print(str string) {
	writer.WriteString(str)
}

func nextInt() int {
	scanner.Scan()
	str := scanner.Text()
	val, _ := strconv.Atoi(str)
	return val
}

func nextFloat() float64 {
	scanner.Scan()
	str := scanner.Text()
	val, _ := strconv.ParseFloat(str, 64)
	return val
}

func nextString() string {
	scanner.Scan()
	str := scanner.Text()
	return str
}

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

func main() {
	scanner.Split(bufio.ScanWords)
	defer writer.Flush()

	t := nextInt()
	for t != 0 {
		n := nextInt()
		for x := n + 1; x <= 2*n; x++ {
			print(strconv.Itoa(2*x) + " ")
		}
		print("\n")
		t--
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scan(&t)
	for i:=1;i<=t;i++{
		fmt.Scan(&a)
		s=4*a
		for j:=1;j<=a;j++{
			s-=2
			fmt.Printf("%d ",s)
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scan(&a)
		s=4*a
		for j:=1;j<=a;j++{
			s-=2
			fmt.Printf("%d ",s)
		}
		fmt.Printf("\n")
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func main() {
	var t int
	fmt.Fscan(reader, &t)

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

		sieve := make([]bool, 4*n+1)
		var chairs []int
		for j := 4; j <= 4*n; j += 2 {
			if len(chairs) == n {
				break
			}

			if j%2 == 1 {
				continue
			}

			if sieve[j] == true {
				continue
			}

			chairs = append(chairs, j)

			for k := j + j; k <= 4*n; k += j {
				sieve[k] = true
			}
		}

		for _, c := range chairs {
			fmt.Printf("%d ", c)
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d\n", &t)

	for count := 0; count < t; count++ {
		var q int
		fmt.Scanf("%d\n", &q)

		base := 4

		for i := 0; i < q; i++ {
			fmt.Printf("%d ", base)
			base += 2
			if i >= 1 {
				base += 2
			}

		}
		fmt.Println("")

	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scanf("%d",&a)
		s=4*a
		for j:=1;j<=a;j++{
			s-=2
			if j!=a {
				fmt.Printf("%d ",s)
			}else{
				fmt.Printf("%d\n",s)
			}
		}
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scanf("%d",&a)
		s=4
		for j:=1;j<=a;j++{
			fmt.Printf("%d ",s)
			if j==1 {
				s+=2
			}else {
				s+=4
			}
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scanf("%d",&a)
		s=4
		for j:=1;j<=a;j++{
			fmt.Printf("%d ",s)
			if j==1 {
				s+=2
			}else {
				s+=4
			}
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scanf("%d",&a)
		s=4*a
		for j:=1;j<=a;j++{
			s-=2
			fmt.Printf("%d ",s)
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
)

var t,a,s,c int

func main()  {
	fmt.Scanf("%d",&t)
	for i:=1;i<=t;i++{
		fmt.Scanf("%d",&a)
		s=4
		c=2
		for j:=1;j<=a;j++{
			fmt.Printf("%d ",s)
			s+=c
			c+=2
		}
		fmt.Println()
	}
}

package main
import "fmt"
func solution (n int) ([]int){
		sol:=make([]int,0)
     for i:=1;i<=4*n;i++{
		 if i%2!=0{
			sol=append(sol,2*i)

		 }
	 }
	 return  sol
}
func main() {
	var test=0
	fmt.Scanln(&test)
	for t:=1;t<=test;t++{
	var n =0
 fmt.Scanln(&n);
 sol:=solution(n)
 for i:=0;i<n;i++{
	 fmt.Printf("%d ",sol[i])
 }
 fmt.Println()
}

}

package main
import "fmt"
func solution (n int) ([]int){
		sol:=make([]int,0)
		sol=append(sol,4)
     for i:=2;i<=4*n;i++{
		 if i%2!=0{
			sol=append(sol,2*i)

		 }
	 }
	 return  sol
}
func main() {
	var test=0
	fmt.Scanln(&test)
	for t:=1;t<=test;t++{
	var n =0
 fmt.Scanln(&n);
 sol:=solution(n)
 for i:=0;i<n;i++{
	 fmt.Printf("%d ",sol[i])
 }
 fmt.Println()
}

}

package main
import "fmt"
func solution (n int) ([]int){
		sol:=make([]int,0)
     for i:=2;i<=4*n;i++{
		 if i%2!=0{
			sol=append(sol,2*i)

		 }
	 }
	 return  sol
}
func main() {
	var test=0
	fmt.Scanln(&test)
	for t:=1;t<=test;t++{
	var n =0
 fmt.Scanln(&n);
 sol:=solution(n)
 for i:=0;i<n;i++{
	 fmt.Printf("%d ",sol[i])
 }
 fmt.Println()
}

}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	var t int

	fmt.Fscan(reader, &t)

	for ; t > 0; t-- {
		var n int

		fmt.Fscan(reader, &n)

		var arr []int
		count := 0

		for i := 4*n - 2; i >= 4; i -= 2 {
			if count == 0 {
				arr = append(arr, i)
				count++
				continue
			}

			if check(i, arr) {
				arr = append(arr, i)
				count++
			}

			if count == n {
				break
			}
		}

		for i := range arr {
			fmt.Printf("%d ", arr[i])
		}

		fmt.Printf("\n")
	}

}

func check(n int, arr []int) bool {
	flag := true

	for i := range arr {
		if n%arr[i] == 0 {
			flag = false
			break
		}
	}

	return flag
}

package main

import (
	"fmt"
)

func main() {

	var t int

	fmt.Scanf("%d\n", &t)

	for {
		if t == 0 {
			break
		}
		var n int
		fmt.Scanf("%d\n", &n)
		var mark = make([]int, 4*n+1)

		for i := 4; i <= 4*n; i += 2 {
			if mark[i] != 0 {
				continue
			}

			fmt.Print(i, " ")
			for j := i; j <= 4*n; j += i {
				mark[j] = 1
			}
		}
		fmt.Println()
		t--
	}
}

package main

import (
	"fmt"
)

func main() {

	var t int

	fmt.Scanf("%d", &t)

	for {
		if t == 0 {
			break
		}
		var n int
		fmt.Scanf("%d", &n)
		var mark = make([]int, 4*n+1)

		for i := 4; i <= 4*n; i += 2 {
			if mark[i] != 0 {
				continue
			}

			fmt.Print(i, " ")
			for j := i; j <= 4*n; j += i {
				mark[j] = 1
			}
		}
		fmt.Println()
		t--
	}
}

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 N int
		scanf("%d\n", &N)

		res := make([]int, N)
		for i := N; i >= 1; i-- {
			res[i-1] = 2*(2*i-1)
		}

		for i := 0; i < N; i++ {
			if i != N-1 {
				printf("%d ", res[i])
			} else {
				printf("%d\n", res[i])
			}
		}

	}

}


// Author: sighduck
// URL: https://codeforces.com/contest/1208/problem/C

package main

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

func Solve(n int) [][]int {
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			d := n / 2
			mi, mj := i%d, j%d
			baseValue := d*(mi) + mj
			matrix[i][j] = baseValue
			quadrant := 2*(i/d) + j/d
			matrix[i][j] = 4*baseValue + quadrant
		}
	}
	return matrix
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

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

	matrix := Solve(n)
	for i := 0; i < n; i++ {
		for _, elem := range matrix[i] {
			fmt.Fprintf(writer, "%d ", elem)
		}
		fmt.Fprintf(writer, "\n")
	}
}

package main

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

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	a := make([][]int, n)
	for i := range a {
		a[i] = make([]int, n)
	}

	cnt := 0
	for i := 0; i < n; i+=2 {
		for j := 0; j < n; j += 2 {
			a[i][j] = cnt
			a[i][j + 1] = cnt + 1
			a[i + 1][j] = cnt + 2
			a[i + 1][j + 1] = cnt + 3
			cnt += 4
		}
	}

	m := make(map[int]bool)
	for i := 0; i < n; i++ {
		x := 0
		for j := 0; j < n; j++ {
			x ^= a[i][j]
		}
		m[x] = true
	}
	for j := 0; j < n; j++ {
		x := 0
		for i := 0; i < n; i++ {
			x ^= a[i][j]
		}
		m[x] = true
	}

	if len(m) != 1 {
		fmt.Println("OOPS")
		os.Exit(1)
	}

	f := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			f.WriteString(strconv.Itoa(a[i][j]))
			if j + 1 < n {
				f.WriteString(" ")
			}
		}
		f.WriteString("\n")
	}
	f.Flush()
}

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n int
	Scan(&n)
	ans := make([][]interface{}, n)
	for i := range ans {
		ans[i] = make([]interface{}, n)
	}
	n /= 2
	for i, c := 0, 0; i < n; i++ {
		for j := 0; j < n; j++ {
			ans[i][j] = 4 * c
			ans[i][j+n] = 4*c + 1
			ans[i+n][j] = 4*c + 2
			ans[i+n][j+n] = 4*c + 3
			c++
		}
	}
	for _, row := range ans {
		Fprintln(out, row...)
	}
}

// Author: sighduck
// URL: https://codeforces.com/contest/1208/problem/C

package main

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

func Solve(n int) [][]int {
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
	}
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			mi, mj := i%2, j%2
			baseValue := n/2*(mi) + mj
			quadrant := 2*(i/2) + j/2
			matrix[i][j] = 4*baseValue + quadrant
		}
	}
	return matrix
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

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

	matrix := Solve(n)
	for i := 0; i < n; i++ {
		for _, elem := range matrix[i] {
			fmt.Fprintf(writer, "%d ", elem)
		}
		fmt.Fprintf(writer, "\n")
	}
}


/*
URL:
https://codeforces.com/problemset/problem/1327/E
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	// MOD          = 1000000000 + 7
	MOD          = 998244353
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int64

	ans int64
	P   [200000 + 50]int64
)

func main() {
	n = ReadInt64()

	P[0] = 1
	for i := 1; i <= 200000+10; i++ {
		P[i] = P[i-1] * 10
		P[i] %= MOD
	}

	answers := []int64{}
	for i := int64(1); i < n; i++ {
		ans = 1
		if n-i-1 >= 0 {
			ans = 2 * 10 * 9 * P[n-i-1]
		}
		ans %= MOD

		if n-i-2 >= 0 {
			ans += (n - 1 - i) * 10 * 9 * 9 * P[n-i-2]
		}
		ans %= MOD

		answers = append(answers, ans)
	}
	answers = append(answers, 10)

	fmt.Println(PrintInts64Line(answers...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

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 n int
	Fscan(in, &n)
	// seg => ans
	const mod int64 = 998244353

	ans := make([]int64, n)
	ans[0] = 10
	sum :=int64(10)
	ten := int64(10)
	for i := 1; i < n; i++ {
		a := 9*(ten+sum)%mod
		sum+=a
		ans[i]=a
		ten=ten*10%mod
	}
	for i := len(ans) - 1; i >= 0; i-- {
		v := ans[i]
		Fprint(out, v," ")
	}

}

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

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

func GetPrimeList(n int) []int {
	var plist []int
	chk := make([]bool, n+1)
	for i := 2; i <= n; i++ { chk[i] = false }
	for i := 2; i <= n; i++ {
		if !chk[i] {
			plist = append(plist, i)
			for j := int64(i) * int64(i); j <= int64(n); j += int64(i) {
				chk[j] = true
			}
		}
	}
	return plist
}

type Factor struct {
	val int
	size int
}

func GetPrimeFactors(n int, primes *[]int) []Factor {
	var factors []Factor
	for i := 0; i < len(*primes) && int64((*primes)[i]) * int64((*primes)[i]) <= int64(n); i++ {
		if n % (*primes)[i] == 0 {
			size := 0
			for ; n % (*primes)[i] == 0; {
				n /= (*primes)[i]
				size++
			}
			factors = append(factors, Factor{(*primes)[i], size})
		}
	}
	if n != 1 {
		factors = append(factors, Factor{n, 1})
	}
	return factors
}

func GenDivisor(idx, val int, factors *[]Factor, divisor *[]int) {
	if idx == len(*factors) {
		*divisor = append(*divisor, val)
		return
	}

	for j := 0; j <= (*factors)[idx].size; j++ {
		GenDivisor(idx+1, val, factors, divisor)
		val *= (*factors)[idx].val
	}
}

func GetLeast(n int, primes *[]int, colors *[]int) int {
	ret := n
	factors := GetPrimeFactors(n, primes)
	var divisors []int
	GenDivisor(0, 1, &factors, &divisors)
	for _, div := range divisors {
		cs := make([]int, div)
		for i := range cs {
			cs[i] = 0
		}
		for i := 0; i < n; i++ {
			if cs[i%div] == 0 {
				cs[i%div] = (*colors)[i]
			} else if cs[i%div] != (*colors)[i] {
				cs[i%div] = -1
			}
		}
		for _, state := range cs {
			if state != -1 && ret > div {
				ret = div
			}
		}
	}
	return ret
}

func dfs(cur int, adj *[]int, vis *[]bool, colors, arr_col *[]int) int {
	if (*vis)[cur] {
		return 0
	}
	*arr_col = append(*arr_col, (*colors)[cur])
	(*vis)[cur] = true
	return dfs((*adj)[cur], adj, vis, colors, arr_col) + 1
}

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

	var n int64
	Fscan(in, &n)

	ans := make([]int64, n+1)
	ans[n] = 10

	var tf, MOD int64 = 1, 998244353
	for l := n-1; l > 0; l-- {
		a, b := int64(9*9), int64(180)
		ans[l] = tf * ((n-int64(l)-int64(1))*a + b) % MOD;
		tf = tf * 10 % MOD;
	}
	for i := int64(1); i<=n; i++ {
		Fprintf(out, "%d ", ans[i])
	}
}

/*
URL:
https://codeforces.com/problemset/problem/1327/E
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	// MOD          = 1000000000 + 7
	MOD          = 998244353
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int64

	ans int64
	P   [200000 + 50]int64
)

func main() {
	n = ReadInt64()

	P[0] = 1
	for i := 1; i <= 200000+10; i++ {
		P[i] = P[i-1] * 10
		P[i] %= MOD
	}

	answers := []int64{}
	for i := int64(1); i < n; i++ {
		ans = 1
		if n-i-1 >= 0 {
			ans = 2 * 10 * 9 * P[n-i-1]
		}
		ans %= MOD

		if n-i-2 >= 0 {
			ans += (n - 1 - i) * 10 * 9 * 9 * P[n-i-2]
		}

		answers = append(answers, ans)
	}
	answers = append(answers, 10)

	fmt.Println(PrintInts64Line(answers...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}


package main

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

func main() {

	var testCases, inputArrayLength int

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	fmt.Fscan(in, &testCases)

	for testCase := 0; testCase < testCases; testCase++ {

		fmt.Fscan(in, &inputArrayLength)

		inputArr := make([]int, inputArrayLength)

		output := -1

		for j := 0; j < inputArrayLength; j++ {
			var stickLength int
			fmt.Fscan(in, &stickLength)

			inputArr[j] = stickLength
		}

		if output == 0 {
			fmt.Fprintln(out, output)
			continue
		}
		output = solve(&inputArr)
		fmt.Fprintln(out, output)
	}
}

func solve(arr *[]int) int {

	sort.Ints(*arr)
	minSteps := math.MaxInt

	for i := 1; i < len(*arr)-1; i++ {
		minSteps = min(minSteps, ((*arr)[i]-(*arr)[i-1])+((*arr)[i+1]-(*arr)[i]))
	}
	return minSteps
}

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

package main

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

func main() {

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var testCases int
	fmt.Fscan(in, &testCases)
	for testCase := 0; testCase < testCases; testCase++ {
		var inputArrayLength int
		fmt.Fscan(in, &inputArrayLength)

		inputArr := make([]int, inputArrayLength)
		for i := 0; i < inputArrayLength; i++ {
			fmt.Fscan(in, &inputArr[i])
		}

		output := solve(&inputArr)
		fmt.Fprintln(out, output)
	}
}

func solve(arr *[]int) int {

	sort.Ints(*arr)
	minSteps := math.MaxInt

	for i := 1; i < len(*arr)-1; i++ {
		minSteps = min(minSteps, ((*arr)[i]-(*arr)[i-1])+((*arr)[i+1]-(*arr)[i]))
	}
	return minSteps
}

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

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func solve(n int, a []int) int {
	sort.Ints(a)
	o := 1000000000
	for i := 1; i < n-1; i++ {
		o = min(o, a[i+1]-a[i-1])
	}
	return o
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func ReverseSlice(s interface{}) {
	size := reflect.ValueOf(s).Len()
	swap := reflect.Swapper(s)
	for i, j := 0, size-1; i < j; i, j = i+1, j-1 {
		swap(i, j)
	}
}

func main() {
	var t int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		var ret int = 10e9
		for i := 0; i < n-2; i++ {
			tmp := a[i+2] - a[i]
			if tmp < ret {
				ret = tmp
			}
		}
		fmt.Println(ret)
	}
}

package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve()  {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	min := math.MaxInt

	for i := 0; i < n-2; i++ {
		temp := find(a[i], a[i+1], a[i+2])
		if temp < min {
			min = temp
		}
	}
	fmt.Println(min)
}

func find(a, b, c int) (res int) {
	res = c - a
	return
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
    "sort"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		a:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&a[j])
		}
		var c []int
		for j:=0;j<n;j++{
			var b []int
			for k:=0;k<n;k++{
				if j != k {
					b = append(b,abs(a[j]-a[k]))
				}
			}
			sort.Ints(b)
			c = append(c,b[0]+b[1])
		}
		sort.Ints(c)
		fmt.Fprintln(out,c[0])

	}
}
func abs(a int) int {
	if a < 0 {
		return a*-1
	}
	return a
}
// map[int]int
// mapper[j]++
// if mapper[j] >= 3
// if mapper[j] == 2, check mapper[j] next closest value |mapper[j]-mapper[j-1]| |mapper[j]-mapper[j+1]|
// choose lowest
//

package main

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

type CF1734A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1734A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1734A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1734A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1734A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1734A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1734A
Date: 9/26/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1734/A
Problem: CF1734A
**/
func (in *CF1734A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}
		sort.Ints(arr)
		min := 100000000000
		for i := 2; i < n; i++ {
			diff := int(math.Abs(float64(arr[i-2])-float64(arr[i-1]))) + int(math.Abs(float64(arr[i])-float64(arr[i-1])))
			if diff < min {
				min = diff
			}
		}
		fmt.Println(min)
	}
}

func NewCF1734A(r *bufio.Reader) *CF1734A {
	return &CF1734A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1734A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var t, n int

	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		fmt.Fscan(r, &n)
		a := make([]int, n)

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

		sort.Ints(a)

		var res int = 1e9
		for j := 1; j < n - 1; j++ {
			new_res := a[j + 1] - a[j - 1]
			if new_res < res {
				res = new_res
			}
		}
		fmt.Println(res)
	}
}

package main

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

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Fscan(in, &n)

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

		sort.Ints(aa)
		tot := math.MaxInt32
		for i := 2; i < n; i++ {
			tot = min(tot, (aa[i-1]-aa[i-2])+(aa[i]-aa[i-1]))
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(curCase int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)
		cnt := map[int]int{}
		for _, v := range a {
			cnt[v]++
			if cnt[v] >=3 {
				Fprintln(out, 0)
				return
			}
		}
		ans := int(2e9)
		for i := 1; i < n-1; i++ {
			ans = min(ans, a[i]-a[i-1] + a[i+1]-a[i])
		}
		Fprintln(out, ans)
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		solve(curCase)
	}

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

}

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

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

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func solve(n int, a []int) int {
	sort.Ints(a)
	o := 1000
	for i := 1; i < n-1; i++ {
		o = min(o, a[i+1]-a[i-1])
	}
	return o
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func ReverseSlice(s interface{}) {
	size := reflect.ValueOf(s).Len()
	swap := reflect.Swapper(s)
	for i, j := 0, size-1; i < j; i, j = i+1, j-1 {
		swap(i, j)
	}
}

func main() {
	var t int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		var ret int = 10e9
		for i := 0; i < n-2; i++ {
			tmp := (a[i] + a[i+1] + a[i+2]) / 3
			if tmp < ret {
				ret = tmp
			}
		}
		fmt.Println(ret)
	}
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"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 printfl(f string, a...interface{}) {
	printf(f, a...)
	writer.Flush()
}

func primes(N int) []int {
	k := make([]bool, N + 1)

	checkN := int(math.Sqrt(float64(N))) + 1
	numberPrimaryNumbers := 0
	for i := 2; i <= checkN && i <= N; i ++ {
		if k[i] == false {
			numberPrimaryNumbers += 1
			for j := 2*i; j <= N; j += i {
				k[j] = true
			}
		}
	}

	primaryNumbers := make([]int, 0, numberPrimaryNumbers)

	for i := 2; i <= N; i++ {
		if k[i] == false {
			primaryNumbers = append(primaryNumbers, i)
		}
	}
	return primaryNumbers
}

func main() {
	defer writer.Flush()
	var N, tmp, tmp1 int
	scanf("%d\n", &N)

	primaryNumbers := primes(N)

	var primaryFactors []int
	l := len(primaryNumbers)
	sqrtL := int(math.Sqrt(float64(l)))
	println(sqrtL)
	shouldBeDeleted := 0
	lastL := l
	for i := 0; i < l; i += sqrtL {
		shouldBeDeleted = 0
		for j := i; j < l && j < i + sqrtL; j ++ {
			printfl("B %d\n", primaryNumbers[j])
			scanf("%d\n", &tmp)
			shouldBeDeleted += tmp
		}
		printfl("A 1\n")
		scanf("%d\n", &tmp1)

		if tmp1 != lastL - shouldBeDeleted {
			for j := i; j < l && j < i + sqrtL; j ++ {
				printfl("A %d\n", primaryNumbers[j])
				scanf("%d\n", &tmp)
				if tmp == 1 {
					primaryFactors = append(primaryFactors, primaryNumbers[j])
				}
			}
		}
		lastL = tmp1
	}

    // need to find degrees
    result := 1
    for i := 0; i < len(primaryFactors); i ++ {
    	result *= primaryFactors[i]
	}

	for i := 0; i < len(primaryFactors); {
		if N / result >= primaryFactors[i] {
			printfl("A %d\n", result*primaryFactors[i])
			scanf("%d\n", &tmp)
			if tmp == 1 {
				result *= primaryFactors[i]
			} else {
				i ++
			}
		} else {
			i ++
		}

	}

	printfl("C %d\n", result)
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	comp := make([]bool, n+1)
	var pr []int
	for i := 2; i <= n; i++ {
		if !comp[i] {
			pr = append(pr, i)
			if i <= n/i {
				for j := i * i; j <= n; j += i {
					comp[j] = true
				}
			}
		}
	}

	set := make(map[int]bool)
	for i := 1; i <= n; i++ {
		set[i] = true
	}

	ask := func(s string, x int) int {
		fmt.Println(s, x)
		var res int
		fmt.Scan(&res)
		return res
	}

	ans := 1

	calcPow := func(p int) {
		ans *= p
		if p <= n/p {
			for q := p * p; q <= n; q *= p {
				if ask("A", q) == 1 {
					ans *= p
				}
			}
		}
	}

	rt := int(math.Sqrt(float64(len(pr))))
	gotFirst := false
	for i, p := range pr {
		cnt := len(set)
		for q := p; q <= n; q += p {
			delete(set, q)
		}
		cnt -= len(set)
		res := ask("B", p)
		if res != cnt {
			calcPow(p)
		}
		if !gotFirst && (i%rt == rt-1 || i == len(pr)-1) && ask("A", 1) != len(set) {
			gotFirst = true
			for j := i - rt + 1; j <= i; j++ {
				if ask("A", pr[j]) == 1 {
					calcPow(pr[j])
					break
				}
			}
		}
	}

	fmt.Println("C", ans)
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println("B", p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println("A", 1)
		rw.Flush()
		now := rw.NextInt()
		if has < now {
			has = now
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println("A", p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 {
					ans *= p[j]
					if int64(x)*int64(p[j]) > int64(n) {
						break
					}
					x *= p[j]
					rw.Println("A", x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println("C", ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"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 printfl(f string, a...interface{}) {
	printf(f, a...)
	writer.Flush()
}

func primes(N int) []int {
	k := make([]bool, N + 1)

	checkN := int(math.Sqrt(float64(N))) + 1
	numberPrimaryNumbers := 0
	for i := 2; i <= checkN && i <= N; i ++ {
		if k[i] == false {
			numberPrimaryNumbers += 1
			for j := 2*i; j <= N; j += i {
				k[j] = true
			}
		}
	}

	primaryNumbers := make([]int, 0, numberPrimaryNumbers)

	for i := 2; i <= N; i++ {
		if k[i] == false {
			primaryNumbers = append(primaryNumbers, i)
		}
	}
	return primaryNumbers
}

func main() {
	defer writer.Flush()
	var N, tmp, tmp1 int
	scanf("%d\n", &N)

	primaryNumbers := primes(N)

	var primaryFactors []int
	l := len(primaryNumbers)
	sqrtL := int(math.Sqrt(float64(l)))
	println(sqrtL)
	shouldBeDeleted := 0
	lastL := l
	for i := 0; i < l; i += sqrtL {
		shouldBeDeleted = 0
		for j := i; j < l && j < i + sqrtL; j ++ {
			printfl("B %d\n", primaryNumbers[j])
			scanf("%d\n", &tmp)
			shouldBeDeleted += tmp
		}
		printfl("A 1\n")
		scanf("%d\n", &tmp1)

		if tmp1 != lastL - shouldBeDeleted {
			for j := i; j < l && j < i + sqrtL; j ++ {
				printfl("A %d\n", primaryNumbers[j])
				scanf("%d\n", &tmp)
				if tmp == 1 {
					primaryFactors = append(primaryFactors, primaryNumbers[j])
				}
			}
		}
		lastL = tmp1
	}

    // need to find degrees
    result := 1
    for i := 0; i < len(primaryFactors); i ++ {
    	result *= primaryFactors[i]
	}

	for i := 0; i < len(primaryNumbers); {
		if N / result >= primaryNumbers[i] {
			printfl("A %d\n", result*primaryNumbers[i])
			scanf("%d\n", &tmp)
			if tmp == 1 {
				result *= primaryNumbers[i]
			} else {
				i ++
			}
		} else {
			i ++
		}

	}

	printfl("C %d\n", result)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"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 printfl(f string, a...interface{}) {
	printf(f, a...)
	writer.Flush()
}

func primes(N int) []int {
	k := make([]bool, N + 1)

	checkN := int(math.Sqrt(float64(N))) + 1
	numberPrimaryNumbers := 0
	for i := 2; i <= checkN && i <= N; i ++ {
		if k[i] == false {
			numberPrimaryNumbers += 1
			for j := 2*i; j <= N; j += i {
				k[j] = true
			}
		}
	}

	primaryNumbers := make([]int, 0, numberPrimaryNumbers)

	for i := 2; i <= N; i++ {
		if k[i] == false {
			primaryNumbers = append(primaryNumbers, i)
		}
	}
	return primaryNumbers
}

func main() {
	defer writer.Flush()
	var N, tmp, tmp1 int
	scanf("%d\n", &N)

	primaryNumbers := primes(N)

	var primaryFactors []int
	l := len(primaryNumbers)
	sqrtL := int(math.Sqrt(float64(l)))
	println(sqrtL)
	shouldBeDeleted := 0
	lastL := l
	for i := 0; i < l; i += sqrtL {
		shouldBeDeleted = 0
		for j := i; j < l && j < i + sqrtL; j ++ {
			printfl("B %d\n", primaryNumbers[j])
			scanf("%d\n", &tmp)
			shouldBeDeleted += tmp
		}
		printfl("A 1\n")
		scanf("%d\n", &tmp1)

		if tmp1 != lastL - shouldBeDeleted {
			for j := i; j < l && j < i + sqrtL; j ++ {
				printfl("A %d\n", primaryNumbers[j])
				scanf("%d\n", &tmp)
				if tmp == 1 {
					primaryFactors = append(primaryFactors, primaryNumbers[j])
				}
			}
		}
		lastL = tmp1
	}

    // need to find degrees
    result := 1
    for i := 0; i < len(primaryFactors); i ++ {
    	result *= primaryFactors[i]
	}

	for i := 0; i < len(primaryNumbers); {
		if result * primaryNumbers[i] < N {
			printfl("A %d\n", result*primaryNumbers[i])
			scanf("%d\n", &tmp)
			if tmp == 1 {
				result *= primaryNumbers[i]
			} else {
				i ++
			}
		} else {
			i ++
		}

	}

	printfl("C %d\n", result)
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println("B", p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println("A", 1)
		rw.Flush()
		cnt := rw.NextInt()
		if has < cnt {
			has = cnt
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println("A", p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 && int64(x*p[j]) <= int64(n) {
					x *= p[j]
					ans *= p[j]
					rw.Println("A", x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println("C", ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println('B', p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println('A', 1)
		rw.Flush()
		cnt := rw.NextInt()
		if has < cnt {
			has = cnt
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println('B', p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 && int64(x*p[j]) <= int64(n) {
					x *= p[j]
					ans *= p[j]
					rw.Println('B', x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println('C', ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println("B", p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println("A", 1)
		rw.Flush()
		cnt := rw.NextInt()
		if has < cnt {
			has = cnt
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println("A", p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 {
					x *= p[j]
					ans *= p[j]
					if int64(x*p[j]) > int64(n) {
						break
					}
					rw.Println("A", x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println("C", ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println("B", p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println("A", 1)
		rw.Flush()
		cnt := rw.NextInt()
		if has < cnt {
			has = cnt
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println("A", p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 {
					ans *= p[j]
					if int64(x*p[j]) > int64(n) {
						break
					}
					x *= p[j]
					rw.Println("A", x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println("C", ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func primes(n int) []int {
	sv := make([]int, n+1)
	var p []int
	for i := 2; i <= n; i++ {
		if sv[i] == 0 {
			for j := i + i; j <= n; j += i {
				sv[j] = 1
			}
			p = append(p, i)
		}
	}
	return p
}

const kB = 70

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	p := primes(n)
	has := n
	ans := 1
	for i := 0; i < len(p); i += kB {
		for j := i; j < len(p) && j < i+kB; j++ {
			rw.Println("B", p[j])
			rw.Flush()
			cnt := rw.NextInt()
			has -= cnt
		}
		rw.Println("A", 1)
		rw.Flush()
		cnt := rw.NextInt()
		if has < cnt {
			has = cnt
			for j := i; j < len(p) && j < i+kB; j++ {
				rw.Println("A", p[j])
				rw.Flush()
				cnt := rw.NextInt()
				x := p[j]
				for cnt > 0 && int64(x*p[j]) <= int64(n) {
					x *= p[j]
					ans *= p[j]
					rw.Println("A", x)
					rw.Flush()
					cnt = rw.NextInt()
				}
			}
		}
	}
	rw.Println('C', ans)
	rw.Flush()
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}