The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes.The main school of the capital is located in $$$(s_x, s_y)$$$. There are $$$n$$$ students attending this school, the $$$i$$$-th of them lives in the house located in $$$(x_i, y_i)$$$. It is possible that some students live in the same house, but no student lives in $$$(s_x, s_y)$$$.After classes end, each student walks from the school to his house along one of the shortest paths. So the distance the $$$i$$$-th student goes from the school to his house is $$$|s_x - x_i| + |s_y - y_i|$$$.The Provision Department of Berland has decided to open a shawarma tent somewhere in the capital (at some point with integer coordinates). It is considered that the $$$i$$$-th student will buy a shawarma if at least one of the shortest paths from the school to the $$$i$$$-th student's house goes through the point where the shawarma tent is located. It is forbidden to place the shawarma tent at the point where the school is located, but the coordinates of the shawarma tent may coincide with the coordinates of the house of some student (or even multiple students).You want to find the maximum possible number of students buying shawarma and the optimal location for the tent itself.

The first line contains three integers $$$n$$$, $$$s_x$$$, $$$s_y$$$ ($$$1 \le n \le 200\,000$$$, $$$0 \le s_x, s_y \le 10^{9}$$$) — the number of students and the coordinates of the school, respectively. Then $$$n$$$ lines follow. The $$$i$$$-th of them contains two integers $$$x_i$$$, $$$y_i$$$ ($$$0 \le x_i, y_i \le 10^{9}$$$) — the location of the house where the $$$i$$$-th student lives. Some locations of houses may coincide, but no student lives in the same location where the school is situated.

The output should consist of two lines. The first of them should contain one integer $$$c$$$ — the maximum number of students that will buy shawarmas at the tent.  The second line should contain two integers $$$p_x$$$ and $$$p_y$$$ — the coordinates where the tent should be located. If there are multiple answers, print any of them. Note that each of $$$p_x$$$ and $$$p_y$$$ should be not less than $$$0$$$ and not greater than $$$10^{9}$$$.

NoteIn the first example, If we build the shawarma tent in $$$(4, 2)$$$, then the students living in $$$(4, 2)$$$, $$$(4, 1)$$$ and $$$(5, 1)$$$ will visit it.In the second example, it is possible to build the shawarma tent in $$$(1, 1)$$$, then both students living in $$$(0, 0)$$$ will visit it.

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n, x, y, xx, yy int
	cnt1 := 0
	cnt2 := 0
	cnt3 := 0
	cnt4 := 0
	fmt.Fscanf(in, "%d %d %d\n", &n, &xx, &yy)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d %d\n", &x, &y)
		if x != xx {
			if xx > x {
				cnt1++
			} else {
				cnt2++
			}
		}
		if y != yy {
			if yy > y {
				cnt3++
			} else {
				cnt4++
			}
		}
	}

	maxx := max(max(cnt1,cnt2), max(cnt3,cnt4))
	fmt.Fprintf(out, "%d\n", maxx)
	if maxx < 0 {
		return
	}
	if maxx == cnt1 {
		fmt.Fprintf(out, "%d %d\n", xx - 1, yy)
		return
	}
	if maxx == cnt2 {
		fmt.Fprintf(out, "%d %d\n", xx + 1, yy)
		return
	}
	if maxx == cnt3 {
		fmt.Fprintf(out, "%d %d\n", xx, yy - 1)
		return
	}
	fmt.Fprintf(out, "%d %d\n", xx, yy + 1)
}

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var n int
var sx, sy int
var X, Y []int

func main() {
	n = ReadInt()
	sx, sy = ReadInt2()

	X, Y = make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		x, y := ReadInt2()
		X[i], Y[i] = x, y
	}

	l, r, u, d := 0, 0, 0, 0
	for i := 0; i < n; i++ {
		x, y := X[i], Y[i]

		if x <= sx-1 {
			l++
		}
		if x >= sx+1 {
			r++
		}
		if y <= sy-1 {
			d++
		}
		if y >= sy+1 {
			u++
		}
	}

	maxi := Max(l, r, u, d)
	fmt.Println(maxi)
	if l == maxi {
		fmt.Println(sx-1, sy)
	} else if r == maxi {
		fmt.Println(sx+1, sy)
	} else if d == maxi {
		fmt.Println(sx, sy-1)
	} else {
		fmt.Println(sx, sy+1)
	}
}

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

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

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

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var n, sx, sy int
var X, Y []int

func main() {
	n, sx, sy = ReadInt3()
	X, Y = make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		x, y := ReadInt2()
		X[i], Y[i] = x, y
	}

	cx, cy := []int{}, []int{}
	for i := 0; i < n; i++ {
		x, y := X[i], Y[i]
		if x == sx {
			cx = append(cx, x)
		} else {
			cx = append(cx, x)
			cx = append(cx, sx)
		}
		if y == sy {
			cy = append(cy, y)
		} else {
			cy = append(cy, y)
			cy = append(cy, sy)
		}
	}

	sort.Sort(sort.IntSlice(cx))
	sort.Sort(sort.IntSlice(cy))

	pcx, pcxCount := RunLengthEncoding(cx)
	pcy, pcyCount := RunLengthEncoding(cy)
	// ちゃんと端っこから数える
	for i := len(pcxCount) - 1; i >= 0; i-- {
		if pcx[i] == sx {
			break
		}
		// 累積和は不要
		if i+1 > len(pcxCount)-1 {
			continue
		}
		pcxCount[i] += pcxCount[i+1]
	}
	for i := 0; i < len(pcxCount); i++ {
		if pcx[i] == sx {
			break
		}
		// 累積和は不要
		if i-1 < 0 {
			continue
		}
		pcxCount[i] += pcxCount[i-1]
	}
	for i := len(pcyCount) - 1; i >= 0; i-- {
		if pcy[i] == sy {
			break
		}
		// 累積和は不要
		if i+1 > len(pcyCount)-1 {
			continue
		}
		pcyCount[i] += pcyCount[i+1]
	}
	for i := 0; i < len(pcyCount); i++ {
		if pcy[i] == sy {
			break
		}
		// 累積和は不要
		if i-1 < 0 {
			continue
		}
		pcyCount[i] += pcyCount[i-1]
	}
	// PrintDebug("pcx: %v\n", pcx)
	// PrintDebug("pcxCount: %v\n", pcxCount)
	// PrintDebug("pcy: %v\n", pcy)
	// PrintDebug("pcyCount: %v\n", pcyCount)

	mx, my := 0, 0
	ansx, ansy := 0, 0
	// sxにx座標を固定
	for i := 0; i < len(pcyCount); i++ {
		if pcy[i] == sy {
			continue
		}
		if mx < pcyCount[i] {
			mx = pcyCount[i]
			ansy = pcy[i]
		}
	}
	// syにy座標を固定
	for i := 0; i < len(pcxCount); i++ {
		if pcx[i] == sx {
			continue
		}
		if my < pcxCount[i] {
			my = pcxCount[i]
			ansx = pcx[i]
		}
	}

	if mx > my {
		// x座標はsx
		fmt.Println(mx)
		fmt.Println(sx, ansy)
	} else {
		// y座標はsy
		fmt.Println(my)
		fmt.Println(ansx, sy)
	}
}

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

