package main

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

func main() {
	var n int

	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')
	fmt.Sscanf(line, "%d", &n)

	if n <= 2 {
		fmt.Println(n)
		return
	}

	line, _ = reader.ReadString('\n')
	tokens := strings.Fields(line)
	numbers := make([]int, n)
	for i := 0; i < n; i++ {
		numbers[i], _ = strconv.Atoi(tokens[i])
	}

	l := make([]int, n)
	l[0] = 1
	for i := 1; i < n; i++ {
		if numbers[i-1] < numbers[i] {
			l[i] = l[i-1] + 1
		} else {
			l[i] = 1
		}
	}

	r := make([]int, n)
	r[n-1] = 1
	for i := n - 2; i >= 0; i-- {
		if numbers[i] < numbers[i+1] {
			r[i] = r[i+1] + 1
		} else {
			r[i] = 1
		}
	}

	bestLength := 2
	for i := 0; i < n; i++ {
		if i == 0 {
			if r[i+1]+1 >= bestLength {
				bestLength = r[i+1] + 1
			}
		} else if i == n-1 {
			if l[i-1]+1 >= bestLength {
				bestLength = l[i-1] + 1
			}
		} else {
			if numbers[i-1]+1 < numbers[i+1] {
				if l[i-1]+r[i+1]+1 > bestLength {
					bestLength = l[i-1] + r[i+1] + 1
				}
			} else if l[i-1] < l[i] && l[i] > l[i+1] {
				if l[i-1]+2 > bestLength {
					bestLength = l[i-1] + 2
				}
			} else if r[i+1] < r[i] && r[i] > r[i-1] {
				if r[i+1]+2 > bestLength {
					bestLength = r[i+1] + 2
				}
			}
		}
	}
	fmt.Println(bestLength)
}

// 446A
package main

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

var (
	x1, x2, x3 [1000000]int64
	n, i, o    int64
)

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

func main() {
	in := bufio.NewReader(os.Stdin)
	o = 0
	fmt.Scan(&n)
	for i = 0; i < n; i++ {
		fmt.Fscan(in, &x1[i])
	}
	for i = 1; i < n; i++ {
		if x1[i] > x1[i-1] {
			x2[i] = x2[i-1] + 1
			o = max(o, x2[i])
		} else {
			x2[i] = 0
		}

	}
	for i = n - 2; ^i != 0; i-- {
		if x1[i] < x1[i+1] {
			x3[i] = x3[i+1] + 1
			o = max(o, x3[i])
		} else {
			x3[i] = 0
		}

	}
	for i = n - 1; i != 0; i-- {
		if x1[i-1]+1 < x1[i+1] {
			o = max(o, x2[i-1]+x3[i+1]+1)
		}

	}
	fmt.Println(min(n, o+2))
}

package main

import (
	"bufio"
	"bytes"
	"errors"
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"runtime/pprof"
	"strconv"
	"time"
	"unicode/utf8"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	array := make([]int, n)
	for i := 0; i < n; i++ {
		array[i] = readInt()
	}
	dpL := make([]int, n)
	dpL[0] = 1;
	for i := 1; i < n; i++ {
		if array[i - 1] < array[i] {
			dpL[i] = dpL[i - 1] + 1;
		} else {
			dpL[i] = 1;
		}
	}
	dpR := make([]int, n)
	dpR[n - 1] = 1;
	for i := n - 2; i >= 0; i-- {
		if array[i + 1] > array[i] {
			dpR[i] = dpR[i + 1] + 1;
		} else {
			dpR[i] = 1;
		}
	}

	res := 0
	for i := 0; i < n; i++ {
		res = maxInt(res, dpL[i])
		if i > 0 {
			res = maxInt(res, 1 + dpL[i - 1])
		}
		if i < n - 1 {
			res = maxInt(res, 1 + dpR[i + 1])
		}
		if i > 0 && i < n - 1 && array[i - 1] + 1 < array[i + 1] {
			res = maxInt(res, 1 + dpL[i - 1] + dpR[i + 1])
		}
	}
//	logln(dpL)
//	logln(dpR)
	printInt(res)
	printLine()

}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *Scanner
	writer  *bufio.Writer
	logger  *log.Logger
)

func main() {
	dbg := flag.Bool("dbg", false, "Equals true, if run is in debug mode.")
	opt := flag.Bool("opt", false, "Equals true, if run is in optimized mode.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *opt || *dbg {
		startTime := time.Now()
		defer func() {
			println(fmt.Sprintf("Time: %.5fs", time.Since(startTime).Seconds()))
		}()
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		logger = log.New(output, "log: ", 0)
		if *dbg {
			cpuprofile, _ := os.Create("/home/outside/coding/workspace/go/io/cpuprofile.txt")
			pprof.StartCPUProfile(cpuprofile)
			defer cpuprofile.Close()
			defer pprof.StopCPUProfile()
		}
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = NewScanner(input)
	scanner.Split(bufio.ScanWords)

	writer = bufio.NewWriter(output)
	defer writer.Flush()

	solve()
}

// Read.

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

func readLine() string {
	scanner.Split(bufio.ScanLines)
	defer scanner.Split(bufio.ScanWords)
	return readString()
}

func readInt() int {
	ans, _ := strconv.ParseInt(readString(), 10, 0)
	return int(ans)
}

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

func readFloat64() float64 {
	ans, _ := strconv.ParseFloat(readString(), 64)
	return ans
}

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printLine() {
	printString("\n")
}

func printInt(value int) {
	printString(strconv.FormatInt(int64(value), 10))
}

func printInt64(value int64) {
	printString(strconv.FormatInt(value, 10))
}

func printFLoat64(value float64) {
	printString(strconv.FormatFloat(value, 'f', 20, 64))
}

// Log.

func logln(value ...interface{}) {
	writer.Flush()
	logger.Println(value...)
}
func logf(format string, value ...interface{}) {
	writer.Flush()
	logger.Printf(format, value...)
}

// Tuple

type Tuple struct {
	a, b int
}

func (p Tuple) Equals(key Key) bool {
	return p.a == key.(Tuple).a
}

func (p Tuple) Less(key Key) bool {
	return p.a < key.(Tuple).a
}

type TupleSlice []Tuple

func (p TupleSlice) Len() int {
	return len(p)
}

func (p TupleSlice) Less(j, i int) bool {
	return p[j].a < p[i].a
}

func (p TupleSlice) Swap(j, i int) {
	p[j], p[i] = p[i], p[j]
}

// Min, max, abs.

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

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

func absInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func absInt64(a int64) int64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func absFloat64(a float64) float64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

// Set Key interface implementations.

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

// Copied scan.go
// Scanner provides a convenient interface for reading data such as
// a file of newline-delimited lines of text. Successive calls to
// the Scan method will step through the 'tokens' of a file, skipping
// the bytes between the tokens. The specification of a token is
// defined by a split function of type SplitFunc; the default split
// function breaks the input into lines with line termination stripped. Split
// functions are defined in this package for scanning a file into
// lines, bytes, UTF-8-encoded runes, and space-delimited words. The
// client may instead provide a custom split function.
//
// Scanning stops unrecoverably at EOF, the first I/O error, or a token too
// large to fit in the buffer. When a scan stops, the reader may have
// advanced arbitrarily far past the last token. Programs that need more
// control over error handling or large tokens, or must run sequential scans
// on a reader, should use bufio.Reader instead.
//
type Scanner struct {
	r            io.Reader // The reader provided by the client.
	split        SplitFunc // The function to split the tokens.
	maxTokenSize int       // Maximum size of a token; modified by tests.
	token        []byte    // Last token returned by split.
	buf          []byte    // Buffer used as argument to split.
	start        int       // First non-processed byte in buf.
	end          int       // End of data in buf.
	err          error     // Sticky error.
}

// SplitFunc is the signature of the split function used to tokenize the
// input. The arguments are an initial substring of the remaining unprocessed
// data and a flag, atEOF, that reports whether the Reader has no more data
// to give. The return values are the number of bytes to advance the input
// and the next token to return to the user, plus an error, if any. If the
// data does not yet hold a complete token, for instance if it has no newline
// while scanning lines, SplitFunc can return (0, nil, nil) to signal the
// Scanner to read more data into the slice and try again with a longer slice
// starting at the same point in the input.
//
// If the returned error is non-nil, scanning stops and the error
// is returned to the client.
//
// The function is never called with an empty data slice unless atEOF
// is true. If atEOF is true, however, data may be non-empty and,
// as always, holds unprocessed text.
type SplitFunc func(data []byte, atEOF bool) (advance int, token []byte, err error)

// Errors returned by Scanner.
var (
	ErrTooLong         = errors.New("bufio.Scanner: token too long")
	ErrNegativeAdvance = errors.New("bufio.Scanner: SplitFunc returns negative advance count")
	ErrAdvanceTooFar   = errors.New("bufio.Scanner: SplitFunc returns advance count beyond input")
)

const (
	// Maximum size used to buffer a token. The actual maximum token size
	// may be smaller as the buffer may need to include, for instance, a newline.
	MaxScanTokenSize = 1 << 20
)

// NewScanner returns a new Scanner to read from r.
// The split function defaults to ScanLines.
func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        ScanLines,
		maxTokenSize: MaxScanTokenSize,
		buf:          make([]byte, 4096), // Plausible starting size; needn't be large.
	}
}

