There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who is held.Each kangaroo can hold at most one kangaroo, and the kangaroo who is held by another kangaroo cannot hold any kangaroos.The kangaroo who is held by another kangaroo cannot be visible from outside. Please, find a plan of holding kangaroos with the minimal number of kangaroos who is visible.

The first line contains a single integer — n (1 ≤ n ≤ 5·105). Each of the next n lines contains an integer si — the size of the i-th kangaroo (1 ≤ si ≤ 105).

Output a single integer — the optimal number of visible kangaroos.

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(r, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(r, "%d\n", &a[i])
	}
	sort.Ints(a)

	ans := n
	for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
		if a[i]*2 > a[j] {
			continue
		}
		i++
		ans--
	}
	fmt.Print(ans)
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a[i])
	}
	sort.Ints(a)

	ans := n
	for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
		if a[i]*2 > a[j] {
			continue
		}
		i++
		ans--
	}
	fmt.Print(ans)
}

package main
import (
	"fmt"
	"sort"
	"bufio"
	"os"
	"strconv"
)
func main() {
	var n,i,j int
	fmt.Scan(&n)
	ans:=n
	a:=make([]int,n)
	input := bufio.NewScanner(os.Stdin)
	input.Split(bufio.ScanWords)
	for i=0;i<n;i++ {
		input.Scan()
		bb,_:=strconv.Atoi(input.Text())
		a[i]=bb
	}
	sort.Ints(a)
	j=(n+1)/2
	for i=0;i<n;i++ {
		if a[i]==0 {
			continue
		}
		for ;j<n && a[j]<2*a[i];j++ {}
		if j<n {
			a[i]=0
			a[j]=0
			ans--
		}
	}
	fmt.Println(ans)
}

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  cnt := 0
  n := readInt()
  ss := make([]int, n)

  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Ints(ss)

  for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
    if ss[i] * 2 <= ss[j] {
      cnt++
      i++
    }
  }

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

package main

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

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

    ScanInts := func(a... *int) {
        for i := 0; i < len(a); i++ {
            scanner.Scan()
            *(a[i]), _ = strconv.Atoi(scanner.Text())
        }
    }

    var n int
    ScanInts(&n)
    s, f := make([]int,n), make([]bool,n)
    for i := 0; i < n; i++ { ScanInts(&s[i]) }
    sort.Ints(s)
    ans := n
    for i, j := 0, n/2; (i < n) && (j < n); {
        if !f[i] {
            if (2*s[i]) <= s[j] {
                ans--
                f[j] = true
                i++; j++;
            } else {
                j++
            }
        } else {
            i++
        }
    }
    fmt.Println(ans)
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
)

func getInt() int {
	x, sign := 0, 1
	ch, _ := in.ReadByte()
	for ch < '0' || ch > '9' {
		if ch == '-' {
			sign = -1
		}
		ch, _ = in.ReadByte()
	}
	for ch >= '0' && ch <= '9' {
		x *= 10
		x += int(ch - '0')
		ch, _ = in.ReadByte()
	}
	return x * sign
}

func main() {
	n := getInt()
	a := make([]int, n)
	for i := range a {
		a[i] = getInt()
	}
	sort.Ints(a)
	fmt.Printf("%d\n", n+1-sort.Search(n/2+1, func(x int) bool {
		for i, j := 0, n-x; i < x; i, j = i+1, j+1 {
			if a[i]*2 > a[j] {
				return true
			}
		}
		return false
	}))
}

package main

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

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

	var n int
	Fscan(in, &n)
	arr := make([]int, n)
	for i := range arr {
		Fscan(in, &arr[i])
	}
	sort.Ints(arr)

	ans := n
	n2 := n / 2
	j := n2
	for i := 0; i < n2; i++ {
		for ; j < n; j++ {
			if 2*arr[i] <= arr[j] {
				ans--
				j++
				break
			}
		}
	}
	Fprint(out, ans)
}

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

package main

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

func Qsort(a []int, low int, high int) {
	if low < high {
		pivot := Partition(a, low, high)
		Qsort(a, low, pivot-1)
		Qsort(a, pivot+1, high)
	}
}

func Partition(a []int, low int, high int) int {
	pivot := low + rand.Int()%(high-low+1)
	a[pivot], a[low] = a[low], a[pivot]
	i := low
	for j := low + 1; j <= high; j++ {
		if a[j] < a[low] {
			i++
			a[i], a[j] = a[j], a[i]
		}
	}
	a[i], a[low] = a[low], a[i]
	return i
}

func Kangaroos(a []int) {
	n := len(a)
	visable := n
	for low, high := n/2-1, n-1; low >= 0; low-- {
		if a[low]*2 <= a[high] {
			visable--
			high--
		}
	}
	fmt.Println(visable)
}

func main() {
	var n int
	r := bufio.NewReader(os.Stdin)
	fmt.Scanln(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanln(r, &a[i])
	}
	Qsort(a, 0, n-1)
	Kangaroos(a)
}

package main

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

type Scanner struct {
	r            io.Reader
	split        bufio.SplitFunc
	maxTokenSize int
	token, buf   []byte
	start, end   int
}

func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        bufio.ScanWords,
		maxTokenSize: 16777216,
		buf:          make([]byte, 4096),
	}
}

func (s *Scanner) advance(n int) bool {
	if n < 0 || n > s.end-s.start {
		return false
	}
	s.start += n
	return true
}

func (s *Scanner) Text() string {
	return string(s.token)
}

func (s *Scanner) Scan() bool {
	for {
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], false)
			if err != nil || !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		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
		}
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				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
		}
		for loop := 0; ; {
			n, _ := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				break
			}
		}
	}
}