// RunLengthEncoding returns encoded slice of an input.
func RunLengthEncoding(S []int) ([]int, []int) {
	runes := []int{}
	lengths := []int{}

	l := 0
	for i := 0; i < len(S); i++ {
		// 1文字目の場合保持
		if i == 0 {
			l = 1
			continue
		}

		if S[i-1] == S[i] {
			// 直前の文字と一致していればインクリメント
			l++
		} else {
			// 不一致のタイミングで追加し、長さをリセットする
			runes = append(runes, S[i-1])
			lengths = append(lengths, l)
			l = 1
		}
	}
	runes = append(runes, S[len(S)-1])
	lengths = append(lengths, l)

	return runes, lengths
}

// RunLengthDecoding decodes RLE results.
func RunLengthDecoding(S []int, L []int) []int {
	if len(S) != len(L) {
		panic("S, L are not RunLengthEncoding results")
	}

	res := []int{}

	for i := 0; i < len(S); i++ {
		for j := 0; j < L[i]; j++ {
			res = append(res, S[i])
		}
	}

	return res
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, sx, sy := 0, 0, 0
	fmt.Fscanf(in, "%d %d %d\n", &n, &sx, &sy)
	w, e, nor, s := 0, 0, 0, 0
	x, y := 0, 0
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d %d\n", &x, &y)
		if x < sx {
			w++
		} else if x > sx {
			e++
		}
		if y < sy {
			s++
		} else if y > sy {
			nor++
		}
	}
	if w >= e && w >= nor && w >= s {
		fmt.Fprintf(out, "%d\n", w)
		fmt.Fprintf(out, "%d %d\n", sx-1, sy)
	} else if e >= w && e >= nor && e >= s {
		fmt.Fprintf(out, "%d\n", e)
		fmt.Fprintf(out, "%d %d\n", sx+1, sy)
	} else if nor >= w && nor >= e && nor >= s {
		fmt.Fprintf(out, "%d\n", nor)
		fmt.Fprintf(out, "%d %d\n", sx, sy+1)
	} else {
		fmt.Fprintf(out, "%d\n", s)
		fmt.Fprintf(out, "%d %d\n", sx, sy-1)
	}
	return
}

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

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 abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func ok(a, b int) bool {
	if min(abs(a-b), abs(a+b)) <= min(abs(a), abs(b)) && max(abs(a+b), abs(a-b)) >= max(abs(a), abs(b)) {
		return true
	}
	return false
}

package main

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

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

// IO helper functions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// IO functions

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

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

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

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

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

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

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

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

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

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

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

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

// Utilities

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

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

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

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

// reverse slice in place
func reverse(a []int) {
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
}

// areverse: allocating reverse
func areverse(a []int) []int {
	b := make([]int, len(a))
	for i := range a {
		b[i] = a[len(a)-i-1]
	}
	return b
}

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

// Simple math functions

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

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

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

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

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

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

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

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

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

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

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

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

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

func main() {
	defer Flush()

	n := readi()
	sx := readi()
	sy := readi()
	var u, d, r, l int
	for i := 0; i < n; i++ {
		x := readi()
		y := readi()
		if x < sx {
			l++
		}
		if sx < x {
			r++
		}
		if y < sy {
			d++
		}
		if sy < y {
			u++
		}
	}
	a := make([][2]int, 4)
	dx := []int{-1, 0, 1, 0}
	dy := []int{0, -1, 0, 1}
	a[0][0] = l
	a[0][1] = 0
	a[1][0] = d
	a[1][1] = 1
	a[2][0] = r
	a[2][1] = 2
	a[3][0] = u
	a[3][1] = 3
	sort.Slice(a, func(i, j int) bool { return a[i][0] > a[j][0] })
	i := a[0][1]
	println(a[0][0])
	println(sx+dx[i], sy+dy[i])
}

package main

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

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

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

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var n int
var sx, sy int
var X, Y []int

func main() {
	n = ReadInt()
	sx, sy = ReadInt2()

	X, Y = make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		x, y := ReadInt2()
		X[i], Y[i] = x, y
	}

	l, r, u, d := 0, 0, 0, 0
	for i := 0; i < n; i++ {
		x, y := X[i], Y[i]

		if x <= sx-1 {
			l++
		}
		if x >= sx+1 {
			r++
		}
		if y <= sy-1 {
			d++
		}
		if y >= sy+1 {
			u++
		}
	}

	maxi := Max(l, r, u, d)
	fmt.Println(maxi)
	if l == maxi {
		fmt.Println(sx-1, sy)
	} else if r == maxi {
		fmt.Println(sx+1, sy)
	} else if u == maxi {
		fmt.Println(sx, sy-1)
	} else {
		fmt.Println(sx, sy+1)
	}
}

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

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

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

package main

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

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

// IO helper functions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// IO functions

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

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

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

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

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

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

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

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

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

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

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

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

// Utilities

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

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

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

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

// reverse slice in place
func reverse(a []int) {
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
}

// areverse: allocating reverse
func areverse(a []int) []int {
	b := make([]int, len(a))
	for i := range a {
		b[i] = a[len(a)-i-1]
	}
	return b
}

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

// Simple math functions

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

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

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

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

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

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

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

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

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

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

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

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

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