// Err returns the first non-EOF error that was encountered by the Scanner.
func (s *Scanner) Err() error {
	if s.err == io.EOF {
		return nil
	}
	return s.err
}

// Bytes returns the most recent token generated by a call to Scan.
// The underlying array may point to data that will be overwritten
// by a subsequent call to Scan. It does no allocation.
func (s *Scanner) Bytes() []byte {
	return s.token
}

// Text returns the most recent token generated by a call to Scan
// as a newly allocated string holding its bytes.
func (s *Scanner) Text() string {
	return string(s.token)
}

// Scan advances the Scanner to the next token, which will then be
// available through the Bytes or Text method. It returns false when the
// scan stops, either by reaching the end of the input or an error.
// After Scan returns false, the Err method will return any error that
// occurred during scanning, except that if it was io.EOF, Err
// will return nil.
func (s *Scanner) Scan() bool {
	// Loop until we have a token.
	for {
		// See if we can get a token with what we already have.
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], s.err != nil)
			if err != nil {
				s.setErr(err)
				return false
			}
			if !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		// We cannot generate a token with what we are holding.
		// If we've already hit EOF or an I/O error, we are done.
		if s.err != nil {
			// Shut it down.
			s.start = 0
			s.end = 0
			return false
		}
		// Must read more data.
		// First, shift data to beginning of buffer if there's lots of empty space
		// or space is neded.
		if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
			copy(s.buf, s.buf[s.start:s.end])
			s.end -= s.start
			s.start = 0
		}
		// Is the buffer full? If so, resize.
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				s.setErr(ErrTooLong)
				return false
			}
			newSize := len(s.buf) * 2
			if newSize > s.maxTokenSize {
				newSize = s.maxTokenSize
			}
			newBuf := make([]byte, newSize)
			copy(newBuf, s.buf[s.start:s.end])
			s.buf = newBuf
			s.end -= s.start
			s.start = 0
			continue
		}
		// Finally we can read some input. Make sure we don't get stuck with
		// a misbehaving Reader. Officially we don't need to do this, but let's
		// be extra careful: Scanner is for safe, simple jobs.
		for loop := 0; ; {
			n, err := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if err != nil {
				s.setErr(err)
				break
			}
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				s.setErr(io.ErrNoProgress)
				break
			}
		}
	}
}

// advance consumes n bytes of the buffer. It reports whether the advance was legal.
func (s *Scanner) advance(n int) bool {
	if n < 0 {
		s.setErr(ErrNegativeAdvance)
		return false
	}
	if n > s.end-s.start {
		s.setErr(ErrAdvanceTooFar)
		return false
	}
	s.start += n
	return true
}

// setErr records the first error encountered.
func (s *Scanner) setErr(err error) {
	if s.err == nil || s.err == io.EOF {
		s.err = err
	}
}

// Split sets the split function for the Scanner. If called, it must be
// called before Scan. The default split function is ScanLines.
func (s *Scanner) Split(split SplitFunc) {
	s.split = split
}

// Split functions

// ScanBytes is a split function for a Scanner that returns each byte as a token.
func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	return 1, data[0:1], nil
}

var errorRune = []byte(string(utf8.RuneError))

// ScanRunes is a split function for a Scanner that returns each
// UTF-8-encoded rune as a token. The sequence of runes returned is
// equivalent to that from a range loop over the input as a string, which
// means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd".
// Because of the Scan interface, this makes it impossible for the client to
// distinguish correctly encoded replacement runes from encoding errors.
func ScanRunes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}

	// Fast path 1: ASCII.
	if data[0] < utf8.RuneSelf {
		return 1, data[0:1], nil
	}

	// Fast path 2: Correct UTF-8 decode without error.
	_, width := utf8.DecodeRune(data)
	if width > 1 {
		// It's a valid encoding. Width cannot be one for a correctly encoded
		// non-ASCII rune.
		return width, data[0:width], nil
	}

	// We know it's an error: we have width==1 and implicitly r==utf8.RuneError.
	// Is the error because there wasn't a full rune to be decoded?
	// FullRune distinguishes correctly between erroneous and incomplete encodings.
	if !atEOF && !utf8.FullRune(data) {
		// Incomplete; get more bytes.
		return 0, nil, nil
	}

	// We have a real UTF-8 encoding error. Return a properly encoded error rune
	// but advance only one byte. This matches the behavior of a range loop over
	// an incorrectly encoded string.
	return 1, errorRune, nil
}

// dropCR drops a terminal \r from the data.
func dropCR(data []byte) []byte {
	if len(data) > 0 && data[len(data)-1] == '\r' {
		return data[0 : len(data)-1]
	}
	return data
}

// ScanLines is a split function for a Scanner that returns each line of
// text, stripped of any trailing end-of-line marker. The returned line may
// be empty. The end-of-line marker is one optional carriage return followed
// by one mandatory newline. In regular expression notation, it is `\r?\n`.
// The last non-empty line of input will be returned even if it has no
// newline.
func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	if i := bytes.IndexByte(data, '\n'); i >= 0 {
		// We have a full newline-terminated line.
		return i + 1, dropCR(data[0:i]), nil
	}
	// If we're at EOF, we have a final, non-terminated line. Return it.
	if atEOF {
		return len(data), dropCR(data), nil
	}
	// Request more data.
	return 0, nil, nil
}

// isSpace reports whether the character is a Unicode white space character.
// We avoid dependency on the unicode package, but check validity of the implementation
// in the tests.
func isSpace(r rune) bool {
	if r <= '\u00FF' {
		// Obvious ASCII ones: \t through \r plus space. Plus two Latin-1 oddballs.
		switch r {
		case ' ', '\t', '\n', '\v', '\f', '\r':
			return true
		case '\u0085', '\u00A0':
			return true
		}
		return false
	}
	// High-valued ones.
	if '\u2000' <= r && r <= '\u200a' {
		return true
	}
	switch r {
	case '\u1680', '\u180e', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000':
		return true
	}
	return false
}

// ScanWords is a split function for a Scanner that returns each
// space-separated word of text, with surrounding spaces deleted. It will
// never return an empty string. The definition of space is set by
// unicode.IsSpace.
func ScanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	// Skip leading spaces.
	start := 0
	for width := 0; start < len(data); start += width {
		var r rune
		r, width = utf8.DecodeRune(data[start:])
		if !isSpace(r) {
			break
		}
	}
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	// Scan until space, marking end of word.
	for width, i := 0, start; i < len(data); i += width {
		var r rune
		r, width = utf8.DecodeRune(data[i:])
		if isSpace(r) {
			return i + width, data[start:i], nil
		}
	}
	// If we're at EOF, we have a final, non-empty, non-terminated word. Return it.
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	// Request more data.
	return 0, nil, nil
}

package main

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

func main() {
	var n int
	var a, b, c [10000000]int
	r := bufio.NewReader(os.Stdin)
	maxx := 1
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Fscan(r, &a[i])
	}
	b[1] = 1
	for i := 2; i <= n; i++ {
		if a[i] > a[i-1] {
			b[i] = b[i-1] + 1
		} else {
			b[i] = 1
		}
		if maxx < b[i] {
			maxx = b[i]
		}
	}
	if maxx < n {
		maxx++
	}
	c[n] = 1
	for i := n - 1; i > 0; i-- {
		if a[i+1] > a[i] {
			c[i] = c[i+1] + 1
		} else {
			c[i] = 1
		}
	}
	for i := 2; i <= n; i++ {
		if b[i] == 1 && (a[i-1]+1 < a[i+1] || a[i-2]+1 < a[i]) && b[i-1]+c[i] > maxx {
			maxx = b[i-1] + c[i]
		} else {
			if b[i] == 1 && maxx < b[i-1]+1 {
				maxx = b[i-1] + 1
			}
		}
	}
	if n < 3 {
		fmt.Println(n)
	} else {
		if maxx == 1 {
			fmt.Println("2")
		} else {
			fmt.Println(maxx)
		}
	}
}

//446A
package main
import (
	"fmt"
	"os"
	"bufio"
	"strconv"
)