func (s *Scanner) Split(split bufio.SplitFunc) {
	s.split = split
}

var w *bufio.Writer = bufio.NewWriter(os.Stdout)
var sc *Scanner = NewScanner(os.Stdin)

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

func ni32() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func ni64() int64 {
	sc.Scan()
	n, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return n
}

func pri32(i ...int) {
	for _, ii := range i {
		w.WriteString(strconv.Itoa(ii))
		sp()
	}
}
func pri64(i ...int64) {
	for _, ii := range i {
		w.WriteString(strconv.FormatInt(ii, 10))
		sp()
	}
}
func sp()   { w.WriteByte(' ') }
func endl() { w.WriteByte('\n') }

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

func max(i, j int) int {
	if i > j {
		return i
	}
	return j
}

type Int64Slice []int64

func (slice Int64Slice) Len() int           { return len(slice) }
func (slice Int64Slice) Less(i, j int) bool { return slice[i] < slice[j] }
func (slice Int64Slice) Swap(i, j int)      { slice[i], slice[j] = slice[j], slice[i] }

func main() {
	defer w.Flush()
	n := ni32()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ni32()
	}
	sort.Ints(a)
	ans := sort.Search(n/2+1, func(j int) bool {
		if j == n/2+1 {
			return true
		}
		b := a[:j]
		c := a[n-j:]
		for i := 0; i < j; i++ {
			if c[i] < b[i]*2 {
				// fmt.Println(b, c, "true")
				return true
			}
		}
		// fmt.Println(b, c, "false")
		return false
	})
	pri32(n - ans + 1)
}

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  cnt := 0
  n := readInt()
  ss := make([]int, n)

  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Ints(ss)

  for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
    if ss[i] * 2 < ss[j] {
      cnt++
      i++
    }
  }

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

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  cnt := 0
  n := readInt()
  ss := make([]int, n)

  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Ints(ss)

  for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
    if ss[i] * 2 < ss[j] {
      continue
    }
    cnt++
    i++
  }

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

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  cnt := 0
  n := readInt()
  ss := make([]int, n)

  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Ints(ss)

  for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
    if ss[i] * 2 >= ss[j] {
      cnt++
      i++
    }
  }

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

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

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

func main() {
  cnt := 0
  n := readInt()
  ss := make([]int, n)

  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Ints(ss)

  fmt.Printf("%v\n", ss)
  for i, j := 0, (n+1)/2; i < n/2 && j < n; j++ {
    if ss[i] * 2 < ss[j] {
      cnt++
      i++
    }
  }

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

package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

var in = bufio.NewScanner(os.Stdin)

func init() {
  in.Split(bufio.ScanWords)
  buf := make([]byte, 2500000, 2500000)
  in.Buffer(buf, 0)
}

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

func removeEleInArr(arr *[]int, i int) int {
  old := *arr
  ele := old[i]
  l := len(old)
  if(i > 0 && i < l-1) {
    front := old[0: i]
    back := old[i+1: l]
    *arr = append(front, back...)
  } else if i == 0{
    *arr = old[1 : l]
  } else {
    *arr = old[0: l-1]
  }

  return ele
}

func main() {
  n := readInt()

  ss := make([]int, n)
  for i := 0; i < n; i++ {
    ss[i] = readInt()
  }

  sort.Sort(sort.IntSlice(ss))

  cnt := 0
  for len(ss) > 0{
    cnt++;
    l := len(ss)
    maxInt := removeEleInArr(&ss, l-1)
    i := sort.Search(len(ss)-1, func(i int) bool { return ss[i+1] > maxInt/2 })

    if i != len(ss) && ss[i] <= maxInt/2{
      removeEleInArr(&ss, i)
    }
  }

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

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	a := make([]int, n)
	for i := range a {
		fmt.Scanf("%d\n", &a[i])
	}
	sort.Ints(a)
	x := sort.Search(n, func(x int) bool {
		for i, j := 0, n-x; i < x; i, j = i+1, j+1 {
			if a[i]*2 > a[j] {
				return true
			}
		}
		return false
	})
	fmt.Printf("%d\n", n-x+1)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	a := make([]int, n)
	for i := range a {
		fmt.Scanf("%d\n", &a[i])
	}
	sort.Ints(a)
	fmt.Printf("%d\n", n+1-sort.Search(n>>1, func(x int) bool {
		for i, j := 0, n-x; i < x; i, j = i+1, j+1 {
			if a[i]*2 > a[j] {
				return true
			}
		}
		return false
	}))
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &a[i])
	}
	sort.Ints(a)

	j := 0
	for i := 1; i < n; i++ {
		if a[j]*2 <= a[i] {
			a[j] = -1
			j++
			for a[j] == -1 {
				j++
			}
		}
	}

	ans := 0
	for _, x := range a {
		if x != -1 {
			ans++
		}
	}
	fmt.Print(ans)
}


The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dictionary contains all words of this language. The words are listed in a way they are usually ordered in dictionaries. Formally, word $$$a$$$ comes earlier than word $$$b$$$ in the dictionary if one of the following conditions hold:  the first letter of $$$a$$$ is less than the first letter of $$$b$$$;  the first letters of $$$a$$$ and $$$b$$$ are the same, and the second letter of $$$a$$$ is less than the second letter of $$$b$$$. So, the dictionary looks like that:  Word $$$1$$$: ab  Word $$$2$$$: ac  ...  Word $$$25$$$: az  Word $$$26$$$: ba  Word $$$27$$$: bc  ...  Word $$$649$$$: zx  Word $$$650$$$: zy You are given a word $$$s$$$ from the Berland language. Your task is to find its index in the dictionary.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).