func main() {
	defer Flush()

	n := readi()
	sx := readi()
	sy := readi()
	var u, d, r, l int
	for i := 0; i < n; i++ {
		x := readi()
		y := readi()
		if x < sx {
			l++
		}
		if sx < x {
			r++
		}
		if y < sy {
			d++
		}
		if sy < y {
			u++
		}
	}
	a := make([][2]int, 4)
	dx := []int{-1, 0, 1, 0}
	dy := []int{0, -1, 0, 1}
	a[0][0] = l
	a[0][1] = 0
	a[1][0] = d
	a[1][1] = 1
	a[2][0] = r
	a[2][1] = 2
	a[3][0] = u
	a[3][1] = 3
	sort.Slice(a, func(i, j int) bool { return a[i][0] > a[j][0] })
	i := a[0][1]
	println(sx+dx[i], sy+dy[i])
}


George decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer bi.To make the round good, he needs to put at least n problems there. Besides, he needs to have at least one problem with complexity exactly a1, at least one with complexity exactly a2, ..., and at least one with complexity exactly an. Of course, the round can also have problems with other complexities.George has a poor imagination. It's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. George is magnificent at simplifying problems. He can simplify any already prepared problem with complexity c to any positive integer complexity d (c ≥ d), by changing limits on the input data.However, nothing is so simple. George understood that even if he simplifies some problems, he can run out of problems for a good round. That's why he decided to find out the minimum number of problems he needs to come up with in addition to the m he's prepared in order to make a good round. Note that George can come up with a new problem of any complexity.

The first line contains two integers n and m (1 ≤ n, m ≤ 3000) — the minimal number of problems in a good round and the number of problems George's prepared. The second line contains space-separated integers a1, a2, ..., an (1 ≤ a1 < a2 < ... < an ≤ 106) — the requirements for the complexity of the problems in a good round. The third line contains space-separated integers b1, b2, ..., bm (1 ≤ b1 ≤ b2... ≤ bm ≤ 106) — the complexities of the problems prepared by George.

Print a single integer — the answer to the problem.

NoteIn the first sample the set of the prepared problems meets the requirements for a good round.In the second sample, it is enough to come up with and prepare two problems with complexities 2 and 3 to get a good round.In the third sample it is very easy to get a good round if come up with and prepare extra problems with complexities: 2, 3, 4.

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

func main() {
	var n,m,i,j int
	fmt.Scan(&n,&m)
	a:=make([]int,n)
	b:=make([]int,m)
	for i=0;i<n;i++ {
		fmt.Scan(&a[i])
	}
	for i=0;i<m;i++ {
		fmt.Scan(&b[i])
	}
	for i,j=0,0; i<n && j<m;j++ {
		if b[j]>=a[i] {
			i++
		}
	}
	n-=i
	fmt.Println(n)
}

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

func main(){
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	nm := strings.Split(scanner.Text()," ")
	scanner.Scan()
	a := strings.Split(scanner.Text()," ")
	scanner.Scan()
	b := strings.Split(scanner.Text()," ")
	demA := 0
	// demB := 0
	n,_ := strconv.Atoi(nm[0])
	m,_ := strconv.Atoi(nm[1])
	for i := 0; i < m; i++{
		if demA == n{
			break
		}
		intB,_ := strconv.Atoi(b[i])
		intA,_ := strconv.Atoi(a[demA])
		if intB >= intA{
			demA += 1
		}
		// demB += 1
	}
	fmt.Println(n - demA)
}

package main

import (
	"fmt"
)

func main() {

	var (
		n, m, i, j int32
		a, b       [3006]int32
	)

	fmt.Scan(&n)
	fmt.Scan(&m)
	for i = 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	for i = 0; i < m; i++ {
		fmt.Scan(&b[i])
	}

	i, j = 0, 0
	for i < n && j < m {
		if a[i] <= b[j] {
			i, j = i+1, j+1
		} else {
			j = j + 1
		}

	}

	fmt.Println(n - i)

}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var n,m int
    fmt.Scan(&n,&m)
    a, b := make([]int,n), make([]int,m)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    for i := 0; i < m; i++ { fmt.Scan(&b[i]) }
    sort.Ints(a)
    sort.Ints(b)
    ib, ans := 0, 0
    for ia := 0; ia < n; ia++ {
        if ib >= m {
            ans++
        } else {
            for b[ib] < a[ia] {
                ib++
                if ib == m { ans++; break }
            }
            ib++
        }
    }
    fmt.Println(ans)
}

// 387B-mic
package main

import (
	"fmt"
)

func main() {
	var n, m int					// variabel n, m dengan jenis int
	var a, b [3005]int				// variabel a dan b [3005] jenis int
	fmt.Scan(&n, &m)				// mengambil input
	for i := 0; i < n; i++ {		// looping
		fmt.Scan(&a[i])				// mengambil input
	}
	for i := 0; i < m; i++ {		// looping kedua
		fmt.Scan(&b[i])				// mengambil input
	}
	be := n							// variabel be diisi dengan n
	if be > m {						// jika be lebih dari m
		be = m					    // be sama dengan m
	}
	for i := be; i >= 0; i-- {		// looping ketiga
		ok := true					// variabel ok diisi dengan true
		for j := 0; j < i; j++ {	// looping keempat
			if a[j] > b[m-i+j] {	// jika a[j] lebih dari  b[m-i+j]
				ok = false			// ok sama dengan false
			}
		}
		if ok {						// jika ok
			fmt.Println(n - i)		//cetak hasil n - i
			return					// kembali ke fungsi awal
		}
	}
}

package main

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