func main() {
	var nn, maks int
	var aa[100005]int
	var x[100005]int
	var y[100005]int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	r.Scan()
	nn, _ = strconv.Atoi(r.Text())
	for i:=0; i<nn; i++ {
		r.Scan()
		aa[i], _ = strconv.Atoi(r.Text())
	}
	x[0]=1
	for i:=1; i<nn; i++ {
		if aa[i]>aa[i-1] {
			x[i]=x[i-1]+1
		} else {
			x[i]=1
		}
		if x[i]>maks {
			maks=x[i]
		}
	}
	if maks<nn {
		maks+=1
	}
	y[nn-1]=1
	for i:=nn-2; i>0; i-- {
		if aa[i]<aa[i+1] {
			y[i]=y[i+1]+1
		} else {
			y[i]=1
		}
		if (aa[i+1]-aa[i-1])>1 {
			if x[i-1]+(y[i+1]+1)>maks {
				maks=x[i-1]+(y[i+1]+1)
			}
		}
	}
	fmt.Println(maks)
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		if n <= 2 {
			fmt.Println(n)
			return
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		bestLength := 1
		for i := 1; i < n-1; i++ {
			if numbers[i-1]+1 < numbers[i+1] || (numbers[i-1] < numbers[i] && numbers[i] > numbers[i+1]) {
				if l[i-1]+r[i+1]+1 >= bestLength {
					bestLength = l[i-1] + r[i+1] + 1
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

		if n <= 2 {
			fmt.Println(n)
			return
		}
	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}
		if n == 10000 {
			fmt.Println("Y u no print", len(tokens))
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		bestLength := 2
		for i := 0; i < n; i++ {
			if i == 0 {
				if r[i+1]+1 >= bestLength {
					bestLength = r[i+1] + 1
				}
			} else if i == n-1 {
				if l[i-1]+1 >= bestLength {
					bestLength = l[i-1] + 1
				}
			} else {
				if numbers[i-1]+1 < numbers[i+1] {
					if l[i-1]+r[i+1]+1 > bestLength {
						bestLength = l[i-1] + r[i+1] + 1
					}
				} else if l[i-1] < l[i] && l[i] > l[i+1] {
					if l[i-1]+2 > bestLength {
						bestLength = l[i-1] + 2
					}
				} else if r[i+1] < r[i] && r[i] > r[i-1] {
					if r[i+1]+2 > bestLength {
						bestLength = r[i+1] + 2
					}
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		if n <= 2 {
			fmt.Println(n)
			return
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		bestLength := 1
		for i := 0; i < n; i++ {
			if i == 0 {
				if r[i+1]+1 >= bestLength {
					bestLength = r[i+1] + 1
				}
			} else if i == n-1 {
				if l[i-1]+1 >= bestLength {
					bestLength = l[i-1] + 1
				}
			} else {

				if numbers[i-1]+1 < numbers[i+1] {
					if l[i-1]+r[i+1]+1 > bestLength {
						bestLength = l[i-1] + r[i+1] + 1
					}

				} else if l[i-1] < l[i] && l[i] > l[i+1] {
					if l[i-1]+2 > bestLength {
						bestLength = l[i-1] + 2
					}
				} else if r[i+1] < r[i] && r[i] > r[i-1] {
					if r[i+1]+2 > bestLength {
						bestLength = r[i+1] + 2
					}
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

		if n <= 2 {
			fmt.Println(n)
			return
		}
	} else {
		fmt.Println(scanner.Err())
	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		bestLength := 2
		for i := 0; i < n; i++ {
			if i == 0 {
				if r[i+1]+1 >= bestLength {
					bestLength = r[i+1] + 1
				}
			} else if i == n-1 {
				if l[i-1]+1 >= bestLength {
					bestLength = l[i-1] + 1
				}
			} else {
				if numbers[i-1]+1 < numbers[i+1] {
					if l[i-1]+r[i+1]+1 > bestLength {
						bestLength = l[i-1] + r[i+1] + 1
					}
				} else if l[i-1] < l[i] && l[i] > l[i+1] {
					if l[i-1]+2 > bestLength {
						bestLength = l[i-1] + 2
					}
				} else if r[i+1] < r[i] && r[i] > r[i-1] {
					if r[i+1]+2 > bestLength {
						bestLength = r[i+1] + 2
					}
				}
			}
		}
		fmt.Println(bestLength)
	} else {
		fmt.Println(scanner.Err())
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		if n <= 2 {
			fmt.Println(n)
			return
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		// fmt.Println(l, r)
		bestLength := 1
		for i := 0; i < n; i++ {
			if i == 0 {
				if r[i+1]+1 >= bestLength {
					bestLength = r[i+1] + 1
				}
			} else if i == n-1 {
				if l[i-1]+1 >= bestLength {
					bestLength = l[i-1] + 1
				}
			} else {
				if numbers[i-1]+1 < numbers[i+1] || (l[i-1] < l[i] && r[i+1] == 1) || (r[i+1] < r[i] && l[i-1] == 1) {
					if l[i-1]+r[i+1]+1 >= bestLength {
						// fmt.Println(i)
						bestLength = l[i-1] + r[i+1] + 1
					}
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		if n == 1 {
			fmt.Println(numbers[0])
			return
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 1; i >= 1; i-- {
			if numbers[i-1] < numbers[i] {
				r[i-1] = r[i] + 1
			} else {
				r[i-1] = 1
			}
		}

		bestLength := 1
		for i := 1; i < n-1; i++ {
			if numbers[i-1] < numbers[i+1] {
				if l[i-1]+r[i+1]+1 > bestLength {
					bestLength = l[i-1] + r[i+1] + 1
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var n int
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)

	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		numbers := make([]int, n)
		for i := 0; i < n; i++ {
			numbers[i], _ = strconv.Atoi(tokens[i])
		}

		if n <= 2 {
			fmt.Println(n)
			return
		}

		l := make([]int, n)
		l[0] = 1
		for i := 1; i < n; i++ {
			if numbers[i-1] < numbers[i] {
				l[i] = l[i-1] + 1
			} else {
				l[i] = 1
			}
		}

		r := make([]int, n)
		r[n-1] = 1
		for i := n - 2; i >= 0; i-- {
			if numbers[i] < numbers[i+1] {
				r[i] = r[i+1] + 1
			} else {
				r[i] = 1
			}
		}

		fmt.Println(l, r)
		bestLength := 1
		for i := 0; i < n; i++ {
			if i == 0 {
				if r[i+1]+1 >= bestLength {
					bestLength = r[i+1] + 1
				}
			} else if i == n-1 {
				if l[i-1]+1 >= bestLength {
					bestLength = l[i-1] + 1
				}
			} else {
				if numbers[i-1]+1 < numbers[i+1] || (l[i-1] < l[i] && r[i+1] == 1) || (r[i+1] < r[i] && l[i-1] == 1) {
					if l[i-1]+r[i+1]+1 >= bestLength {
						fmt.Println(i)
						bestLength = l[i-1] + r[i+1] + 1
					}
				}
			}
		}
		fmt.Println(bestLength)
	}
}

package main

import (
	"bufio"
	"bytes"
	"errors"
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"runtime/pprof"
	"strconv"
	"time"
	"unicode/utf8"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	array := make([]int, n)
	for i := 0; i < n; i++ {
		array[i] = readInt()
	}
	dpL := make([]int, n)
	dpL[0] = 1;
	for i := 1; i < n; i++ {
		if array[i - 1] < array[i] {
			dpL[i] = dpL[i - 1] + 1;
		} else {
			dpL[i] = 1;
		}
	}
	dpR := make([]int, n)
	dpR[n - 1] = 1;
	for i := n - 2; i >= 0; i-- {
		if array[i + 1] > array[i] {
			dpR[i] = dpR[i + 1] + 1;
		} else {
			dpR[i] = 1;
		}
	}

	res := 0
	for i := 0; i < n; i++ {
		if i > 0 {
			res = maxInt(res, 1 + dpL[i - 1])
		}
		if i < n - 1 {
			res = maxInt(res, 1 + dpR[i + 1])
		}
		if i > 0 && i < n - 1 && array[i - 1] + 1 < array[i + 1] {
			res = maxInt(res, 1 + dpL[i - 1] + dpR[i + 1])
		}
	}
//	logln(dpL)
//	logln(dpR)
	printInt(res)
	printLine()

}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *Scanner
	writer  *bufio.Writer
	logger  *log.Logger
)

func main() {
	dbg := flag.Bool("dbg", false, "Equals true, if run is in debug mode.")
	opt := flag.Bool("opt", false, "Equals true, if run is in optimized mode.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *opt || *dbg {
		startTime := time.Now()
		defer func() {
			println(fmt.Sprintf("Time: %.5fs", time.Since(startTime).Seconds()))
		}()
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		logger = log.New(output, "log: ", 0)
		if *dbg {
			cpuprofile, _ := os.Create("/home/outside/coding/workspace/go/io/cpuprofile.txt")
			pprof.StartCPUProfile(cpuprofile)
			defer cpuprofile.Close()
			defer pprof.StopCPUProfile()
		}
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = NewScanner(input)
	scanner.Split(bufio.ScanWords)

	writer = bufio.NewWriter(output)
	defer writer.Flush()

	solve()
}

// Read.

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

func readLine() string {
	scanner.Split(bufio.ScanLines)
	defer scanner.Split(bufio.ScanWords)
	return readString()
}

func readInt() int {
	ans, _ := strconv.ParseInt(readString(), 10, 0)
	return int(ans)
}

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

func readFloat64() float64 {
	ans, _ := strconv.ParseFloat(readString(), 64)
	return ans
}

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printLine() {
	printString("\n")
}

func printInt(value int) {
	printString(strconv.FormatInt(int64(value), 10))
}

func printInt64(value int64) {
	printString(strconv.FormatInt(value, 10))
}

func printFLoat64(value float64) {
	printString(strconv.FormatFloat(value, 'f', 20, 64))
}

// Log.

func logln(value ...interface{}) {
	writer.Flush()
	logger.Println(value...)
}
func logf(format string, value ...interface{}) {
	writer.Flush()
	logger.Printf(format, value...)
}

// Tuple

type Tuple struct {
	a, b int
}

func (p Tuple) Equals(key Key) bool {
	return p.a == key.(Tuple).a
}

func (p Tuple) Less(key Key) bool {
	return p.a < key.(Tuple).a
}

type TupleSlice []Tuple

func (p TupleSlice) Len() int {
	return len(p)
}

func (p TupleSlice) Less(j, i int) bool {
	return p[j].a < p[i].a
}

func (p TupleSlice) Swap(j, i int) {
	p[j], p[i] = p[i], p[j]
}

// Min, max, abs.

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

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

func absInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func absInt64(a int64) int64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func absFloat64(a float64) float64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

// Set Key interface implementations.

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

// Copied scan.go
// Scanner provides a convenient interface for reading data such as
// a file of newline-delimited lines of text. Successive calls to
// the Scan method will step through the 'tokens' of a file, skipping
// the bytes between the tokens. The specification of a token is
// defined by a split function of type SplitFunc; the default split
// function breaks the input into lines with line termination stripped. Split
// functions are defined in this package for scanning a file into
// lines, bytes, UTF-8-encoded runes, and space-delimited words. The
// client may instead provide a custom split function.
//
// Scanning stops unrecoverably at EOF, the first I/O error, or a token too
// large to fit in the buffer. When a scan stops, the reader may have
// advanced arbitrarily far past the last token. Programs that need more
// control over error handling or large tokens, or must run sequential scans
// on a reader, should use bufio.Reader instead.
//
type Scanner struct {
	r            io.Reader // The reader provided by the client.
	split        SplitFunc // The function to split the tokens.
	maxTokenSize int       // Maximum size of a token; modified by tests.
	token        []byte    // Last token returned by split.
	buf          []byte    // Buffer used as argument to split.
	start        int       // First non-processed byte in buf.
	end          int       // End of data in buf.
	err          error     // Sticky error.
}

// SplitFunc is the signature of the split function used to tokenize the
// input. The arguments are an initial substring of the remaining unprocessed
// data and a flag, atEOF, that reports whether the Reader has no more data
// to give. The return values are the number of bytes to advance the input
// and the next token to return to the user, plus an error, if any. If the
// data does not yet hold a complete token, for instance if it has no newline
// while scanning lines, SplitFunc can return (0, nil, nil) to signal the
// Scanner to read more data into the slice and try again with a longer slice
// starting at the same point in the input.
//
// If the returned error is non-nil, scanning stops and the error
// is returned to the client.
//
// The function is never called with an empty data slice unless atEOF
// is true. If atEOF is true, however, data may be non-empty and,
// as always, holds unprocessed text.
type SplitFunc func(data []byte, atEOF bool) (advance int, token []byte, err error)

// Errors returned by Scanner.
var (
	ErrTooLong         = errors.New("bufio.Scanner: token too long")
	ErrNegativeAdvance = errors.New("bufio.Scanner: SplitFunc returns negative advance count")
	ErrAdvanceTooFar   = errors.New("bufio.Scanner: SplitFunc returns advance count beyond input")
)

const (
	// Maximum size used to buffer a token. The actual maximum token size
	// may be smaller as the buffer may need to include, for instance, a newline.
	MaxScanTokenSize = 1 << 20
)

// NewScanner returns a new Scanner to read from r.
// The split function defaults to ScanLines.
func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        ScanLines,
		maxTokenSize: MaxScanTokenSize,
		buf:          make([]byte, 4096), // Plausible starting size; needn't be large.
	}
}

// Err returns the first non-EOF error that was encountered by the Scanner.
func (s *Scanner) Err() error {
	if s.err == io.EOF {
		return nil
	}
	return s.err
}

// Bytes returns the most recent token generated by a call to Scan.
// The underlying array may point to data that will be overwritten
// by a subsequent call to Scan. It does no allocation.
func (s *Scanner) Bytes() []byte {
	return s.token
}

// Text returns the most recent token generated by a call to Scan
// as a newly allocated string holding its bytes.
func (s *Scanner) Text() string {
	return string(s.token)
}

// Scan advances the Scanner to the next token, which will then be
// available through the Bytes or Text method. It returns false when the
// scan stops, either by reaching the end of the input or an error.
// After Scan returns false, the Err method will return any error that
// occurred during scanning, except that if it was io.EOF, Err
// will return nil.
func (s *Scanner) Scan() bool {
	// Loop until we have a token.
	for {
		// See if we can get a token with what we already have.
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], s.err != nil)
			if err != nil {
				s.setErr(err)
				return false
			}
			if !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		// We cannot generate a token with what we are holding.
		// If we've already hit EOF or an I/O error, we are done.
		if s.err != nil {
			// Shut it down.
			s.start = 0
			s.end = 0
			return false
		}
		// Must read more data.
		// First, shift data to beginning of buffer if there's lots of empty space
		// or space is neded.
		if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
			copy(s.buf, s.buf[s.start:s.end])
			s.end -= s.start
			s.start = 0
		}
		// Is the buffer full? If so, resize.
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				s.setErr(ErrTooLong)
				return false
			}
			newSize := len(s.buf) * 2
			if newSize > s.maxTokenSize {
				newSize = s.maxTokenSize
			}
			newBuf := make([]byte, newSize)
			copy(newBuf, s.buf[s.start:s.end])
			s.buf = newBuf
			s.end -= s.start
			s.start = 0
			continue
		}
		// Finally we can read some input. Make sure we don't get stuck with
		// a misbehaving Reader. Officially we don't need to do this, but let's
		// be extra careful: Scanner is for safe, simple jobs.
		for loop := 0; ; {
			n, err := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if err != nil {
				s.setErr(err)
				break
			}
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				s.setErr(io.ErrNoProgress)
				break
			}
		}
	}
}

// advance consumes n bytes of the buffer. It reports whether the advance was legal.
func (s *Scanner) advance(n int) bool {
	if n < 0 {
		s.setErr(ErrNegativeAdvance)
		return false
	}
	if n > s.end-s.start {
		s.setErr(ErrAdvanceTooFar)
		return false
	}
	s.start += n
	return true
}

// setErr records the first error encountered.
func (s *Scanner) setErr(err error) {
	if s.err == nil || s.err == io.EOF {
		s.err = err
	}
}

// Split sets the split function for the Scanner. If called, it must be
// called before Scan. The default split function is ScanLines.
func (s *Scanner) Split(split SplitFunc) {
	s.split = split
}

// Split functions

// ScanBytes is a split function for a Scanner that returns each byte as a token.
func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	return 1, data[0:1], nil
}

var errorRune = []byte(string(utf8.RuneError))

// ScanRunes is a split function for a Scanner that returns each
// UTF-8-encoded rune as a token. The sequence of runes returned is
// equivalent to that from a range loop over the input as a string, which
// means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd".
// Because of the Scan interface, this makes it impossible for the client to
// distinguish correctly encoded replacement runes from encoding errors.
func ScanRunes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}

	// Fast path 1: ASCII.
	if data[0] < utf8.RuneSelf {
		return 1, data[0:1], nil
	}

	// Fast path 2: Correct UTF-8 decode without error.
	_, width := utf8.DecodeRune(data)
	if width > 1 {
		// It's a valid encoding. Width cannot be one for a correctly encoded
		// non-ASCII rune.
		return width, data[0:width], nil
	}

	// We know it's an error: we have width==1 and implicitly r==utf8.RuneError.
	// Is the error because there wasn't a full rune to be decoded?
	// FullRune distinguishes correctly between erroneous and incomplete encodings.
	if !atEOF && !utf8.FullRune(data) {
		// Incomplete; get more bytes.
		return 0, nil, nil
	}

	// We have a real UTF-8 encoding error. Return a properly encoded error rune
	// but advance only one byte. This matches the behavior of a range loop over
	// an incorrectly encoded string.
	return 1, errorRune, nil
}

// dropCR drops a terminal \r from the data.
func dropCR(data []byte) []byte {
	if len(data) > 0 && data[len(data)-1] == '\r' {
		return data[0 : len(data)-1]
	}
	return data
}

// ScanLines is a split function for a Scanner that returns each line of
// text, stripped of any trailing end-of-line marker. The returned line may
// be empty. The end-of-line marker is one optional carriage return followed
// by one mandatory newline. In regular expression notation, it is `\r?\n`.
// The last non-empty line of input will be returned even if it has no
// newline.
func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	if i := bytes.IndexByte(data, '\n'); i >= 0 {
		// We have a full newline-terminated line.
		return i + 1, dropCR(data[0:i]), nil
	}
	// If we're at EOF, we have a final, non-terminated line. Return it.
	if atEOF {
		return len(data), dropCR(data), nil
	}
	// Request more data.
	return 0, nil, nil
}

// isSpace reports whether the character is a Unicode white space character.
// We avoid dependency on the unicode package, but check validity of the implementation
// in the tests.
func isSpace(r rune) bool {
	if r <= '\u00FF' {
		// Obvious ASCII ones: \t through \r plus space. Plus two Latin-1 oddballs.
		switch r {
		case ' ', '\t', '\n', '\v', '\f', '\r':
			return true
		case '\u0085', '\u00A0':
			return true
		}
		return false
	}
	// High-valued ones.
	if '\u2000' <= r && r <= '\u200a' {
		return true
	}
	switch r {
	case '\u1680', '\u180e', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000':
		return true
	}
	return false
}

// ScanWords is a split function for a Scanner that returns each
// space-separated word of text, with surrounding spaces deleted. It will
// never return an empty string. The definition of space is set by
// unicode.IsSpace.
func ScanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	// Skip leading spaces.
	start := 0
	for width := 0; start < len(data); start += width {
		var r rune
		r, width = utf8.DecodeRune(data[start:])
		if !isSpace(r) {
			break
		}
	}
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	// Scan until space, marking end of word.
	for width, i := 0, start; i < len(data); i += width {
		var r rune
		r, width = utf8.DecodeRune(data[i:])
		if isSpace(r) {
			return i + width, data[start:i], nil
		}
	}
	// If we're at EOF, we have a final, non-empty, non-terminated word. Return it.
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	// Request more data.
	return 0, nil, nil
}

// 446A
package main

import (
	"fmt"
)

var (
	x1, x2, x3 [100000]int
	n, o       int
)

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

func main() {
	o = 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(x1[i])
	}
	for i := 1; i < n; i++ {
		if x1[i] > x1[i-1] {
			x2[i] = x2[i-1] + 1
			o = max(o, x2[i])
		} else {
			x2[i] = 0
		}

	}
	for i := n - 2; ^i != 0; i-- {
		if x1[i] < x1[i+1] {
			x3[i] = x3[i+1] + 1
			o = max(o, x3[i])
		} else {
			x3[i] = 0
		}

	}
	for i := n - 1; i != 0; i-- {
		if x1[i-1]+1 < x1[i+1] {
			o = max(o, x2[i-1]+x3[i+1]+1)
		}

	}
	fmt.Println(min(n, o+2))
}


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 t int
	scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var m, temp int
		scanf("%d\n", &m)

		arr1 := make([]int, m)
		arr2 := make([]int, m)
		for j := 0; j < m; j++ {
			scanf("%d", &temp)
			arr1[j] = temp
		}
		scanf("\n")

		for j := 0; j < m; j++ {
			scanf("%d", &temp)
			arr2[j] = temp
		}
		scanf("\n")

		printf("%d\n", compute(m, arr1, arr2))
	}
}

func compute(m int, arr1, arr2 []int) int {
	sum1 := 0
	for _, a := range arr1 {
		sum1 += a
	}

	tot1 := arr1[0]
	tot2 := arr2[0]
	result := sum1 - tot1

	for i := 1; i < m-1; i++ {
		tot1 += arr1[i]

		temp := tot2
		if sum1-tot1 > temp {
			temp = sum1 - tot1
		}

		if temp < result {
			result = temp
		}

		tot2 += arr2[i]
	}

	if tot2 < result {
		result = tot2
	}

	return result
}

package main

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

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

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

	for k:=0;k<t;k++{
		var m int
		fmt.Fscan(r,&m)
		nums:=[2][]int{}
		for i:=0;i<2;i++{
			nums[i]=make([]int,m)
		}
		for i:=0;i<2;i++{
			for j:=0;j<m;j++{
				fmt.Fscan(r,&nums[i][j])
			}
		}
		solve(&nums)
	}
}
func solve(nums *[2][]int){
	m:=len(nums[0])
	//在原切片上计算每行的前缀和
	for j:=1;j<m;j++{
		nums[0][j]=nums[0][j-1]+nums[0][j]
		nums[1][j]=nums[1][j-1]+nums[1][j]
	}
	var bob int=nums[0][m-1]-nums[0][0]
	for j:=1;j<m;j++{
		bob=min(bob,max(nums[0][m-1]-nums[0][j],nums[1][j-1]))
	}
	fmt.Println(bob)
}
func max(a,b int) int{
	if a>=b{
		return a
	}
	return b
}
func min(a,b int)int{
	if a<=b{
		return a
	}
	return b
}