For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.

package main

import "fmt"

func main() {
    var t int
    fmt.Scanf("%d\n", &t)
    for i := 0; i < t; i++ {
        var word string
        fmt.Scanf("%s\n", &word)
        temp := uint64(word[0] - 'a')*25
        if word[1] > word[0] {
            temp += uint64(word[1] - 'a')
        } else {
            temp += uint64(word[1] - 'a')
            temp++
        }
        fmt.Printf("%d\n", temp)
    }
}

package main

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

// source: https://codeforces.com/contest/1674/problem/B?locale=en

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

func solve() string {
	const letters = 25
	var s string
	fmt.Fscan(in, &s)
	var x, y = s[0], s[1]

	res := int64(x-'a')*letters + int64(y-'a')
	if x > y {
		res++
	}
	return strconv.FormatInt(res, 10)
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

package main

import (
	"fmt"
	"strconv"
)

func solve2() string {
	const letters = 25
	var s string
	fmt.Scan(&s)
	var x, y = s[0], s[1]

	res := int64(x-'a')*letters + int64(y-'a')
	if x > y {
		res++
	}
	return strconv.FormatInt(res, 10)
}

func main() {
	var t int
	fmt.Scanln(&t)

	for i := 0; i < t; i++ {
		fmt.Println(solve2())
	}
}

package main

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

const mod = 998244353

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var str string
	fmt.Fscan(in, &str)
	ans := 0
	ans += (int(str[0]) - 'a') * 25
	ans += (int(str[1]) - 'a') + 1
	if str[1] > str[0] {
		ans--
	}
	fmt.Println(ans)
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	//stdin, _ := os.Open("/project/go/algo/input")
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
var alphabet = []string{"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}

func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	mapper:= make(map[string]int)
	counter:=1
	for j:=0;j<26;j++{
		for k:=0;k<26;k++{
			if j != k {
				mapper[string(alphabet[j])+string(alphabet[k])]= counter
				counter++
			}
		}
	}
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var word string
		fmt.Fscan(in,&word)
		fmt.Fprintln(out,mapper[word])
	}
}

// https://codeforces.com/problemset/problem/1674/B

// 1674B - Dictionary

// The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.
// The Berland dictionary contains all words of this language. The words are listed in a way they are usually ordered in dictionaries. Formally, word a comes earlier than word b in the dictionary if one of the following conditions hold:
//  • the first letter of a is less than the first letter of b;
//  • the first letters of a and b are the same, and the second letter of a is less than the second letter of b.
// So, the dictionary looks like that:
//  • Word 1: ab
//  • Word 2: ac
//  • ...
//  • Word 25: az
//  • Word 26: ba
//  • Word 27: bc
//  • ...
//  • Word 649: zx
//  • Word 650: zy
// You are given a word s from the Berland language. Your task is to find its index in the dictionary.

// Input
// The first line contains one integer t (1≤t≤650) — the number of test cases.
// Each test case consists of one line containing s — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).

// Output
// For each test case, print one integer — the index of the word s in the dictionary.

// Example
// input
// 7
// ab
// ac
// az
// ba
// bc
// zx
// zy
// output
// 1
// 2
// 25
// 26
// 27
// 649
// 650

// Tutorial

// There are many different ways to solve this problem:
//  • generate all Berland words with two for-loops and store them in an array, then for each test case, go through the array of words to find the exact word you need;
//  • generate all Berland words with two for-loops and store them in a dictionary-like data structure (map in C++, dict in Python, etc), using words as keys and their numbers as values. This allows to search for the index of the given word quickly;
//  • for each test case, run two for-loops to iterate over the words, count the number of words we skipped, and stop at the word from the test case;
//  • try to invent some formulas that allow counting the number of words before the given one.

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, i uint
	var s string
	var idx map[string]uint
	var chr1, chr2 byte

	i = 1
	idx = make(map[string]uint)

	for chr1 = 'a'; chr1 <= 'z'; chr1++ {
		for chr2 = 'a'; chr2 <= 'z'; chr2++ {
			if chr1 != chr2 {
				s = string(chr1) + string(chr2)
				idx[s] = i
				i++
			}
		}
	}

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &s)
			fmt.Fprintln(writer, idx[s])
		}
	}

	writer.Flush()
}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		ans := (int(s[0])-int('a'))*26 + int(s[1]) - int('a') - int(s[0]) + int('a')
		if s[0] > s[1] {
			ans++
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1674B
Date: 10/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1674/B
Problem: CF1674B
**/
func (in *CF1674B) Run() {
	mapa := make(map[string]int)
	index := 1
	for i:= 'a'; i <= 'z'; i++{
		for j:='a';j<='z';j++{
			if i != j {
				mapa[fmt.Sprintf("%s%s", string(i), string(j))] = index
				index++
			}
		}
	}
	var str strings.Builder
	for t:=in.NextInt(); t > 0; t-- {
		str.WriteString(fmt.Sprintf("%d", mapa[in.NextString()]))
		str.WriteString("\n")
	}
	fmt.Print(str.String())
}

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

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

package main

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

var m = map[string]int{}

var letters = []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}

func f() {
	m = make(map[string]int)
	count := 0
	for _, x := range letters {
		for _, y := range letters {
			if x == y {
				continue
			}
			count++
			m[x+y] = count
		}
	}
}