func solve(required []int, have []int, lenR int, lenH int) int {
	i, j := 0, 0

	for i < lenH {
		for j < lenR && i < lenH && required[j] > have[i] {
			i++
		}
		if j < lenR && i < lenH && required[j] <= have[i] {
			j++
		}
		i++
	}

	return lenR - j
}

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

	var n, m int

	fmt.Fscanf(r, "%d %d\n", &n, &m)

	required := make([]int, n)
	have := make([]int, m)

	for i := range required {
		if i == n-1 {
			fmt.Fscanf(r, "%d\n", &required[i])
		} else {
			fmt.Fscanf(r, "%d", &required[i])
		}
	}

	for i := range have {
		fmt.Fscanf(r, "%d ", &have[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(required, have, n, m))
}

package main

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

func solve(required []int, have []int, lenR int, lenH int) int {
	i, j := 0, 0

	for i < lenH {
		if j < lenR && i < lenH && required[j] <= have[i] {
			j++
		}
		i++
	}

	return lenR - j
}

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

	var n, m int

	fmt.Fscanf(r, "%d %d\n", &n, &m)

	required := make([]int, n)
	have := make([]int, m)

	for i := range required {
		if i == n-1 {
			fmt.Fscanf(r, "%d\n", &required[i])
		} else {
			fmt.Fscanf(r, "%d", &required[i])
		}
	}

	for i := range have {
		fmt.Fscanf(r, "%d ", &have[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(required, have, n, m))
}

package main

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

func solve(required []int, have []int, n int, m int) int {
	i, j := 0, 0

	for i < m {
		for j < n && i < m-1 && required[j] > have[i] {
			i++
		}
		if j < n && i < m && required[j] <= have[i] {
			j++
		}
		i++
	}

	return n - j
}

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

	var n, m int

	fmt.Fscanf(r, "%d %d\n", &n, &m)

	required := make([]int, n)
	have := make([]int, m)

	for i := range required {
		if i == n-1 {
			fmt.Fscanf(r, "%d\n", &required[i])
		} else {
			fmt.Fscanf(r, "%d", &required[i])
		}
	}

	for i := range have {
		fmt.Fscanf(r, "%d ", &have[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(required, have, n, m))
}

package main

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

func solve(required []int, have []int, lenR int, lenH int) int {
	j := 0

	for i := 0; i < lenH; i++ {
		if j < lenR && i < lenH && required[j] <= have[i] {
			j++
		}
	}

	return lenR - j
}

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

	var n, m int

	fmt.Fscanf(r, "%d %d\n", &n, &m)

	required := make([]int, n)
	have := make([]int, m)

	for i := range required {
		if i == n-1 {
			fmt.Fscanf(r, "%d\n", &required[i])
		} else {
			fmt.Fscanf(r, "%d", &required[i])
		}
	}

	for i := range have {
		fmt.Fscanf(r, "%d ", &have[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(required, have, n, m))
}

// 387B-mic
package main

import (
    "fmt"
)

func main() {
    var n, m int
    var a, b [3005]int
    fmt.Scan(&n, &m)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }
    for i := 0; i < m; i++ {
        fmt.Scan(&b[i])
    }
    be := n
    if be > m {
        be = m
    }
    for i := be; i >= 0; i-- {
        ok := true
        for j := 0; j < i; j++ {
            if a[j] > b[m-i+j] {
                ok = false
            }
        }
        if ok {
            fmt.Println(n - i)
            return
        }
    }
}

//http://codeforces.com/problemset/problem/387/B

package main

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

func main() {
	reader := NewStdReader(os.Stdin)
	n, m := reader.ReadInt(), reader.ReadInt()

	a := make([]int, 3000)
	for i := 0; i < n; i++ {
		a[i] = reader.ReadInt()
	}

	ai := 0
	for i := 0; i < m; i++ {
		b := reader.ReadInt()
		if b >= a[ai] {
			ai++
			if ai == n {
				fmt.Print(0)
				return
			}
		}
	}

	c := n - ai
	fmt.Print(c)
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 2*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var n,m int
    fmt.Scan(&n,&m)
    a, b := make([]int,n), make([]int,m)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    for i := 0; i < m; i++ { fmt.Scan(&b[i]) }
    sort.Ints(a)
    sort.Ints(b)
    ib, ans := 0, 0
    for ia := 0; ia < n; ia++ {
        if ib == m {
            ans++
        } else {
            for b[ib] < a[ia] {
                ib++
                if ib == m { ans++; break }
            }
        }
    }
    fmt.Println(ans)
}

package main

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

func solve(required []int, have []int, lenR int, lenH int) int {
	i, j := 0, 0

	for i < lenH {
		for i < lenH && required[j] > have[i] {
			i++
		}
		if j < lenR-1 && i < lenH && required[j] <= have[i] {
			j++
		}
		i++
	}

	return lenR - j
}

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

	var n, m int

	fmt.Fscanf(r, "%d %d\n", &n, &m)

	required := make([]int, n)
	have := make([]int, m)

	for i := range required {
		if i == n-1 {
			fmt.Fscanf(r, "%d\n", &required[i])
		} else {
			fmt.Fscanf(r, "%d", &required[i])
		}
	}

	for i := range have {
		fmt.Fscanf(r, "%d ", &have[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(required, have, n, m))
}

// 387B-mic
package main

import (
    "fmt"
)

func main() {
    var n, m int
    var a, b [3005]int
    fmt.Scan(&n, &m)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }
    for i := 0; i < m; i++ {
        fmt.Scan(&b[i])
    }
    be := n
    if be > m {
        be = m
    }
    for i := be; i >= 0; i-- {
        ok := true
        for j := 0; j < i; j++ {
            if a[j] > b[m-i+j] {
                ok = false
            }
            if ok {
                fmt.Println(n - i)
                return
            }
        }
    }
}

//http://codeforces.com/problemset/problem/387/B

package main

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

func main() {
	reader := NewStdReader(os.Stdin)
	n, m := reader.ReadInt(), reader.ReadInt()

	a := map[int]bool{}
	for i := 0; i < n; i++ {
		a[reader.ReadInt()] = false
	}

	for i := 0; i < m; i++ {
		a[reader.ReadInt()] = true
	}

	c := 0
	for _, v := range a {
		if !v {
			c++
		}
	}
	fmt.Print(c)
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 2*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}

//http://codeforces.com/problemset/problem/387/B

package main

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

func main() {
	reader := NewStdReader(os.Stdin)
	n, m := reader.ReadInt(), reader.ReadInt()

	a := make([]int, 3000)
	for i := 0; i < n; i++ {
		a[i] = reader.ReadInt()
	}

	ai := 0
	for i := 0; i < m; i++ {
		b := reader.ReadInt()
		if b >= a[ai] {
			ai++
			if ai == n-1 {
				fmt.Print(0)
				return
			}
		}
	}

	c := n - ai
	fmt.Print(c)
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 2*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}


Vasya plays the Need For Brake. He plays because he was presented with a new computer wheel for birthday! Now he is sure that he will win the first place in the championship in his favourite racing computer game! n racers take part in the championship, which consists of a number of races. After each race racers are arranged from place first to n-th (no two racers share the same place) and first m places are awarded. Racer gains bi points for i-th awarded place, which are added to total points, obtained by him for previous races. It is known that current summary score of racer i is ai points. In the final standings of championship all the racers will be sorted in descending order of points. Racers with an equal amount of points are sorted by increasing of the name in lexicographical order.Unfortunately, the championship has come to an end, and there is only one race left. Vasya decided to find out what the highest and lowest place he can take up as a result of the championship.

The first line contains number n (1 ≤ n ≤ 105) — number of racers. Each of the next n lines contains si and ai — nick of the racer (nonempty string, which consist of no more than 20 lowercase Latin letters) and the racer's points (0 ≤ ai ≤ 106). Racers are given in the arbitrary order. The next line contains the number m (0 ≤ m ≤ n). Then m nonnegative integer numbers bi follow. i-th number is equal to amount of points for the i-th awarded place (0 ≤ bi ≤ 106). The last line contains Vasya's racer nick.

Output two numbers — the highest and the lowest place Vasya can take up as a result of the championship.

3
teama 10
teamb 20
teamc 40
2
10 20
teama

package main

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

var scanner *bufio.Scanner

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

type Racer struct {
  Name string
  Points int
}
func (racer Racer) String() string {
  return fmt.Sprintf("%s:%d", racer.Name, racer.Points)
}
type Racers []*Racer
func (racers Racers) Len() int {
  return len(racers)
}
func (racers Racers) Swap(i, j int) {
  racers[i], racers[j] = racers[j], racers[i]
}
func (racers Racers) Less(i, j int) bool {
  a, b := racers[i], racers[j]
  return a.Points > b.Points || (a.Points == b.Points && a.Name < b.Name)
}

func find(racers Racers, name string) int {
  for i, racer := range racers {
    if racer.Name == name {
      return i
    }
  }
  return -1
}

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

  n := getI()
  best := make([]*Racer, n)
  worst := make([]*Racer, n)
  for i := 0; i < n; i++ {
    name, points := getS(), getI()
    best[i] = &Racer{ name, points }
    worst[i] = &Racer{ name, points }
  }
  m := getI()
  placeBonus := make([]int, m)
  for i := 0; i < m; i++ {
    placeBonus[i] = getI()
  }
  sort.Sort(sort.Reverse(sort.IntSlice(placeBonus)))
  yourName := getS()

  //--- Worst possible ranking

  // You get the biggest bonus.
  youPos := find(best, yourName)
  if m != 0 {
    best[youPos].Points += placeBonus[0]
  }
  sort.Sort(Racers(best))

  // People ahead of you get the next biggest bonuses.
  bonusPos := 1 + find(best, yourName)

  // The remaining bonuses go to the end of the list.
  for rank := n - 1; bonusPos < m; rank-- {
    best[rank].Points += placeBonus[bonusPos]
    bonusPos++
  }
  sort.Sort(Racers(best))
  //fmt.Println(best)

  //--- Best possible ranking

  // If you must get a bonus, it's the smallest one.
  you := worst[find(worst, yourName)]
  if m == n {
    you.Points += placeBonus[m - 1]
    placeBonus = placeBonus[:m - 1]
    m--
  }
  sort.Sort(Racers(worst))

  // Award minimal bonuses to racers who can overtake you.
  bonusPos = m - 1
  for rank := find(worst, yourName) + 1; rank < n && bonusPos >= 0; bonusPos-- {
    candidate := worst[rank]
    need := you.Points - candidate.Points
    if candidate.Name > you.Name {
      need++
    }
    if placeBonus[bonusPos] >= need {
      candidate.Points += placeBonus[bonusPos]
      rank++
    }
  }
  sort.Sort(Racers(worst))
  //fmt.Println(worst)

  writer.WriteString(fmt.Sprintf("%d %d\n",
      find(best, yourName) + 1, find(worst, yourName) + 1))
}


Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves:  Extract the first character of s and append t with this character.  Extract the last character of t and append u with this character. Petya wants to get strings s and t empty and string u lexicographically minimal.You should write a program that will help Petya win the game.

First line contains non-empty string s (1 ≤ |s| ≤ 105), consisting of lowercase English letters.

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 512*1024), 512*1024)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()

	s := scanner.Text()
	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		var k int
		for k = 0; k < len(t[i]) && t[i][k] < j; k++ {
		}
		for ; k < len(t[i]); k++ {
			res += string(i + 97)
			for f := j; f < t[i][k]; f++ {
				buffer = append(buffer, int(s[f])-97)
			}
			j = t[i][k] + 1
		}
	}
	for q := range buffer {
		res += string(buffer[len(buffer)-1-q] + 97)
	}
	fmt.Println(res)
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 512*1024), 512*1024)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()

	s := scanner.Text()
	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		cur := getMin(t[i], j)
		for cur != -1 {
			res += string(i + 97)
			for k := j; k < cur; k++ {
				buffer = append(buffer, int(s[k])-97)
			}
			j = cur + 1
			cur = getMin(t[i], j)
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

func getMin(x []int, min int) int {
	if len(x) == 0 {
		return -1
	}
	l := 0
	r := len(x) - 1
	for l < r {
		mid := (l + r) / 2
		if x[mid] < min {
			l = mid + 1
		} else {
			r = mid
		}
	}
	if x[l] < min {
		return -1
	}
	return x[l]
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 512*1024), 512*1024)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()

	s := scanner.Text()
	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		var k int
		for k = 0; k < len(t[i]) && t[i][k] < j; k++ {
		}
		for ; k < len(t[i]); k++ {
			res += string(i + 97)
			for f := j; f < t[i][k]; f++ {
				buffer = append(buffer, int(s[f])-97)
			}
			j = t[i][k] + 1
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

package main

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

func solve() {
	a := readString()
	b := []byte(a)
	N := len(a)
	suffix := make([]byte, N)
	suffix[N-1] = b[N-1]
	for i := N - 2; i >= 0; i-- {
		if b[i] < suffix[i+1] {
			suffix[i] = b[i]
		} else {
			suffix[i] = suffix[i+1]
		}
	}
	res := make([]byte, 0)
	buf := make([]byte, 0)
	for i := 0; i < N; i++ {
		if b[i] <= suffix[i] {
			for len(buf) > 0 && (buf[len(buf)-1] <= b[i]) {
				res = append(res, buf[len(buf)-1])
				buf = buf[:len(buf)-1]
			}
			res = append(res, b[i])
		} else {
			for len(buf) > 0 && (buf[len(buf)-1] < b[i] && buf[len(buf)-1] <= suffix[i]) {
				res = append(res, buf[len(buf)-1])
				buf = buf[:len(buf)-1]
			}
			buf = append(buf, b[i])
		}
	}
	for i := 0; i < len(buf); i++ {
		res = append(res, buf[len(buf)-i-1])
	}
	fmt.Println(string(res))
}

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 int) int {
	if a > b {
		return a
	}
	return b
}

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