package main

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

func CF1555C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var t int
	var n, v int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n)
		fir := make([]int, n+1)
		sec := make([]int, n+1)
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			fir[i+1] = fir[i] + v
		}
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			sec[i+1] = sec[i] + v
		}
		ans := math.MaxInt32
		for i := 0; i < n; i++ {
			ans = min(ans, max(fir[n]-fir[i+1], sec[i]-sec[0]))
		}
		Fprintln(out, ans)
	}
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

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

package main

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

/*
1
5
5 4 3 5 4
3 6 3 6 2
---

*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var m int
	scanf("%d\n", &m)

	mtx := make([][]int, 2)

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

		for j := range mtx[i] {
			scanf("%d", &mtx[i][j])

		}
		scanf("\n")
	}

	ps := make([][]int, 2)

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

		sum := 0
		for j := range ps[i] {
			sum += mtx[i][j]
			ps[i][j] = sum
		}
	}

	minBobSum := maxInt

	for j := 0; j < m; j++ {
		bobSum := max(ps[0][m-1]-ps[0][j], ps[1][j]-mtx[1][j])
		minBobSum = min(minBobSum, bobSum)
	}

	fmt.Fprintln(writer, minBobSum)
}

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

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

	for ; t > 0; t-- {
		solve()
	}
}

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 reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return nums[minNumIdx]
}

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

	return nums[maxNumIdx]
}

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

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

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

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(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"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1555C(_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)
		ans := int(2e9)
		s0, s1 := 0, 0
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
			s0 += a[i]
		}
		for _, v := range a {
			s0 -= v
			ans = min(ans, max(s0, s1))
			Fscan(in, &v)
			s1 += v
		}
		Fprintln(out, ans)
	}
}

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

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

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

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

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

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

		a := make([][]int64, 2)

		for j := 0; j < 2; j++ {
			a[j] = make([]int64, m)
			for k := 0; k < m; k++ {
				fmt.Fscan(r, &a[j][k])
			}
		}

		fmt.Println(solve(a, m))
	}
}

func solve(a [][]int64, m int) int64 {
	dp := [2][]int64{}
	dp[0] = make([]int64, m + 1)
	dp[1] = make([]int64, m + 1)

	dp[0][0] = a[0][0]

	for i := 1; i < m; i++ {
		dp[0][i] = a[0][i] +  dp[0][i - 1]
	}

	dp[1][0] = a[1][0]

	for j := 1; j < m; j++ {
		dp[1][j] = a[1][j] +  dp[1][j - 1]
	}

	var bob int64 = 1e18

	for i := 0; i < m; i++ {
		var s1 int64
		if i > 0 {
			s1 = dp[1][i - 1]
		}
		s2 := dp[0][m - 1] - dp[0][i]

		s := max(s1, s2)

		bob = min(s, bob)
	}

	return bob
}

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

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

package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

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

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

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

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

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

func MAXX(x, y int) int {
	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 GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m
}

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
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

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

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 int
		fmt.Fscan(input, &n)

		FIRST := make([]int, n)
		SECOND := make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(input, &FIRST[i])

		}
		var SUMSECOND int
		for i := 0; i < n; i++ {
			fmt.Fscan(input, &SECOND[i])
			SUMSECOND = SUMSECOND + SECOND[i]
		}
		NEWWW := make([]int, 0)
		begin := 0
		SUMSECOND = SUMSECOND - SECOND[n-1]
		NEWWW = append(NEWWW, SUMSECOND)
		for j := n - 2; j > -1; j-- {
			begin = begin + FIRST[j+1]
			SUMSECOND = SUMSECOND - SECOND[j]

			q := MAXX(begin, SUMSECOND)
			NEWWW = append(NEWWW, q)

		}

		sort.Ints(NEWWW)
		fmt.Println(NEWWW[0])

	}

}


package main

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

func solveB() {
	var n int64
	scan(&n)
	x := make([]int64, n)
	y := make([]int64, n)
	for i := range x {
		scan(&x[i])
		scan(&y[i])
	}
	sort.Slice(x, func(i, j int) bool { return x[i] < x[j] })
	sort.Slice(y, func(i, j int) bool { return y[i] < y[j] })

	dx := int64(1)
	dy := int64(1)
	if n%2 == 0 {
		dx = x[n/2] - x[n/2-1] + 1
		dy = y[n/2] - y[n/2-1] + 1
	}

	printf("%d\n", dx*dy)
}

func solveA() {
	var n int64
	scan(&n)

	a := make([]int64, n)
	for i := range a {
		scan(&a[i])
	}

	c := int64(0)
	for i := 0; i < len(a)-1; i++ {
		if a[i] < c {
			printf("NO\n")
			return
		}
		dx := a[i] - c
		a[i+1] += dx
		c++
	}

	if a[n-1] >= c {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)

	for t := 0; t < T; t++ {
		solveB()
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

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

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

func printf(f string, a ...interface{}) (n int, err error) { return fmt.Fprintf(out, f, a...) }
func println(a ...interface{}) (n int, err error)          { return fmt.Fprintln(out, a...) }

//https://codeforces.com/problemset/problem/1486/B
// median;sorting;hamilton distance

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)
	in.Buffer(make([]byte, 4096), int(1e+9))
	for t := nextNum(); t > 0; t-- {
		solve()
	}
}

func solve() {
	n := nextNum()
	x := make([]int, n)
	y := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextNum()
		y[i] = nextNum()
	}
	sort.Ints(x)
	sort.Ints(y)
	i, j := (n-1)/2, n/2
	println(int64(x[j]-x[i]+1) * int64(y[j]-y[i]+1))
}

func nextNum() int {
	in.Scan()
	var r, f int
	f = 1
	for _, c := range in.Bytes() {
		if c == '-' {
			f = -1
			continue
		}
		r *= 10
		r += int(c - '0')
	}
	return r * f
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		n := readNum(reader)
		X, Y := make([]int, n), make([]int, n)
		for i := 0; i < n; i++ {
			X[i], Y[i] = readTwoNums(reader)
		}
		res := solve(n, X, Y)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	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, X, Y []int) int64 {
	sort.Ints(X)
	sort.Ints(Y)

	var a int64 = 1
	if n&1 == 0 && X[n/2-1] != X[n/2] {
		a = int64(X[n/2]) - int64(X[n/2-1]) + 1
	}
	var b int64 = 1
	if n&1 == 0 && Y[n/2-1] != Y[n/2] {
		b = int64(Y[n/2]-Y[n/2-1]) + 1
	}

	return a * b
}

package main

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

func main() {
	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n int
		_, _ = fmt.Fscan(in, &n)

		x := make([]int, n)
		y := make([]int, n)

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

		sort.Ints(x)
		sort.Ints(y)

		if n%2 == 1 {
			fmt.Println(1)
		} else {
			m := n / 2

			yLen := int64(y[m] - y[m-1] + 1)
			xLen := int64(x[m] - x[m-1] + 1)

			ans := yLen * xLen

			fmt.Println(ans)
		}
	}
}

package main

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

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

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

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		x := make([]int, n)
		y := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &x[i], &y[i])
		}
		sort.Ints(x)
		sort.Ints(y)
		if n%2 == 0 {
			fmt.Println((abs(x[n/2-1]-x[n/2]) + 1) * (abs(y[n/2-1]-y[n/2]) + 1))
		} else {
			fmt.Println(1)
		}
	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
	"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()
	type pair struct{ x, y int64 }

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		var sx, sy int64
		ps := make([]pair, n)
		for i := range ps {
			Fscan(in, &ps[i].x, &ps[i].y)
			sx += ps[i].x
			sy += ps[i].y
		}
		if n&1 == 1 {
			Fprintln(out, 1)
			return
		}
		sort.Slice(ps, func(i, j int) bool { return ps[i].x < ps[j].x })
		d1 := ps[n/2].x - ps[n/2-1].x + 1
		sort.Slice(ps, func(i, j int) bool { return ps[i].y < ps[j].y })
		d2 := ps[n/2].y - ps[n/2-1].y + 1
		Fprintln(out, d1*d2)
	}

	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) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

var in *bufio.Reader

func solve() {
	var n int
	fmt.Fscan(in, &n)

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

	if n%2 == 1 {
		fmt.Println(1)
		return
	}

	mid := n / 2
	sort.Ints(xs)
	width := int64(xs[mid] - xs[mid-1] + 1)

	sort.Ints(ys)
	height := int64(ys[mid] - ys[mid-1] + 1)

	fmt.Println(width * height)
}

func main() {
	in = bufio.NewReader(os.Stdin)

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

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

package main

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

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

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

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

func sint64() int64 {
	s := sstring()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

func sstring() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		n := sint64()
		xy := make([][2]int64, n)
		for i := range xy {
			xy[i] = [2]int64{sint64(), sint64()}
		}
		printf("%d\n", sol(n, xy))
	}
}

func sol(n int64, xy [][2]int64) int64 {
	if n&1 == 1 {
		return 1
	}
	x := []int64{}
	y := []int64{}
	for _, e := range xy {
		x = append(x, e[0])
		y = append(y, e[1])
	}
	sort.Slice(x, func(il, ir int) bool {
		return x[il] < x[ir]
	})
	sort.Slice(y, func(il, ir int) bool {
		return y[il] < y[ir]
	})
	xl := x[n/2-1]
	xr := x[n/2]
	yb := y[n/2-1]
	yt := y[n/2]
	return (xr - xl + 1) * (yt - yb + 1)
}

package main

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

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

func printf(f string, a ...interface{}) (n int, err error) { return fmt.Fprintf(out, f, a...) }
func println(a ...interface{}) (n int, err error)          { return fmt.Fprintln(out, a...) }

//https://codeforces.com/problemset/problem/1486/B
// median;sorting;hamilton distance

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)
	in.Buffer(make([]byte, 4096), int(1e+9))
	for t := nextNum(); t > 0; t-- {
		solve()
	}
}

func solve() {
	n := nextNum()
	x := make([]int, n)
	y := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = nextNum()
		y[i] = nextNum()
	}
	sort.Ints(x)
	sort.Ints(y)
	i, j := (n-1)/2, n/2
	println((x[j] - x[i] + 1) * (y[j] - y[i] + 1))
}

func nextNum() int {
	in.Scan()
	var r, f int
	f = 1
	for _, c := range in.Bytes() {
		if c == '-' {
			f = -1
			continue
		}
		r *= 10
		r += int(c - '0')
	}
	return r * f
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		n := readNum(reader)
		X, Y := make([]int, n), make([]int, n)
		for i := 0; i < n; i++ {
			X[i], Y[i] = readTwoNums(reader)
		}
		res := solve(n, X, Y)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	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, X, Y []int) int {
	sort.Ints(X)
	sort.Ints(Y)

	a := 1
	if n&1 == 0 && X[n/2-1] != X[n/2] {
		a = X[n/2] - X[n/2-1] + 1
	}
	b := 1
	if n&1 == 0 && Y[n/2-1] != Y[n/2] {
		b = Y[n/2] - Y[n/2-1] + 1
	}

	return a * b
}

package main

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

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)

	for t := 0; t < T; t++ {
		var n int
		scan(&n)
		x := make([]int, n)
		y := make([]int, n)
		for i := range x {
			scan(&x[i])
			scan(&y[i])
		}
		sort.Slice(x, func(i, j int) bool { return x[i] < x[j] })
		sort.Slice(y, func(i, j int) bool { return y[i] < y[j] })

		dx := -1
		dy := -1
		if n%2 == 0 {
			dx = x[n/2] - x[n/2-1] + 1
			dy = y[n/2] - y[n/2-1] + 1
		} else {
			dx = 1
			dy = 1
		}

		printf("%d\n", dx*dy)
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

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

func main() {
	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n int
		_, _ = fmt.Fscan(in, &n)

		x := make([]int, n)
		y := make([]int, n)

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

		sort.Ints(x)
		sort.Ints(y)

		if n%2 == 1 {
			fmt.Println(1)
		} else {
			m := n / 2
			ans := (y[m] - y[m-1] + 1) * (x[m] - x[m-1] + 1)
			fmt.Println(ans)
		}
	}
}

package main

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

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

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

	for ; t > 0; t-- {
		fmt.Fscan(in, &n)
		var X, Y int64
		x := make([]int64, n)
		y := make([]int64, n)
		for i := int64(0); i < n; i++ {
			fmt.Fscan(in, &x[i], &y[i])
			X += x[i]
			Y += y[i]
		}
		if n == 1 {
			fmt.Println(1)
			continue
		}
		if n == 2 {
			fmt.Println((abs(x[0]-x[1]) + 1) * (abs(y[0]-y[1]) + 1))
			continue
		}
		result := 1
		if X%n == n/2 {
			result *= 2
		}
		if Y%n == n/2 {
			result *= 2
		}
		fmt.Println(result)
	}
}

func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

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()
	type pair struct{ x, y int64 }

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		var sx, sy int64
		ps := make([]pair, n)
		for i := range ps {
			Fscan(in, &ps[i].x, &ps[i].y)
			sx += ps[i].x
			sy += ps[i].y
		}
		f := func(x, y int64) (s int64) {
			for _, p := range ps {
				s += abs(p.x-x) + abs(p.y-y)
			}
			return
		}
		sx /= int64(n)
		sy /= int64(n)
		d, c := int64(1e18), 0
		for i := sx - 1; i < sx+2; i++ {
			for j := sy - 1; j < sy+2; j++ {
				dd := f(i, j)
				if dd < d {
					d, c = dd, 1
				} else if dd == d {
					c++
				}
			}
		}
		Fprintln(out, c)
	}

	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) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}


package main

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

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

// 	rooms := 1
// 	a := make([]int, n+1)
// 	a[1] = 0
// 	times := make([]int, n+1)
// 	times[0] = 1
// 	for i := 1; i <= n; i++ {
// 		var record int
// 		fmt.Scanf("%d", &record) // record < i
// 		visitedRoom := times[record]
// 		if (visitedRoom > 0) && (a[visitedRoom] == record) {
// 			a[visitedRoom] = i
// 			times[i] = visitedRoom
// 		} else {
// 			rooms++
// 			a[rooms] = i
// 			times[i] = rooms
// 		}
// 	}

// 	fmt.Println(rooms)
// }

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	rooms := 1
	a := make([]int, n+1)
	a[1] = 0
	times := make([]int, n+1)
	times[0] = 1
	for i := 1; scanner.Scan(); i++ {
		record, _ := strconv.Atoi(scanner.Text())
		visitedRoom := times[record]
		if (visitedRoom > 0) && (a[visitedRoom] == record) {
			a[visitedRoom] = i
			times[i] = visitedRoom
		} else {
			rooms++
			a[rooms] = i
			times[i] = rooms
		}
	}

	fmt.Println(rooms)
}

package main

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

func solve() {
	n := readInt()
	t := make([]int, n)
	for i := 0; i < n; i++ {
		t[i] = readInt() - 1
	}
	values := make([]int, n)
	for i := 0; i < n; i++ {
		values[i] = -1
	}
	id := 0
	for i := n - 1; i >= 0; i-- {
		if values[i] != -1 {
			continue
		}
		id++
		next := i
		for next >= 0 && values[next] == -1 {
			values[next] = id
			next = t[next]
		}
	}
	fmt.Println(id)
}

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()
}

// 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
}

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

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


// Author: sighduck
// URL: https://codeforces.com/contest/1213/problem/E

package main

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

func classifyString(s string) (string, map[string]string) {
	classifiers := "xyzx"
	ptr := 0
	lettersToClassifiers := make(map[string]string)
	classifiersToLetters := make(map[string]string)
	for _, char := range s + "abc" {
		letter := string(char)
		currentClassifier := string(classifiers[ptr])
		_, ok := lettersToClassifiers[letter]
		if !ok {
			lettersToClassifiers[letter] = currentClassifier
			classifiersToLetters[currentClassifier] = letter
			ptr += 1
		}
	}
	classifiedString := []string{}
	for _, char := range s {
		letter := string(char)
		classifiedString = append(classifiedString, lettersToClassifiers[letter])
	}
	return strings.Join(classifiedString, ""), classifiersToLetters
}

func Solve(n int, s string, t string) string {
	if !strings.Contains("abca", s) && !strings.Contains("abca", t) {
		return strings.Repeat("abc", n)
	}
	if !strings.Contains("acba", s) && !strings.Contains("acba", t) {
		return strings.Repeat("acb", n)
	}
	c, m := classifyString(s + t)
	if c == "xyzy" {
		return strings.Repeat(m["y"], n) + strings.Repeat(m["x"], n) + strings.Repeat(m["z"], n)
	} else if c == "xyyx" {
		return strings.Repeat(m["x"], n) + strings.Repeat(m["z"], n) + strings.Repeat(m["y"], n)
	} else if c == "xyxz" {
		return strings.Repeat(m["y"], n) + strings.Repeat(m["z"], n) + strings.Repeat(m["x"], n)
	}
	return ""
}

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

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

	fmt.Fprintf(writer, "YES\n")
	fmt.Fprintf(writer, "%s\n", Solve(n, s, t))
}

package main
import "fmt"
import "os"
import "bufio"

func getc(a, b byte) byte {
    var c byte = byte(3)-(a-byte(97))-(b-byte(97))+byte(97)
    return c
}

func getans(a, b byte, n int) []byte{
    c := getc(a, b)
    var ans []byte
    for i:=1; i<=n; i++ {
        ans = append(ans, a)
    }
    for i:=1; i<=n; i++ {
        ans = append(ans, b)
    }
    for i:=1; i<=n; i++ {
        ans = append(ans, c)
    }
    return ans
}

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

    var n int
    var s,t string
    fmt.Fscanf(input, "%d\n", &n)
    fmt.Fscanf(input, "%s\n%s", &s, &t)

    if t[0]==t[1] {
        s, t = t, s
    }

    var ans []byte
    if s[0]==s[1] {
        if t[0]==t[1] {
            ans = []byte{97, 98, 99}
        } else if s[0]==t[0] {
            ans = []byte{t[0], getc(t[0], t[1]), t[1]}
        } else if s[0]==t[1] {
            ans = []byte{t[1], t[0], getc(t[0], t[1])}
        } else {
            ans = []byte{s[0], t[1], t[0]}
        }
        var tans []byte
        for i:=1; i<=n; i++ {
            tans = append(tans, ans[0], ans[1], ans[2])
        }
        ans = tans
    } else {
        if s[0]==t[0] {
            ans = getans(s[1], getc(s[0], s[1]), n)
        } else if s[1]==t[1] {
            ans = getans(s[1], s[0], n)
        } else {
            ans = getans(s[0], getc(s[0], s[1]), n)
        }
    }

    fmt.Printf("YES\n")
    fmt.Println(string(ans))

}

package main

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

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

	var n int
	var s, t string
	Fscan(bufio.NewReader(in), &n, &s, &t)
	Fprintln(out, "YES")
	if s[0] == s[1] && t[0] == t[1] {
		Fprint(out, strings.Repeat("abc", n))
	} else if s[0] != s[1] && t[0] != t[1] {
		for _, p := range []string{"abc", "acb", "bac", "bca", "cab", "cba"} {
			if p[:2] != s && p[:2] != t && p[1:] != s && p[1:] != t {
				for i := range p {
					Fprint(out, strings.Repeat(p[i:i+1], n))
				}
				break
			}
		}
	} else {
		if t[0] == t[1] {
			s, t = t, s
		}
		if t[0] != s[0] && t[1] != s[0] {
			Fprint(out, strings.Repeat(s[:1]+t[1:]+t[:1], n))
		} else {
			miss := byte('a')
			for ; miss == s[0] || miss == t[0] || miss == t[1]; miss++ {
			}
			b := t[0]
			if b == s[0] {
				b = t[1]
			}
			Fprint(out, strings.Repeat(s[:1]+string(miss), n), strings.Repeat(string(b), n))
		}
	}
}

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

package main

import (
	"fmt"
)

const empty = '!'
const nmax = 4

func sample(n uint32, bl map[rune]map[rune]bool, abc string) (bool, string, uint32) {
	l := int64(3 * n)

	r := make([]rune, l)

	count := map[rune]uint32{
		'a': n,
		'b': n,
		'c': n,
	}

	order := map[rune]int{}

	order[empty] = 0
	for i, ch := range abc {
		order[ch] = i + 1
	}

	getOptions := func(min, prev rune) rune {
		//TODO: add order

		for i, ch := range abc {
			if (min == empty || i > order[min]) && count[ch] > 0 && !bl[prev][ch] {
				return ch
			}
		}

		return empty
	}

	i, c := int64(0), uint32(0)
	for i >= 0 && i < l {
		prev, s := empty, empty

		if i > 0 {
			prev = r[i-1]
		}

		if r[i] > empty {
			s = r[i]
		}

		found := false
		next := getOptions(s, prev)

		found = next != empty //&& (i != l-1 || !bl[next][r[0]])

		if found {
			r[i] = next
			count[next]--
			i++
		} else {
			i--
			if i >= 0 && r[i] > empty {
				count[r[i]]++
				if i < l-1 {
					r[i+1] = empty
				}
			}
			c++
		}

	}

	return i > 0, string(r), c
}

func solve(n uint32, s1, s2 []rune) (bool, string) {
	variants := []string{"abc", "bac", "cab", "cba", "bca", "acb"}
	abc := ""

	var m uint32 = 8
	if n < m {
		m = n
	}

	bl := map[rune]map[rune]bool{}

	for _, ch := range [...]rune{'a', 'b', 'c', empty} {
		bl[ch] = map[rune]bool{}
	}

	bl[s1[0]][s1[1]] = true
	bl[s2[0]][s2[1]] = true

	min := uint32(65536)
	for _, v := range variants {
		f, _, c := sample(m, bl, v)
		if f && c < min {
			min, abc = c, v
		}
	}

	if len(abc) == 0 {
		return false, abc
	}

	f, s, _ := sample(n, bl, abc)

	return f, s
}

func main() {
	var n uint32
	var s1, s2 string

	fmt.Scan(&n)
	fmt.Scan(&s1, &s2)

	f, res := solve(n, ([]rune)(s1), ([]rune)(s2))

	if f {
		fmt.Println("YES")
		fmt.Println(res)
	} else {
		fmt.Println("NO")
	}
}

package main

import (
	"bufio"
	"bytes"
	"os"
	"runtime"
	"strconv"
	"strings"
)

/* solution */