func main() {
	f()
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(in, &s)
		fmt.Fprintln(out, m[s])
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		s := gs();
		idx := 25*int(s[0]-'a') + int(s[1]-'a') + 1
		if s[1] > s[0] { idx-- }
		fmt.Fprintln(wrtr,idx)
	}
}

package main

import (
	"fmt"
)

func getA(z, base int) int {
	result := 0
	for z != 1 {
		if z%base != 0 {
			return 0
		}
		z /= base
		result++
	}
	return result
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var a, b byte
		fmt.Scanf("%c%c\n", &a, &b)
		result := int(a-'a') * int(25)
		if b < a {
			result += int(b - 'a')
		} else {
			result += int(b - 'a' - 1)
		}
		fmt.Println(result + 1)
	}
}

package main

import "fmt"

func sol() {
	var s string
	fmt.Scanf("%s\n", &s)
	var v1 = int(s[0] - 'a')
	var v2 = int(s[1] - 'a')
	var c int
	if v1 < v2 {
		c = v1*25 + v2
	} else {
		c = v1*25 + v2 + 1
	}
	fmt.Println(c)

}

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

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		s, _ := reader.ReadString('\n')
		if s[len(s)-1] == 10 {
			s = s[:len(s)-1]
		}
		if s[len(s)-1] == 13 {
			s = s[:len(s)-1]
		}

		i := int(rune(s[0]) - 97)
		j := int(rune(s[1]) - 97)
		ans := ( ( 25 * i ) + j )
		if j < i {
			ans += 1
		}
		fmt.Println(ans)
	}
}

package main

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

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

	key := map[uint8]map[uint8]int{}

	cnt := 1
	for i := 0; i <= 25; i++ {
		key[uint8('a'+i)] = map[uint8]int{}
		for j := 0; j <= 25; j++ {
			if i == j {
				continue
			}
			key[uint8('a'+i)][uint8('a'+j)] = cnt
			cnt++
		}
	}

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		//fmt.Println(int(s[1]))
		//fmt.Fprintln(out, key[s[0]]+int(s[1])-int('a'))
		fmt.Fprintln(out, key[s[0]][s[1]])
	}
}

package main

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

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

func solve() {
	var s string
	fmt.Fscan(in, &s)
	c := 1
	if s[0] < s[1] {
		c = 0
	}
	fmt.Fprintf(out, "%d\n", int(s[0]-'a')*25+int(s[1])-'a'+c)
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		solve()
	}
}

package main

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

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

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

		idx := 1
	Loop:
		for i := 0; i < 26; i++ {
			for j := 0; j < 26; j++ {
				if i == j {
					continue
				}

				if int(s[0]-'a') == i && int(s[1]-'a') == j {
					break Loop
				}
				idx++
			}
		}
		fmt.Fprintln(out, idx)
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for ; t > 0; t-- {
		var a, b byte
		fmt.Scanf("%c%c\n", &a, &b)
		var res int
		res = 25*int(a-'a') + 1
		if b > a {
			res = res + int(b-'a'-1)
		} else {
			res = res + int(b-'a')
		}
		fmt.Println(res)
	}
}

package main

import "fmt"

func main() {
	var t int
    fmt.Scanf("%d\n",&t)
    for i:=1;i<=t;i++{
        var str string
        fmt.Scanf("%s\n",&str)
        ans:=(int(str[0])-'a')*26
        ans+=int(str[1])-'a'
        if str[0]>str[1]{
            ans-=int(str[0]-1)-'a'
        }else{
            ans-=int(str[0])-'a'
        }
        fmt.Println(ans)
    }
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var T int
	var S string
	var val,anc int32

	fmt.Fscan(in, &T)
	//list := make([]string,N)
	A := rune('a')
	for i := 0;i < T;i++{
		fmt.Fscan(in, &S)
		for num,l := range S{
			if num == 0{
				val = l - A
			}else{
				if (l - A + 1) > val{
					anc = val*25 + l - A
				}else{
					anc = val*25 + l - A + 1
				}
			}

		}
		fmt.Println(anc)

	}
}

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve(dict map[string]int) {
	var s string
	scanf("%s\n", &s)

	fmt.Fprintln(writer, dict[s])
}

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

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

	dict := make(map[string]int)

	skipCnt := 0

	for i := 'a'; i <= 'z'; i++ {
		for j := 'a'; j <= 'z'; j++ {
			if i != j {
				word := []rune{i, j}
				idx := 26*int(i-'a') + int(j-'a') - skipCnt + 1

				dict[string(word)] = idx
			} else {
				skipCnt++
			}
		}
	}

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

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 {
	return nums[minIdx(nums...)]
}

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

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

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

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

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

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

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

	for i := int64(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))
}

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

	for ftr := int64(2); ftr*ftr <= num; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > 1 {
		factors = append(factors, num)
	}

	return factors
}

package main

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

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

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

	var T int
	var x string

	m := map[string]int{}
	idx := 1
	for i := 'a'; i <= 'z'; i++ {
		for j := 'a'; j <= 'z'; j++ {
			if i != j {
				m[string(i)+string(j)] = idx
				idx++
			}
		}
	}

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)

		Fprintln(out, m[x])
	}
}

package main

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

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

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

	mp := make(map[string]int)
	k := 1
	for i := 'a'; i <= 'z'; i++ {
		for j := 'a'; j <= 'z'; j++ {
			if i == j {
				continue
			}
			mp[string(i)+string(j)] = k
			k++
		}
	}
	t := 0
	str := ""
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		fmt.Fscan(in, &str)
		fmt.Fprintln(out, mp[str])
	}
}

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	defer w.Flush()
	var x string
	fmt.Fscan(r, &x)
	a := (int(x[0]) - 'a') * 25
	if x[1] > x[0] {
		a += int(x[1] - 'a')
	} else {
		a += int(x[1] - 'a') + 1
	}
	fmt.Fprintf(w, "%d\n", a)
}