type ByLen []string

func (a ByLen) Len() int           { return len(a) }
func (a ByLen) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByLen) Less(i, j int) bool { return len(a[i]) > len(a[j]) }

package main

import (
	"fmt"
)

func main() {
	totalLen, counterResult, counterTotal, counterCompare := 0,0,0,0
	inputString := ""
	e := []byte{124}
	fmt.Scanf("%s", &inputString)
	totalLen = len(inputString)

	compareString := make([]byte, totalLen+1, totalLen+1)
	resultString := make([]byte, totalLen+1, totalLen+1)

	compareString[totalLen] = e[0]

	for i := totalLen -1;i>-1; i-- {
		compareString[i] = min(compareString[i + 1], inputString[i])
	}

	for counterTotal < totalLen {
		if len(inputString)< counterCompare || len(resultString)< counterResult {
			break
		}
		resultString[counterResult] = inputString[counterCompare]
		counterResult++
		counterCompare++
		for counterResult >0 && resultString[counterResult-1] <= compareString[counterCompare] {
			//fmt.Print("in")
			counterResult--
			fmt.Print(string(resultString[counterResult]))
			counterTotal++
		}
	}
	fmt.Print("\n")
}

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

package main

import (
	"fmt"
)

func main() {
	totalLen, counterResult, counterTotal, counterCompare := 0,0,0,0
	inputString := ""
	compareString := [100001]byte{}
	resultString := [100001]byte{}
	e := []byte{124}
	fmt.Scanf("%s", &inputString)
	totalLen = len(inputString)
	compareString[totalLen] = e[0]

	for i := totalLen -1;i>-1; i-- {
		compareString[i] = min(compareString[i + 1], inputString[i])
	}

	for counterTotal < totalLen {
		if len(inputString)< counterCompare || len(resultString)< counterResult {
			break
		}
		resultString[counterResult] = inputString[counterCompare]
		counterResult++
		counterCompare++
		for counterResult >0 && resultString[counterResult-1] <= compareString[counterCompare] {
			//fmt.Print("in")
			counterResult--
			fmt.Print(string(resultString[counterResult]))
			counterTotal++
		}
	}
	fmt.Print("\n")
}

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