func solve() {
	ans := solveOne()
	print("YES")
	print(ans)

}

func solveOne() string {

	n := readInt()
	ss, tt := read(), read()
	s, t := [2]byte{ss[0], ss[1]}, [2]byte{tt[0], tt[1]}

	// case 1 (s[0] == s[1] && s == reverse(t))
	if s[0] != s[1] && s[0] == t[1] && s[1] == t[0] {
		one, two := s[0], not(s[0], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 2.1 (s[0] == s[1])
	if s[0] == s[1] {
		one, two := t[0], not(t[0], t[1])
		three := not(one, two)
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	// case 2.2 (t[0] == t[1])
	if t[0] == t[1] {
		one, two := s[0], not(s[0], s[1])
		three := not(one, two)
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	// case 3.1 (s[0] == t[0])
	if s[0] == t[0] {
		two, three := not(s[0], s[0]), s[0]
		one := not(two, three)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 3.2 (s[1] == t[1])
	if s[1] == t[1] {
		one, two := s[1], not(s[1], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 4 (s[0] == t[1] || s[1] == t[0])
	if s[0] == t[1] {
		one, two, three := s[1], s[0], t[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}
	if s[1] == t[0] {
		one, two, three := t[1], t[0], s[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	return ""

}

func not(a, b byte) byte {
	if a != 'a' && b != 'a' {
		return 'a'
	}
	if a != 'b' && b != 'b' {
		return 'b'
	}
	return 'c'
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanLines)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

import (
	"bufio"
	"bytes"
	"os"
	"runtime"
	"strconv"
	"strings"
)

/* solution */

func solve() {
	ans := solveOne()
	print("YES")
	print(ans)

}

func solveOne() string {

	n := readInt()
	ss, tt := read(), read()
	s, t := [2]byte{ss[0], ss[1]}, [2]byte{tt[0], tt[1]}

	// case 1 (s[0] == s[1] && s == reverse(t))
	if s[0] != s[1] && s[0] == t[1] && s[1] == t[0] {
		one, two := s[0], not(s[0], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 2.1 (s[0] == s[1])
	if s[0] == s[1] {
		if t[0] < t[1] {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 2.2 (t[0] == t[1])
	if t[0] == t[1] {
		if s[0] < s[1] {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 3 (s[0] == t[0])
	if s[0] == t[0] {
		one, two := s[0], not(s[1], t[1])
		var three byte
		if one == two {
			three = one
			one = not(three, three)
			two = not(one, three)
			return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
		}
		three = not(one, two)
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	// case 4 (s[0] == t[1] || s[1] == t[0])
	if s[0] == t[1] {
		one, two, three := s[1], s[0], t[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}
	if s[1] == t[0] {
		one, two, three := t[1], t[0], s[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	return ""

}

func not(a, b byte) byte {
	if a != 'a' && b != 'a' {
		return 'a'
	}
	if a != 'b' && b != 'b' {
		return 'b'
	}
	return 'c'
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanLines)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

import (
	"bufio"
	"bytes"
	"os"
	"runtime"
	"strconv"
	"strings"
)

/* solution */

func solve() {
	ans := solveOne()
	print("YES")
	print(ans)

}

func solveOne() string {

	n := readInt()
	ss, tt := read(), read()
	s, t := [2]byte{ss[0], ss[1]}, [2]byte{tt[0], tt[1]}

	// case 1 (s[0] == s[1] && s == reverse(t))
	if s[0] != s[1] && s[0] == t[1] && s[1] == t[0] {
		one, two := s[0], not(s[0], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 2.1 (s[0] == s[1])
	if s[0] == s[1] {
		if (2+t[0]-t[1])%2 == 1 {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 2.2 (t[0] == t[1])
	if t[0] == t[1] {
		if (2+s[0]-s[1])%2 == 1 {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 3.1 (s[0] == t[0])
	if s[0] == t[0] {
		two, three := not(s[0], s[0]), s[0]
		one := not(two, three)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 3.2 (s[1] == t[1])
	if s[1] == t[1] {
		one, two := s[1], not(s[1], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 4 (s[0] == t[1] || s[1] == t[0])
	if s[0] == t[1] {
		one, two, three := s[1], s[0], t[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}
	if s[1] == t[0] {
		one, two, three := t[1], t[0], s[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	return ""

}

func not(a, b byte) byte {
	if a != 'a' && b != 'a' {
		return 'a'
	}
	if a != 'b' && b != 'b' {
		return 'b'
	}
	return 'c'
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanLines)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

import (
	"bufio"
	"bytes"
	"os"
	"runtime"
	"strconv"
	"strings"
)

/* solution */

func solve() {
	ans := solveOne()
	print("YES")
	print(ans)

}

func solveOne() string {

	n := readInt()
	ss, tt := read(), read()
	s, t := [2]byte{ss[0], ss[1]}, [2]byte{tt[0], tt[1]}

	// case 1 (s[0] == s[1] && s == reverse(t))
	if s[0] != s[1] && s[0] == t[1] && s[1] == t[0] {
		one, two := s[0], not(s[0], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 2.1 (s[0] == s[1])
	if s[0] == s[1] {
		if t[0] < t[1] {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 2.2 (t[0] == t[1])
	if t[0] == t[1] {
		if s[0] < s[1] {
			return strings.Repeat("cba", n)
		}
		return strings.Repeat("abc", n)
	}

	// case 3.1 (s[0] == t[0])
	if s[0] == t[0] {
		two, three := not(s[0], s[0]), s[0]
		one := not(two, three)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 3.2 (s[1] == t[1])
	if s[1] == t[1] {
		one, two := s[1], not(s[1], s[1])
		three := not(one, two)
		return strings.Repeat(string(one), n) + strings.Repeat(string(two), n) + strings.Repeat(string(three), n)
	}

	// case 4 (s[0] == t[1] || s[1] == t[0])
	if s[0] == t[1] {
		one, two, three := s[1], s[0], t[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}
	if s[1] == t[0] {
		one, two, three := t[1], t[0], s[0]
		return strings.Repeat(bytes.NewBuffer([]byte{one, two, three}).String(), n)
	}

	return ""

}

func not(a, b byte) byte {
	if a != 'a' && b != 'a' {
		return 'a'
	}
	if a != 'b' && b != 'b' {
		return 'b'
	}
	return 'c'
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanLines)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

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

func main() {
	io := NewFastIO(os.Stdin, os.Stdout)
	defer io.Flush()
	n := io.NextInt()
	s := io.Next()
	t := io.Next()

	var check func(string) bool
	check = func(S string) bool {
		for i := 0; i < 3*n-1; i++ {
			if S[i:i+2] == t || S[i:i+2] == s {
				return false
			}
		}
		return true
	}

	var perm = []string{"abc", "acb", "bac", "bca", "cab", "cba"}

	for _, v := range perm {
		var T string
		for i := 0; i < n; i++ {
			T += v
		}
		if check(T) {
			io.Println("YES")
			io.Println(T)
			break
		}
	}
}

type FastIO struct {
	*bufio.Reader
	*bufio.Writer
	c [1]byte
}

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

func (f *FastIO) readC() byte {
	f.Read(f.c[:])
	return f.c[0]
}

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) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}

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

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

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f.Writer, 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()
}

package main

import (
	"fmt"
	"strings"
)

const empty = '!'

func solve(n uint32, s1, s2 []rune) (bool, string) {
	const ABC = "abc"

	m := uint32(2)
	if n < m {
		m = n
	}
	l := int64(3 * m)

	count := map[rune]uint32{
		'a': m,
		'b': m,
		'c': m,
	}

	r := make([]rune, l)
	bl := map[rune]map[rune]bool{}

	for _, ch := range [...]rune{'a', 'b', 'c', empty} {
		bl[ch] = map[rune]bool{}
	}

	bl[s1[0]][s1[1]] = true
	bl[s2[0]][s2[1]] = true

	getOptions := func(min, prev rune) rune {
		//TODO: add order

		for _, ch := range ABC {
			if ch >= min && count[ch] > 0 && !bl[prev][ch] {
				return ch
			}
		}

		return empty
	}

	i := int64(0)
	for i >= 0 && i < l {
		prev, s := empty, empty

		if i > 0 {
			prev = r[i-1]
		}

		if r[i] > empty {
			s = r[i] + 1
		}

		found := false
		next := getOptions(s, prev)

		found = next != empty

		if found {
			count[next]--
			r[i] = next
			i++
		} else {
			i--
			if r[i] > empty {
				count[r[i]]++
				if i < l-1 {
					r[i+1] = empty
				}
			}
		}

		//fmt.Println(i, string(r), count)
	}

	if i == 0 {
		return false, ""
	}

	res := string(r)
	if n > m {
		res = strings.Repeat(res, int(n>>1))

		if n%2 > 0 {
			r = []rune{empty, empty, empty}

			count['a'] = 1
			count['b'] = 1
			count['c'] = 1

			for i := 0; i < 3 && i >= 0; {
				prev, s := rune(res[len(res)-1]), empty

				if i > 0 {
					prev = r[i-1]
				}

				if r[i] > empty {
					s = r[i] + 1
				}

				found := false
				next := getOptions(s, prev)

				found = next != empty

				if found {
					count[next]--
					r[i] = next
					i++
				} else {
					i--
					if r[i] > empty {
						count[r[i]]++
						if i < len(r)-1 {
							r[i+1] = empty
						}
					}
				}
			}

			res += string(r)
		}
	}

	return true, res
}

func main() {
	var n uint32
	var s1, s2 string

	fmt.Scan(&n)
	fmt.Scan(&s1, &s2)

	f, res := solve(n, ([]rune)(s1), ([]rune)(s2))

	if f {
		fmt.Println("YES")
		fmt.Println(res)
	} else {
		fmt.Println("NO")
	}
}

package main
import "fmt"
import "os"
import "bufio"

func getc(a, b byte) byte {
    var c byte = byte(3)-(a-byte(97))-(b-byte(97))+byte(97)
    return c
}

func getans(a, b byte, n int) []byte{
    c := getc(a, b)
    var ans []byte
    for i:=1; i<=n; i++ {
        ans = append(ans, a)
    }
    for i:=1; i<=n; i++ {
        ans = append(ans, b)
    }
    for i:=1; i<=n; i++ {
        ans = append(ans, c)
    }
    return ans
}

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

    var n int
    var s,t string
    fmt.Fscanf(input, "%d\n", &n)
    fmt.Fscanf(input, "%s\n%s", &s, &t)

    if t[0]==t[1] {
        s, t = t, s
    }

    var ans []byte
    if s[0]==s[1] {
        if t[0]==t[1] {
            ans = []byte{97, 98, 99}
        } else if s[0]==t[0] {
            ans = []byte{t[0], getc(t[0], t[1]), t[1]}
        } else if s[0]==t[1] {
            ans = []byte{t[1], t[0], getc(t[0], t[1])}
        } else {
            ans = []byte{s[0], t[1], t[0]}
        }
        var tans []byte
        for i:=1; i<=n; i++ {
            tans = append(tans, ans[0], ans[1], ans[2])
        }
        ans = tans
    } else {
        if s[0]==t[0] {
            ans = getans(s[1], getc(s[0], s[1]), n)
        } else if s[1]==t[1] {
            ans = getans(s[0], getc(s[0], s[1]), n)
        } else {
            ans = getans(s[0], getc(s[0], s[1]), n)
        }
    }

    fmt.Printf("YES\n")
    fmt.Println(string(ans))

}