func main() {
	var n int
	fmt.Fscan(r, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	_, _ = fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	_, _ = fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	_, _ = fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) sort.IntSlice {
	var t int
	res := make(sort.IntSlice, 0, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	_, _ = fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	_, _ = fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	_, _ = fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	_, _ = fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

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
}

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

func main() {
	io := NewIO(os.Stdin, os.Stdout)

	p := make([]string, 0)
	for i := byte('a'); i <= 'z'; i++ {
		for j := byte('a'); j <= 'z'; j++ {
			if i == j {
				continue
			}
			p = append(p, string([]byte{i, j}))
		}
	}

	for t := io.ReadInt(); t > 0; t-- {
		s := io.ReadString()
		for i, v := range p {
			if s == v {
				fmt.Println(i + 1)
				break
			}
		}
	}
}


Vasya takes part in the orienteering competition. There are n checkpoints located along the line at coordinates x1, x2, ..., xn. Vasya starts at the point with coordinate a. His goal is to visit at least n - 1 checkpoint in order to finish the competition. Participant are allowed to visit checkpoints in arbitrary order.Vasya wants to pick such checkpoints and the order of visiting them that the total distance travelled is minimized. He asks you to calculate this minimum possible value.

The first line of the input contains two integers n and a (1 ≤ n ≤ 100 000,  - 1 000 000 ≤ a ≤ 1 000 000) — the number of checkpoints and Vasya's starting position respectively. The second line contains n integers x1, x2, ..., xn ( - 1 000 000 ≤ xi ≤ 1 000 000) — coordinates of the checkpoints.

Print one integer — the minimum distance Vasya has to travel in order to visit at least n - 1 checkpoint.

NoteIn the first sample Vasya has to visit at least two checkpoints. The optimal way to achieve this is the walk to the third checkpoints (distance is 12 - 10 = 2) and then proceed to the second one (distance is 12 - 7 = 5). The total distance is equal to 2 + 5 = 7.In the second sample it's enough to visit only one checkpoint so Vasya should just walk to the point  - 10.

package main

import "bufio"
import "os"
import "sort"
import "strconv"

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

	in.Split(bufio.ScanWords)
	defer out.Flush()

	n := readInt()
	a := readInt()
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = readInt()
	}

	if n == 1 {
		write(0)
		return
	}

	sort.Ints(x)

	pos := 0
	for (pos < n) && (x[pos] <= a) {
		pos++
	}

	if pos <= 0 {
		res := x[n-2] - a
		write(res)
		return
	}

	if pos >= n {
		res := a - x[1]
		write(res)
		return
	}

	c1 := max(a-x[1], 0)
	c2 := x[n-1] - a
	r1 := min(2*c1+c2, 2*c2+c1)

	d1 := a - x[0]
	d2 := max(x[n-2]-a, 0)
	r2 := min(2*d2+d1, 2*d1+d2)

	write(min(r1, r2))
}

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

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

// Heap
type Node struct {
	name  int
	value int64
	index int
}

type NodeList []*Node

func (nodes NodeList) Len() int {
	return len(nodes)
}

func (nodes NodeList) Less(i int, j int) bool {
	return nodes[i].value < nodes[j].value
}

func (nodes NodeList) Swap(i int, j int) {
	nodes[i], nodes[j] = nodes[j], nodes[i]
	nodes[i].index = i
	nodes[j].index = j
}

func (nodes *NodeList) Push(x interface{}) {
	node := x.(*Node)
	node.index = len(*nodes)
	*nodes = append(*nodes, node)
}

func (nodes *NodeList) Pop() interface{} {
	s := *nodes
	last := len(s) - 1
	r := s[last]
	*nodes = s[:last]
	r.index = -1
	return r
}

// Int64Slice Sort
type Int64Slice []int64

func (s Int64Slice) Len() int               { return len(s) }
func (s Int64Slice) Less(i int, j int) bool { return s[i] < s[j] }
func (s Int64Slice) Swap(i int, j int)      { s[i], s[j] = s[j], s[i] }

// Input and Output
var in *bufio.Scanner
var out *bufio.Writer

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

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

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

func readFloat64() float64 {
	in.Scan()
	val, _ := strconv.ParseFloat(in.Text(), 64)
	return val
}