package main

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

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

	// fmt.Println(getMin([]int{0,4}, 0))
	s := scanner.Text()

	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		cur := getMin(t[i], j)
		for cur != -1 {
			res += string(i + 97)
			for k := j; k < len(s) && k < cur; k++ {
				buffer = append(buffer, int(s[k])-97)
			}
			j = cur + 1
			cur = getMin(t[i], j)
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

func getMin(x []int, min int) int {
	if len(x) == 0 {
		return -1
	}
	l := 0
	r := len(x) - 1
	for l < r {
		mid := (l + r) / 2
		if x[mid] < min {
			l = mid + 1
		} else {
			r = mid
		}
	}
	if x[l] < min {
		return -1
	}
	return x[l]
}

package main

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

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

	// fmt.Println(getMin([]int{0,4}, 0))
	s := scanner.Text()

	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		cur := getMin(t[i], j)
		for cur != -1 {
			for k := j; k < len(s) && k < cur; k++ {
				buffer = append(buffer, int(s[k])-97)
			}
			res += string(i + 97)
			j = cur + 1
			cur = getMin(t[i], j)
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

func getMin(x []int, min int) int {
	if len(x) == 0 {
		return -1
	}
	l := 0
	r := len(x) - 1
	for l < r {
		mid := (l + r) / 2
		if x[mid] < min {
			l = mid + 1
		} else {
			r = mid
		}
	}
	if x[l] < min {
		return -1
	}
	return x[l]
}

package main

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

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

	// fmt.Println(getMin([]int{0,4}, 0))
	s := scanner.Text()

	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] == i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		cur := getMin(t[i], j)
		for cur != -1 {
			for k := j; k < len(s) && k < cur; k++ {
				buffer = append(buffer, int(s[k])-97)
			}
			res += string(i + 97)
			j = cur + 1
			cur = getMin(t[i], j)
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

func getMin(x []int, min int) int {
	if len(x) == 0 {
		return -1
	}
	l := 0
	r := len(x) - 1
	for l < r {
		mid := (l + r) / 2
		if x[mid] < min {
			l = mid + 1
		} else {
			r = mid
		}
	}
	if x[l] < min {
		return -1
	}
	return x[l]
}

package main

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

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

	// fmt.Println(getMin([]int{0,4}, 0))
	s := scanner.Text()

	t := make([][]int, 26)
	res := ""
	buffer := []int{}

	for i, el := range s {
		t[el-97] = append(t[el-97], i)
	}

	j := 0
	for i := 0; i < 26; i++ {
		for len(buffer) != 0 && buffer[len(buffer)-1] <= i {
			res += string(buffer[len(buffer)-1] + 97)
			buffer = buffer[0 : len(buffer)-1]
		}
		cur := getMin(t[i], j)
		for cur != -1 {
			res += string(i + 97)
			for k := j; k < cur; k++ {
				buffer = append(buffer, int(s[k])-97)
			}
			j = cur + 1
			cur = getMin(t[i], j)
		}
	}
	for i := range buffer {
		res += string(buffer[len(buffer)-1-i] + 97)
	}
	fmt.Println(res)
}

func getMin(x []int, min int) int {
	if len(x) == 0 {
		return -1
	}
	l := 0
	r := len(x) - 1
	for l < r {
		mid := (l + r) / 2
		if x[mid] < min {
			l = mid + 1
		} else {
			r = mid
		}
	}
	if x[l] < min {
		return -1
	}
	return x[l]
}

package main

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

func solve() {
	a := readString()
	b := []byte(a)
	suffix := make([]byte, len(a))
	suffix[len(suffix)-1] = b[len(suffix)-1]
	for i := len(suffix) - 2; i >= 0; i-- {
		if b[i] < suffix[i+1] {
			suffix[i] = b[i]
		} else {
			suffix[i] = suffix[i+1]
		}
	}
	res := make([]byte, 0)
	buf := make([]byte, 0)
	for i := 0; i < len(b); i++ {
		if b[i] <= suffix[i] {
			res = append(res, b[i])
		} else {
			buf = append(buf, b[i])
		}
	}
	for i := 0; i < len(buf); i++ {
		res = append(res, buf[len(buf)-i-1])
	}
	fmt.Println(string(res))
}

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 int) int {
	if a > b {
		return a
	}
	return b
}

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

type ByLen []string

func (a ByLen) Len() int           { return len(a) }
func (a ByLen) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByLen) Less(i, j int) bool { return len(a[i]) > len(a[j]) }

package main

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

func solve() {
	a := readString()
	b := []byte(a)
	N := len(a)
	suffix := make([]byte, N)
	suffix[N-1] = b[N-1]
	for i := N - 2; i >= 0; i-- {
		if b[i] < suffix[i+1] {
			suffix[i] = b[i]
		} else {
			suffix[i] = suffix[i+1]
		}
	}
	res := make([]byte, 0)
	buf := make([]byte, 0)
	for i := 0; i < N; i++ {
		if b[i] <= suffix[i] {
			for len(buf) > 0 && buf[len(buf)-1] <= b[i] {
				res = append(res, buf[len(buf)-1])
				buf = buf[:len(buf)-1]
			}
			res = append(res, b[i])
		} else {
			buf = append(buf, b[i])
		}
	}
	for i := 0; i < len(buf); i++ {
		res = append(res, buf[len(buf)-i-1])
	}
	fmt.Println(string(res))
}

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 int) int {
	if a > b {
		return a
	}
	return b
}

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

type ByLen []string

func (a ByLen) Len() int           { return len(a) }
func (a ByLen) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByLen) Less(i, j int) bool { return len(a[i]) > len(a[j]) }

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	s := "acdb"
	str := strings.Split(s, "")
	sort.Strings(str)
	fmt.Println(strings.Join(str, ""))
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	s := ""
	fmt.Scanf("%s", &s)
	str := strings.Split(s, "")
	sort.Strings(str)
	fmt.Println(strings.Join(str, ""))
}


Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist an integer point, that belongs each of segments in the picture. Having discovered this fact, Teodor decided to share it with Sasha.Sasha knows that Teodor likes to show off so he never trusts him. Teodor wants to prove that he can be trusted sometimes, so he decided to convince Sasha that there is no such integer point in his picture, which belongs to each segment. However Teodor is lazy person and neither wills to tell Sasha all coordinates of segments' ends nor wills to tell him their amount, so he suggested Sasha to ask him series of questions 'Given the integer point xi, how many segments in Fedya's picture contain that point?', promising to tell correct answers for this questions.Both boys are very busy studying and don't have much time, so they ask you to find out how many questions can Sasha ask Teodor, that having only answers on his questions, Sasha can't be sure that Teodor isn't lying to him. Note that Sasha doesn't know amount of segments in Teodor's picture. Sure, Sasha is smart person and never asks about same point twice.

First line of input contains two integer numbers: n and m (1 ≤ n, m ≤ 100 000) — amount of segments of Teodor's picture and maximal coordinate of point that Sasha can ask about. ith of next n lines contains two integer numbers li and ri (1 ≤ li ≤ ri ≤ m) — left and right ends of ith segment in the picture. Note that that left and right ends of segment can be the same point. It is guaranteed that there is no integer point, that belongs to all segments.