func write(args ...interface{}) {
	for i, e := range args {
		switch e.(type) {
		case string:
			out.WriteString(e.(string))
		case int:
			out.WriteString(strconv.Itoa(e.(int)))
		case int64:
			out.WriteString(strconv.FormatInt(e.(int64), 10))
		case float64:
			out.WriteString(strconv.FormatFloat(e.(float64), 'f', -1, 64))
		case []string:
			a := e.([]string)
			for j, x := range a {
				out.WriteString(x)
				if j+1 < len(a) {
					out.WriteByte(' ')
				}
			}
		case []int:
			a := e.([]int)
			for j, x := range a {
				out.WriteString(strconv.Itoa(x))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		case []int64:
			a := e.([]int64)
			for j, x := range a {
				out.WriteString(strconv.FormatInt(x, 10))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		case []float64:
			a := e.([]float64)
			for j, x := range a {
				out.WriteString(strconv.FormatFloat(x, 'f', -1, 64))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		default:
			out.WriteString("###")
		}
		if i+1 < len(args) {
			out.WriteByte(' ')
		}
	}
	out.WriteByte('\n')
}

package main

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

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

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

func main() {
	io := bufio.NewReader(os.Stdin)
	var n, a int
	fmt.Fscanf(io, "%d %d\n", &n, &a)

	coordinates := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(io, "%d", &coordinates[i])
	}

	sort.Ints(coordinates)

	if n == 1 {
		fmt.Printf("%d\n", 0)
		os.Exit(0)
	}

	right := abs(coordinates[len(coordinates)-1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1])
	right = min(right, abs(coordinates[len(coordinates) - 2] - a) + abs(coordinates[len(coordinates) - 2] - coordinates[0]))
	left := abs(coordinates[0]-a) + abs(coordinates[len(coordinates)-2]-coordinates[0])
	left = min(left, abs(coordinates[1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1]))

	result := min(right, left)
	fmt.Printf("%d\n", result)
}

package main

import (
	"fmt"
	"sort"
)

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

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

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

	coordinates := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &coordinates[i])
	}

	sort.Ints(coordinates)

	right := abs(coordinates[len(coordinates)-1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1])
	left := abs(coordinates[0]-a) + abs(coordinates[len(coordinates)-2]-coordinates[0])

	result := min(right, left)
	fmt.Printf("%d\n", result)
}

package main

import (
	"fmt"
	"sort"
)

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

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

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

	coordinates := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &coordinates[i])
	}

	sort.Ints(coordinates)

	right := abs(coordinates[len(coordinates)-1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1])
	right = min(right, abs(coordinates[len(coordinates) - 2] - a) + abs(coordinates[len(coordinates) - 2] - coordinates[0]))
	left := abs(coordinates[0]-a) + abs(coordinates[len(coordinates)-2]-coordinates[0])
	left = min(left, abs(coordinates[1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1]))

	result := min(right, left)
	fmt.Printf("%d\n", result)
}

package main

import "fmt"
import (
	"sort"
)

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

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

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

	coordinates := make([]int, n);
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &coordinates[i])
	}

	sort.Ints(coordinates)

	right := abs(coordinates[len(coordinates) - 1] - a) + abs(coordinates[len(coordinates) - 1] - coordinates[1])
	left := abs(coordinates[0] - a) + abs(coordinates[len(coordinates) - 2] - coordinates[0]);

	result := min(right, left);
	fmt.Printf("%d\n", result)
}

package main

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

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

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

func main() {
	io := bufio.NewReader(os.Stdin)
	var n, a int
	fmt.Fscanf(io, "%d %d\n", &n, &a)

	coordinates := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(io, "%d", &coordinates[i])
	}

	sort.Ints(coordinates)

	if n == 1 {
		fmt.Printf("%d\n", abs(coordinates[0] - a))
		os.Exit(0)
	}

	right := abs(coordinates[len(coordinates)-1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1])
	right = min(right, abs(coordinates[len(coordinates) - 2] - a) + abs(coordinates[len(coordinates) - 2] - coordinates[0]))
	left := abs(coordinates[0]-a) + abs(coordinates[len(coordinates)-2]-coordinates[0])
	left = min(left, abs(coordinates[1]-a) + abs(coordinates[len(coordinates)-1]-coordinates[1]))

	result := min(right, left)
	fmt.Printf("%d\n", result)
}


You are given an array $$$a$$$ of $$$2n$$$ distinct integers. You want to arrange the elements of the array in a circle such that no element is equal to the the arithmetic mean of its $$$2$$$ neighbours.More formally, find an array $$$b$$$, such that: $$$b$$$ is a permutation of $$$a$$$.For every $$$i$$$ from $$$1$$$ to $$$2n$$$, $$$b_i \neq \frac{b_{i-1}+b_{i+1}}{2}$$$, where $$$b_0 = b_{2n}$$$ and $$$b_{2n+1} = b_1$$$. It can be proved that under the constraints of this problem, such array $$$b$$$ always exists.

The first line of input contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of testcases. The description of testcases follows. The first line of each testcase contains a single integer $$$n$$$ $$$(1 \leq n \leq 25)$$$. The second line of each testcase contains $$$2n$$$ integers $$$a_1, a_2, \ldots, a_{2n}$$$ $$$(1 \leq a_i \leq 10^9)$$$ — elements of the array. Note that there is no limit to the sum of $$$n$$$ over all testcases.

For each testcase, you should output $$$2n$$$ integers, $$$b_1, b_2, \ldots b_{2n}$$$, for which the conditions from the statement are satisfied.

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n==1 {
			fmt.Fprintln(out,list[1],list[0])
			continue
		} else {
			for {
				counter:=0
				for j:=1;j<2*n-1;j++{
					if j == 1 {
						if (list[j]+list[2*n-1])/2 == list[j-1] {
							list[2*n-1],list[j-1],list[j] = list[j],list[2*n-1],list[j-1]
							counter++
						}
					}
					if (list[j-1]+list[j+1])/2 == list[j] {
						list[j-1],list[j],list[j+1] = list[j+1],list[j-1],list[j]
						counter++
					}
					if j == 2*n-2 {
						if (list[j]+list[0])/2 == list[j+1] {
							list[j],list[j+1],list[0] = list[j+1],list[j],list[0]
							counter++
						}
					}
				}
				if counter == 0 {
					break
				}
			}
		}
		for j:=0;j<n*2;j++{
			fmt.Fprintf(out,"%v ",list[j])
		}
		fmt.Fprintln(out,)
		/*for j:=1;j<2*n-1;j++{
			if j==1 {
				if (list[j]+list[2*n-1])/2 == list[j-1] {
					fmt.Fprintln(out,"false")
					break
				}
			}
			if (list[j-1]+list[j+1])/2 == list[j] {
				fmt.Fprintln(out,"false")
				break
			}
		}*/
	}
}

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)

		arr := make([]int, 2*n+1)
		ans := make([]int, 2*n+1)

		for i := 1; i <= 2*n; i++ {
			_, _ = fmt.Fscan(in, &arr[i])
		}

		sort.Ints(arr)

		for i := 1; i <= n; i++ {
			ans[2*i] = arr[i]
			ans[2*i-1] = arr[n+i]
		}

		for i := 1; i <= 2*n; i++ {
			fmt.Printf("%d ", ans[i])
		}
		fmt.Println()
	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		o := make([]int, 2*n)
		for j := 0; j < 2*n; j++ {
			fmt.Fscan(f, &o[j])
		}
		sort.Ints(o)
		for j := 0; j < n; j++ {
			fmt.Fprint(w, o[j], " ", o[2*n-j-1], " ")
		}
		fmt.Fprintln(w, "")
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1526A
Date: 17/11/21
User: pepradere
URL: https://codeforces.com/problemset/problem/1526/A
Problem: CF1526A
**/
func (in *CF1526A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt() * 2
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}
		sort.Ints(arr)
		var sol strings.Builder
		for p, i, j := 0, 0, n-1; p < n; p++ {
			if p%2 != 0 {
				sol.WriteString(fmt.Sprintf("%d ", arr[i]))
				i++
			} else {
				sol.WriteString(fmt.Sprintf("%d ", arr[j]))
				j--
			}
		}
		fmt.Println(sol.String())
	}
}

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

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

package main

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

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

func solve(n int, a []int) string {
	var x string
	sort.Ints(a)
	for i := 0; i < n; i++ {
		x += fmt.Sprintf("%d %d ", a[i], a[2*n-1-i])
	}
	return x
}

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

package main

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

func MIN(x, y int64) int64 {
	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 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
	}

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

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

//s stringyn icinde nace sany a bar? s.count(a)
func countInStr(s, a string) int {
	var ans int
	ans = 0
	for _, l := range s {
		if string(l) == a {
			ans = ans + 1
		}
	}
	return ans
}

//stringlan arrayynda s stringi sanaya
func countInArrOfStr(arr []string, s string) int {
	var ans int
	ans = 0
	for _, l := range arr {
		if l == s {
			ans = ans + 1
		}
	}
	return ans
}

// integer arrayda berlen integer nace sapar gelyar, shony sanaya!
func countInArrOfInt(arr []int, n int) int {
	var ans int
	ans = 0
	for _, l := range arr {
		if l == n {
			ans = ans + 1
		}
	}
	return ans
}

//berlen stringy berlen arrayyn icinde barmy yokmy shony barlaya!
func isInArrayString(arr []string, s string) bool {
	var ans bool = false
	for _, l := range arr {
		if l == s {
			ans = true
			break
		}
	}
	return ans
}

// berlen integeryn berlen integerly arrayda barlygyny yada yokluguny kesgitleyar
func isInArrayInt(arr []int, n int) bool {
	var ans bool = false
	for _, l := range arr {
		if l == n {
			ans = true
			break
		}
	}
	return ans
}

//stringly arrayy set edyar... set(arr)
func setArrOfStr(arr []string) []string {
	var ans []string
	for _, l := range arr {
		if isInArrayString(ans, l) == false {
			ans = append(ans, l)
		}
	}
	return ans

}

//integer arrayy set edyar
func setArrOfInt(arr []int) []int {
	var ans []int
	for _, l := range arr {
		if isInArrayInt(ans, l) == false {
			ans = append(ans, l)
		}
	}
	return ans
}

func abs(n int) int {
	if n >= 0 {
		return n
	} else {
		return n * (-1)
	}
}