Single line of output should contain one integer number k – size of largest set (xi, cnt(xi)) where all xi are different, 1 ≤ xi ≤ m, and cnt(xi) is amount of segments, containing point with coordinate xi, such that one can't be sure that there doesn't exist point, belonging to all of segments in initial picture, if he knows only this set(and doesn't know n).

NoteFirst example shows situation where Sasha can never be sure that Teodor isn't lying to him, because even if one knows cnt(xi) for each point in segment [1;4], he can't distinguish this case from situation Teodor has drawn whole [1;4] segment.In second example Sasha can ask about 5 points e.g. 1, 2, 3, 5, 6, still not being sure if Teodor haven't lied to him. But once he knows information about all points in [1;6] segment, Sasha can be sure that Teodor haven't lied to him.

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int {
	if !in.Scan() {
		panic(in.Err())
	}
	res := 0
	for _, b := range in.Bytes() {
		res = res*10 + int(b-'0')
	}
	return res
}

func maxNonDec(seq []int) []int {
	ret := make([]int, len(seq)+1)
	m := make([]int, len(seq)+1)
	for i := 1; i < len(m); i++ {
		m[i] = math.MaxInt32
	}
	for i := range seq {
		lo := 0
		hi := i
		for lo < hi {
			mi := (lo + hi + 1) / 2
			if m[mi] <= seq[i] {
				lo = mi
			} else {
				hi = mi - 1
			}
		}
		ret[i+1] = ret[i]
		if ret[i+1] < lo+1 {
			ret[i+1] = lo + 1
		}
		if m[lo+1] > seq[i] {
			m[lo+1] = seq[i]
		}
	}
	return ret
}

func main() {
	in.Split(bufio.ScanWords)

	n := readInt()
	m := readInt()
	start := make([]int, n)
	end := make([]int, n)
	for i := range start {
		start[i] = readInt() - 1
		end[i] = readInt()
	}
	sort.Ints(start)
	sort.Ints(end)
	seq := make([]int, m)
	cur := 0
	for i := range seq {
		for len(start) > 0 && start[0] == i {
			cur++
			start = start[1:]
		}
		for len(end) > 0 && end[0] == i {
			cur--
			end = end[1:]
		}
		seq[i] = cur
	}

	pref := maxNonDec(seq)
	for i := range seq[:m/2] {
		seq[i], seq[m-1-i] = seq[m-1-i], seq[i]
	}
	suff := maxNonDec(seq)

	ans := 0
	for i := range pref {
		if cur := pref[i] + suff[m-i]; ans < cur {
			ans = cur
		}
	}
	fmt.Println(ans)
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int {
	if !in.Scan() {
		panic(in.Err())
	}
	res := 0
	for _, b := range in.Bytes() {
		res = res*10 + int(b-'0')
	}
	return res
}

func reverse(numbers []int, m int) {
	for i, j := 0, m-1; i < j; i, j = i+1, j-1 {
		numbers[i], numbers[j] = numbers[j], numbers[i]
	}
}

func dp(f []int, value []int, m int) {
	v := make([]int, m+1)
	for i := range v {
		v[i] = 2147483647
	}
	v[0] = 0

	for i := 0; i < m; i++ {
		f[i] = sort.Search(len(v), func(k int) bool { return v[k] > value[i] })
		if v[f[i]] > value[i] {
			v[f[i]] = value[i]
		}
	}
}

func main() {
	in.Split(bufio.ScanWords)
	n := readInt()
	m := readInt()
	value := make([]int, m+1)
	for i := 0; i < n; i++ {
		x := readInt()
		y := readInt()
		value[x-1]++
		value[y]--
	}

	for i := 1; i < m; i++ {
		value[i] += value[i-1]
	}

	f1 := make([]int, m)
	dp(f1, value, m)

	reverse(value, m)

	f2 := make([]int, m)
	dp(f2, value, m)

	ans := 0
	for i := 0; i < m; i++ {
		now := f1[i] + f2[m-i-1] - 1
		if ans < now {
			ans = now
		}
	}

	fmt.Printf("%d\n", ans)
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"sort"
)

func binarySearch(a []int, target, left, right int) int {
	if left > right {
		return -1
	} else {
		mid := (left + right) / 2
		if a[mid] <= target {
			return binarySearch(a, target, mid + 1, right)
		} else {
			ans := binarySearch(a, target, left, mid - 1)
			if ans != -1 {
				return ans
			} else {
				return mid
			}
		}
	}
}

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	l := make([]int, n)
	r := make([]int, n)
	seg := make([]int, m)
	for i := 0;i < n;i ++ {
		fmt.Fscanf(reader, "%d %d\n", &l[i], &r[i])
		l[i] --
		r[i] --
	}
	sort.Ints(l)
	sort.Ints(r)

	count, lp, rp := 0, 0, 0
	for i := 0;i < m;i ++ {
		for ;lp < n && l[lp] == i;lp ++ {
			count ++
		}
		seg[i] = count
		for ;rp < n && r[rp] == i; rp ++ {
			count --
		}
	}

	leftdp := make([]int, m)
	rightdp := make([]int, m)
	leftstack := make([]int, 0, n)
	rightstack := make([]int, 0, n)
	for i := 0;i < m;i ++ {
		if len(leftstack) == 0 || seg[i] >= leftstack[len(leftstack) - 1] {
			leftstack = append(leftstack, seg[i])
			leftdp[i] = len(leftstack)
		} else {
			pos := binarySearch(leftstack, seg[i], 0, len(leftstack) - 1)
			leftstack[pos] = seg[i]
			leftdp[i] = pos + 1
		}
	}

	for i := m - 1;i >= 0;i -- {
		if len(rightstack) == 0 || seg[i] >= rightstack[len(rightstack) - 1] {
			rightstack = append(rightstack, seg[i])
			rightdp[i] = len(rightstack)
		} else {
			pos := binarySearch(rightstack, seg[i], 0, len(rightstack) - 1)
			rightstack[pos] = seg[i]
			rightdp[i] = pos + 1
		}
	}

	max := -1
	for i := 0;i < m;i ++ {
		if leftdp[i] + rightdp[i] - 1 > max {
			max = leftdp[i] + rightdp[i] - 1
		}
	}
	fmt.Printf("%d", max)

}


The sequence of integers $$$a_1, a_2, \dots, a_k$$$ is called a good array if $$$a_1 = k - 1$$$ and $$$a_1 > 0$$$. For example, the sequences $$$[3, -1, 44, 0], [1, -99]$$$ are good arrays, and the sequences $$$[3, 7, 8], [2, 5, 4, 1], [0]$$$ — are not.A sequence of integers is called good if it can be divided into a positive number of good arrays. Each good array should be a subsegment of sequence and each element of the sequence should belong to exactly one array. For example, the sequences $$$[2, -3, 0, 1, 4]$$$, $$$[1, 2, 3, -3, -9, 4]$$$ are good, and the sequences $$$[2, -3, 0, 1]$$$, $$$[1, 2, 3, -3 -9, 4, 1]$$$ — are not.For a given sequence of numbers, count the number of its subsequences that are good sequences, and print the number of such subsequences modulo 998244353.

The first line contains the number $$$n~(1 \le n \le 10^3)$$$ — the length of the initial sequence. The following line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n~(-10^9 \le a_i \le 10^9)$$$ — the sequence itself.

In the single line output one integer — the number of subsequences of the original sequence that are good sequences, taken modulo 998244353.

NoteIn the first test case, two good subsequences — $$$[a_1, a_2, a_3]$$$ and $$$[a_2, a_3]$$$.In the second test case, seven good subsequences — $$$[a_1, a_2, a_3, a_4], [a_1, a_2], [a_1, a_3], [a_1, a_4], [a_2, a_3], [a_2, a_4]$$$ and $$$[a_3, a_4]$$$.

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1000D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	const mod int64 = 998244353
	const mx = 1000
	C := [mx + 1][mx + 1]int64{}
	for i := 0; i <= mx; i++ {
		C[i][0] = 1
		for j := 1; j < i; j++ {
			C[i][j] = (C[i-1][j] + C[i-1][j-1]) % mod
		}
		C[i][i] = 1
	}

	var n int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}

	dp := make([]int64, n+1)
	dp[n] = 1
	for i := n - 1; i >= 0; i-- {
		if a[i] <= 0 {
			continue
		}
		for j := i + a[i] + 1; j <= n; j++ {
			dp[i] = (dp[i] + dp[j]*C[j-i-1][a[i]]) % mod
		}
	}
	ans := int64(0)
	for _, v := range dp[:n] {
		ans = (ans + v) % mod
	}
	Fprint(_w, ans)
}

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