//bu funksiya ahli elementleri durli bolan int arrayy artyan tertipde yazyar!
func sort(arr []int, n int) []int {
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		var c int
		c = 0
		for _, l := range arr {
			if l < arr[i] {
				c = c + 1
			}
		}
		ans[c] = arr[i]

	}
	return ans

}

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)

		arr := make([]int, 2*n)
		for i := 0; i < 2*n; i++ {
			fmt.Fscan(input, &arr[i])
		}
		sortedarr := sort(arr, 2*n)
		for i := 0; i < n; i++ {
			fmt.Println(sortedarr[:n][i])
			fmt.Println(sortedarr[n:][i])
		}

	}
}

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 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 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 LITTLE(x int) int64 {
	var answer int64
	answer = answer + int64((x*x*x*x-x*x)/4) + int64(x*x*(x-1)*(x-1)/8) - int64(x*(x-1)*(x+x+1)*(x+x-1)/12)
	return answer
}

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
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

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

		var n int
		fmt.Fscan(input, &n)

		ARRAY := make([]int64, n*2)
		for j := 0; j < n*2; j++ {
			fmt.Fscan(input, &ARRAY[j])

		}

		sort.Slice(ARRAY, func(i, j int) bool {
			return ARRAY[i] < ARRAY[j]
		})

		for i := 0; i < n; i++ {
			fmt.Println(ARRAY[i])
			fmt.Println(ARRAY[i+n])
		}

	}
}

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		n*=2
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)
		ans := make([]int, n)
		i := 0
		for ;i<n;i+=2 {
			v := a[0]
			a = a[1:]
			ans[i] = v
		}
		i=1
		for ;i<n;i+=2 {
			v := a[0]
			a = a[1:]
			ans[i] = v
		}
		for _, v := range ans {
			Fprint(out, v, " ")
		}
		Fprintln(out)
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

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

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

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n==1 {
			fmt.Fprintln(out,list[1],list[0])
			continue
		} else {
			for {
				counter:=0
				for j:=1;j<2*n-1;j++{
					if j == 1 {
						if (list[j]+list[2*n-1])/2 == list[j-1] {
							list[2*n-1],list[j-1],list[j] = list[j],list[2*n-1],list[j-1]
							counter++
						}
					}
					if (list[j-1]+list[j+1])/2 == list[j] {
						list[j-1],list[j],list[j+1] = list[j+1],list[j-1],list[j]
						counter++
					}
				}
				if counter == 0 {
					break
				}
			}
		}
		for j:=0;j<n*2;j++{
			fmt.Fprintf(out,"%v ",list[j])
		}
		fmt.Fprintln(out,)
		/*for j:=1;j<2*n-1;j++{
			if j==1 {
				if (list[j]+list[2*n-1])/2 == list[j-1] {
					fmt.Fprintln(out,"false")
					break
				}
			}
			if (list[j-1]+list[j+1])/2 == list[j] {
				fmt.Fprintln(out,"false")
				break
			}
		}*/
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n==1 {
			fmt.Fprintln(out,list[1],list[0])
			continue
		} else {
			for k:=1;k<=n;k++{
				for j:=1;j<2*n-1;j++{
					if j == 1 {
						if (list[j]+list[2*n-1])/2 == list[j-1] {
							list[2*n-1],list[j-1],list[j] = list[j],list[2*n-1],list[j-1]
						}
					}
					if (list[j-1]+list[j+1])/2 == list[j] {
						list[j-1],list[j],list[j+1] = list[j+1],list[j-1],list[j]
					}
				}
			}
		}
		for j:=0;j<n*2;j++{
			fmt.Fprintf(out,"%v ",list[j])
		}
		fmt.Fprintln(out,)
		/*for j:=1;j<2*n-1;j++{
			if j==1 {
				if (list[j]+list[2*n-1])/2 == list[j-1] {
					fmt.Fprintln(out,"false")
					break
				}
			}
			if (list[j-1]+list[j+1])/2 == list[j] {
				fmt.Fprintln(out,"false")
				break
			}
		}*/
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n==1 {
			fmt.Fprintln(out,list[1],list[0])
			continue
		} else {
			for j:=1;j<2*n-1;j++{
				if j == 1 {
					if (list[j]+list[2*n-1])/2 == list[j-1] {
						list[2*n-1],list[j-1],list[j] = list[j],list[2*n-1],list[j-1]
					}
				}
				if (list[j-1]+list[j+1])/2 == list[j] {
					list[j-1],list[j],list[j+1] = list[j+1],list[j-1],list[j]
				}
			}
		}
		for j:=0;j<n*2;j++{
			fmt.Fprintf(out,"%v ",list[j])
		}
		fmt.Fprintln(out,)
		/*for j:=1;j<2*n-1;j++{
			if j==1 {
				if (list[j]+list[2*n-1])/2 == list[j-1] {
					fmt.Fprintln(out,"false")
					break
				}
			}
			if (list[j-1]+list[j+1])/2 == list[j] {
				fmt.Fprintln(out,"false")
				break
			}
		}*/
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n==1 {
			fmt.Fprintln(out,list[1],list[0])
			continue
		} else {
			for j:=1;j<2*n-1;j++{
				if (list[j-1]+list[j+1])/2 == list[j] {
					list[j-1],list[j],list[j+1] = list[j+1],list[j-1],list[j]
				}
			}
		}
		for j:=0;j<n*2;j++{
			fmt.Fprintf(out,"%v ",list[j])
		}
		fmt.Fprintln(out,)
		/*fmt.Fprintln(out,list)
		for j:=1;j<2*n-1;j++{
			if j==1 {
				if (list[j]+list[2*n-1])/2 == list[j-1] {
					fmt.Fprintln(out,"false")
					break
				}
			}
			if (list[j-1]+list[j+1])/2 == list[j] {
				fmt.Fprintln(out,"false")
				break
			}
		}*/
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n*2 >= 3 {
			for j:=1;j<2*n-1;j+=2{
				fmt.Fprintf(out,"%v %v %v ",list[j+1],list[j-1],list[j])
			}
		} else {
			for j:=1;j<=2*n-1;j+=2{
				fmt.Fprintf(out,"%v %v ",list[j],list[j-1])
			}
		}
		fmt.Fprintln(out,)
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		if n*2 >= 3 {
			for j:=1;j<2*n-1;j+=2{
				fmt.Fprintf(out,"%v %v %v ",list[j+1],list[j-1],list[j])
			}
		} else {
			for j:=1;j<2*n-1;j+=2{
				fmt.Fprintf(out,"%v %v ",list[j],list[j-1])
			}
		}
		fmt.Fprintln(out,)
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		for j:=1;j<2*n-1;j+=2{
			fmt.Fprintf(out,"%v %v %v ",list[j+1],list[j-1],list[j])
		}
		fmt.Fprintln(out,)
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]int,2*n)
		for j:=0;j<n*2;j++{
			fmt.Fscan(in,&list[j])
		}
		for j:=1;j<2*n;j+=2{
			fmt.Fprintf(out,"%v %v ",list[j],list[j-1])
		}
		fmt.Fprintln(out,)
	}
}

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)

		arr := make([]int, 2*n)

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

		sort.Ints(arr)

		for i := 0; i < 2*n; i++ {
			fmt.Printf("%d ", arr[i])
		}
		fmt.Println()
	}
}