package main

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

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

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

	s := ""
	scan(&s)
	t := []byte(s)
	m, n := nextInt(), len(t)
	a := make([]int, 100005)

	// println(m)
	for i := 0; i < m; i++ {
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	printf("%s\n", t)

}

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 100005)
	// println(m)
	for i := 0; i < m; i++ {
		// c := nextInt()
		// println(c)
		// a[c]++
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	// println(string(t))
	writer.WriteString(fmt.Sprintf("%s\n", t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return strings.TrimSpace(line)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 100005)
	// println(m)
	for i := 0; i < m; i++ {
		// c := nextInt()
		// println(c)
		// a[c]++
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))
	// writer.WriteString(fmt.Sprintf("%s\n", t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return strings.TrimSpace(line)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

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

	s := ""
	scan(&s)
	t := []byte(s)
	m, n := nextInt(), len(t)
	a := make([]int, 100005)

	// println(m)
	for i := 0; i < m; i++ {
		// c := nextInt()
		// println(c)
		// a[c]++
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))

}

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

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

	s := ""
	scan(&s)
	t := []byte(s)
	m := nextInt()
	a := make([]int, 100005)
	swapPos := make([]int, 0, 100)

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

	for i := 0; i < len(a); i++ {
		if a[i] > 0 && a[i] % 2 != 0 {
			swapPos = append(swapPos, i)
		}
	}

	for i := 0; i < len(swapPos); i++ {

		// println(string(t))
		if i == len(swapPos)-1 {
			swapSubString(t, swapPos[i], len(t)/2, i+1)
		} else {
			swapSubString(t, swapPos[i], swapPos[i+1], i+1)
		}
		// println(string(t))
	}

	println(string(t))

}

func swapSubString(s []byte, pos, nextPos, swap int) {
	if swap % 2 == 0 {
		return
	}

	for i, j := pos, len(s)-pos-1; i < nextPos; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
}

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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 main() {
  reader := bufio.NewReader(os.Stdin)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  line, _ := reader.ReadString('\n')
  s := strings.TrimSpace(line)
  n := len(s)
  line, _ = reader.ReadString('\n')
  q, _ := strconv.Atoi(strings.TrimSpace(line))
  line, _ = reader.ReadString('\n')
  scanner = bufio.NewScanner(strings.NewReader(line))
  scanner.Split(bufio.ScanWords)
  reverse := make([]bool, (n+1)/2)
  for qi := 0; qi < q; qi++ {
    pos := getI()-1
    reverse[pos] = !reverse[pos]
  }
  result := []byte(s)
  reversed := false
  for pos := 0; pos < len(reverse); pos++ {
    if reverse[pos] {
      reversed = !reversed
    }
    alt := n - 1 - pos
    if reversed {
      result[pos], result[alt] = result[alt], result[pos]
    }
  }
  writer.WriteString(fmt.Sprintf("%s\n", result))
}

package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer([]byte(nil), 1e6)
	s.Split(bufio.ScanWords)
	s.Scan()
	xs := s.Text()
	s.Scan()
	m, _ := strconv.Atoi(s.Text())
	as := make([]int, m)
	for i := 0; i < m; i++ {
		s.Scan()
		as[i], _ = strconv.Atoi(s.Text())
	}

	fmt.Println(solveFaster(xs, as))
}

func solve(xs string, as []int) string {
	rs := []rune(xs)
	s := len(rs)

	for i := 0; i < len(as); i++ {
		l := as[i] - 1
		r := (s - as[i] + 1) - 1
		reverse(rs[l : r+1])
	}
	return string(rs)
}

func solveFaster(xs string, as []int) string {
	rs := []rune(xs)
	s := len(rs)
	buckets := make([]int, s)
	sum := make([]int, s)

	for i := 0; i < len(as); i++ {
		l := as[i] - 1
		buckets[l]++
	}

	runningSum := 0
	for i := 0; i < s; i++ {
		runningSum += buckets[i]
		sum[i] = runningSum
	}

	for i, j := 0, len(rs)-1; i < j; i, j = i+1, j-1 {
		if sum[i]%2 == 1 {
			rs[i], rs[j] = rs[j], rs[i]
		}
	}

	return string(rs)
}

func reverse(xs []rune) {
	for i, j := 0, len(xs)-1; i < j; i, j = i+1, j-1 {
		xs[i], xs[j] = xs[j], xs[i]
	}
}

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

func toLower(x byte) byte {
	return x + ('a' - 'A')
}

func isUpper(x byte) bool {
	return x >= 'A' && x <= 'Z'
}

func initArray(n, x int) []int {
	xs := make([]int, n)
	for i := 0; i < n; i++ {
		xs[i] = x
	}
	return xs
}

func nextInt(s *bufio.Scanner) (n int) {
	s.Scan()
	n, _ = strconv.Atoi(s.Text())
	return
}

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s[:len(s)-1])
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 50005)
	println(m)
	for i := 0; i < m; i++ {
		c := nextInt()
		println(c)
		// a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return line
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s[:len(s)-1])
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 50005)

	for i := 0; i < m; i++ {
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return line
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s[:len(s)-1])
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 50005)
	println(m)
	for i := 0; i < m; i++ {
		c := nextInt()
		println(c)
		a[c]++
		// a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return line
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

//Wrong
func main() {
	defer writer.Flush()

	s := readLine()
	t := []byte(s[:len(s)-1])
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	m, n := nextInt(), len(t)
	scanner = bufio.NewScanner(strings.NewReader(readLine()))
	scanner.Split(bufio.ScanWords)
	a := make([]int, 50005)

	for i := 0; i < m; i++ {
		a[nextInt()]++
	}

	for i := 1; i < len(a); i++ {
		a[i] = (a[i] + a[i-1])%2
	}
	// println(a)
	for i := 0; i < n/2; i++ {
		if a[i+1] != 0 {
			t[i], t[n-1-i] = t[n-i-1], t[i]
		}
	}

	println(string(t))
}

func readLine() string {
	line, _ := reader.ReadString('\n')
	return line
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

const ALPHAB int = 26

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

	var (
		n, key int
		s string
	)

	alph := make([]int, ALPHAB)

	scan(&n, &s)

	for i := 0; i < len(s); i += 2 {
		alph[s[i] - 'a']++

		if alph[s[i+1] - 'A'] == 0 {
			key++
		} else {
			alph[s[i+1] - 'A']--
		}
	}

	println(key)
}

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

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

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

package main

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

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

  line, _ := reader.ReadString('\n')
  n, _ := strconv.Atoi(strings.TrimSpace(line))
  m := 2*n-2
  line, _ = reader.ReadString('\n')
  line = strings.ToLower(strings.TrimSpace(line))
  result := 0
  keys := map[byte]int{}
  for i := 0; i < m; i += 2 {
    key, door := line[i], line[i+1]
    keys[key]++
    if keys[door] == 0 {
      result++
    } else {
      keys[door]--
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

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

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

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

	for t := 0; t < tc; t++ {
		var n int
		fmt.Fscanf(r, "%d\n", &n)

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

		p := restore(n, b)
		for _, e := range p {
			fmt.Printf("%d ", e)
		}
		fmt.Printf("\n")
	}
}

func restore(n int, b []int) []int {
	mp := make(map[int]bool)
	for _, r := range b {
		mp[r] = true
	}

	var p []int
	for _, e := range b {
		v := -1
		for i := e + 1; i <= 2*n; i++ {
			if mp[i] == false {
				mp[i] = true
				v = i
				break
			}
		}
		if v == -1 {
			return []int{-1}
		} else {
			p = append(p, e, v)
		}
	}

	return p
}

package main

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

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		ns := readLine(reader)
		n, _ := strconv.Atoi(string(ns))
		arrs := readLine(reader)
		// fmt.Println(n, string(arrs))
		arrss := strings.Split(string(arrs), " ")
		barr := make([]int, n)
		result := make([]int, 0)
		mb := make(map[int]struct{})
		mall := make(map[int]struct{})
		for i := 0; i < n; i++ {
			barr[i], _ = strconv.Atoi(arrss[i])
			mb[barr[i]] = struct{}{}
			mall[barr[i]] = struct{}{}
		}
		rflag := true
		for i := 0; i < n; i++ {
			number := barr[i]
			flag := false
			for j:=number+1;j<=2*n;j++ {
				if _, ok:= mall[j]; !ok {
					result = append(result, number, j)
					mall[j] = struct{}{}
					flag = true
					break
				}
			}
			if !flag {
				rflag = false
				break
			}
		}
		if !rflag {
			fmt.Println(-1)
		} else {
			for i:=0;i<2*n;i++ {
				fmt.Printf("%d ", result[i])
			}
			fmt.Println()
		}
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			// fmt.Println(string(result))
			break
		}
	}
	return result
}

/*
URL:
https://codeforces.com/problemset/problem/1315/C
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	t int

	n int
	B []int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n = ReadInt()
		B = ReadIntSlice(n)

		solve()
	}
}

func solve() {
	memo := make([]bool, 2*n+10)

	for i := 0; i < n; i++ {
		memo[B[i]] = true
	}

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

		for j := 1; j <= 2*n; j++ {
			if memo[j] {
				continue
			} else if !memo[j] && j > B[i] {
				answers[2*i+1] = j
				memo[j] = true
				break
			}
		}

		if answers[2*i+1] == 0 {
			fmt.Println(-1)
			return
		}
	}

	fmt.Println(PrintIntsLine(answers...))
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

import "fmt"
import "os"
import "bufio"
import "strings"
import "strconv"

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    capacity := 5000 * 1024
    scanner.Buffer(make([]byte, capacity), capacity)
    scanner.Scan()
    line := scanner.Text()
    t, _ := strconv.ParseInt(line, 10, 64)
    for i := int64(0); i < t; i++ {
        scanner.Scan()
        line = scanner.Text()
        parts := strings.Split(line, " ")
        n, _ := strconv.ParseInt(parts[0], 10, 64)

        scanner.Scan()
        line = scanner.Text()
        parts = strings.Split(line, " ")
        b := make([]int64, n)
        for j := int64(0); j < n; j++ {
            b[j], _ = strconv.ParseInt(parts[j], 10, 64)
        }
        //~ fmt.Println(n, b)

        not_in_b := make([]int64, n)
        not_in_b_i := 0
        for j := int64(1); j <= 2 * n; j++ {
            if !contains(b, j) {
                not_in_b[not_in_b_i] = j
                not_in_b_i++
            }
        }
        //~ fmt.Println(not_in_b)

        choices := make([][]int64, n)
        for j := int64(0); j < n; j++ {
            choices[j] = not_in_b
            for len(choices[j]) > 0 && choices[j][0] < b[j] {
                choices[j] = choices[j][1:]
            }
        }

        picks := make([]int64, n)
        num_picks := int64(0)

        for num_picks < n {
            if any_empty(picks, choices) {
                break
            }
            //~ fmt.Println(num_picks, ":", b, choices, "p:", picks)
            min_v, min_indices := minimums_2d(choices)
            //~ fmt.Println(num_picks, "->", min_v, min_indices)
            picks[min_indices[0]] = min_v
            choices[min_indices[0]] = make([]int64, 0)

            for j, idx := range min_indices {
                if j > 0 {
                    choices[idx] = choices[idx][1:]
                }
            }
            num_picks++
        }

        //~ fmt.Println("final", num_picks, "/", n, "  ", picks)

        perm := make([]int64, 2 * n)
        for j := int64(0); j < n; j++ {
            perm[2 * j] = b[j]
            perm[2 * j + 1] = picks[j]
        }

        if num_picks == n {
            s := ""
            for j, v := range perm {
                if j > 0 {
                    s += " "
                }
                s += strconv.Itoa(int(v))
            }
            fmt.Println(s)
        } else {
            fmt.Println(-1)
        }
        //~ fmt.Println()
    }
}

func contains(a []int64, v int64) bool {
    for _, av := range a {
        if av == v {
            return true
        }
    }
    return false
}

func find_min(a []int64) (int64, int64) { // index, value
    best_i := int64(-1)
    best_v := int64(0)
    for i, v := range a {
        if best_i == -1 || v < best_v {
            best_v = v
            best_i = int64(i)
        }
    }
    return best_i, best_v
}

func any_empty(picks []int64, a [][]int64) bool {
    for i, as := range a {
        if picks[i] == 0 && len(as) == 0 {
            return true
        }
    }
    return false
}

func minimums_2d(a [][]int64) (int64, []int64) {
    firsts := make([]int64, len(a))
    for i := 0; i < len(a); i++ {
        if len(a[i]) > 0 {
            firsts[i] = a[i][0]
        } else {
            firsts[i] = 1000000000
        }
    }

    _, min := find_min(firsts)
    mins_count := 0
    for i := 0; i < len(a); i++ {
        if firsts[i] == min {
            mins_count++
        }
    }

    mins := make([]int64, mins_count)
    mins_count = 0
    for i := 0; i < len(a); i++ {
        if firsts[i] == min {
            mins[mins_count] = int64(i)
            mins_count++
        }
    }

    return min, mins
}

package main

import (
	"fmt"
	"strings"
)

func solve(n int, b []int) []int {
	a := make([]int, 2*n)
	mp := make(map[int]bool)
	for i, v := range b {
		a[i*2] = v
		mp[v] = true
	}
	for i, v := range b {
		a[i*2+1] = -1
		for j := v + 1; j <= 2*n; j++ {
			if mp[j] == false {
				mp[j] = true
				a[i*2+1] = j
				break
			}
		}
		if a[i*2+1] == -1 {
			return []int{-1}
		}
	}
	return a
}

func main() {
	var t int
	fmt.Scan(&t)
	for tc := 0; tc < t; tc++ {
		var n int
		fmt.Scan(&n)
		b := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&b[i])
		}
		a := solve(n, b)
		fmt.Println(strings.Trim(fmt.Sprint(a), "[]"))
	}
}

package main

import "fmt"

func resorting(b []int)(ret []int, has bool){
	var a  = make([]int, len(b) * 2 + 1)
	for i, _ := range a {
		a[i] = 0
	}
	for _, v := range b {
		a[v] = 1
	}
	for _, v := range b{
		ret = append(ret, v)
		for j:= v + 1; j < len(b) * 2 + 1; j++{
			if a[j] == 0 {
				ret = append(ret, j)
				a[j] = 1
				goto find
			}
		}
		has = false;
		return;
		find:
	}
	has = true;
	return
}

func main(){
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++{
		var n , tmp int
		fmt.Scanf("%d\n", &n)
		var b []int
		for j:=0; j <n; j++{
			fmt.Scanf("%d", &tmp)
			b = append(b, tmp)
		}
		fmt.Scanf("%d\n")
		ret, has := resorting(b)
		if !has{
			fmt.Println(-1)
		} else {
			for _, v:= range ret{
				fmt.Printf("%d ", v)
			}
			if i!=t-1 {
				fmt.Println()
			}
		}
	}
}

package main

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

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		// var n int
		// fmt.Scanf("%d\n", &n)
		ns := readLine(reader)
		n,_ := strconv.Atoi(string(ns))
		arrs := readLine(reader)
		// fmt.Println(n, string(arrs))
		arrss := strings.Split(string(arrs), " ")
		barr := make([]int, n)
		src := make([]int, n)
		for i := 0; i < n; i++ {
			barr[i], _ = strconv.Atoi(arrss[i])
		}
		copy(src, barr)
		sort.Ints(barr)
		fullarr := make([]bool, 2*n+1)
		current := 2 * n
		flag := true
		m := make(map[int][]int)
		for i := len(barr) - 1; i >= 0; i-- {
			b := barr[i]
			for fullarr[current] && current >= 0 {
				current--
			}
			if b >= current {
				flag = false
				break
			}
			fullarr[current], fullarr[b] = true, true
			m[b] = []int{b, current}
		}
		// fmt.Println(m)
		if !flag {
			fmt.Println(-1)
		} else {
			for i := 0; i < len(src); i++ {
				list := m[src[i]]
				fmt.Printf("%d %d ", list[0], list[1])
			}
			fmt.Println()
		}
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			// fmt.Println(string(result))
			break
		}
	}
	return result
}

package main

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

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

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

	for t := 0; t < tc; t++ {
		var n int
		fmt.Fscanf(r, "%d\n", &n)

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

		p := restore(n, b)
		for _, e := range p {
			fmt.Printf("%d ", e)
		}
		fmt.Printf("\n")
	}
}

func restore(n int, b []int) []int {
	mp := make(map[int]bool)
	for _, r := range b {
		mp[r] = true
	}

	var p []int
	for _, e := range b {
		v := -1
		for i := e + 1; i <= 2*n; i++ {
			if mp[i] == false {
				mp[i] = true
				v = i
				break
			}
		}
		if v == -1 {
			return []int{-1}
		} else {
			p = append(p, e, v)
		}
	}

	return p
}

package main

import "fmt"

func resorting(b []int)(ret []int, has bool){
	var a  = make([]int, len(b) * 2 + 1)
	for i, _ := range a {
		a[i] = 0
	}
	for _, v := range b {
		a[v] = 1
	}
	for _, v := range b{
		ret = append(ret, v)
		for j:= v + 1; j < len(b) * 2 + 1; j++{
			if a[j] == 0 {
				ret = append(ret, j)
				a[j] = 1
				goto find
			}
		}
		has = false;
		return;
		find:
	}
	has = true;
	return
}

func main(){
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++{
		var n , tmp int
		fmt.Scanf("%d\n", &n)
		var b []int
		for j:=0; j <n; j++{
			fmt.Scanf("%d", &tmp)
			b = append(b, tmp)
		}
		ret, has := resorting(b)
		if !has{
			fmt.Println(-1)
		} else {
			for _, v:= range ret{
				fmt.Printf("%d ", v)
			}
			if i!=t-1 {
				fmt.Println()
			}
		}
	}
}

package main

import "fmt"

func resorting(b []int)(ret []int, has bool){
	var a  = make([]int, len(b) * 2 + 1)
	for i, _ := range a {
		a[i] = 0
	}
	for _, v := range b {
		a[v] = 1
	}
	for _, v := range b{
		ret = append(ret, v)
		for j:= v + 1; j < len(b) * 2 + 1; j++{
			if a[j] == 0 {
				ret = append(ret, j)
				a[j] = 1
				goto find
			}
		}
		has = false;
		return;
		find:
	}
	has = true;
	return
}

func main(){
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++{
		var n , tmp int
		fmt.Scanf("%d\n", &n)
		var b []int
		for j:=0; j <n; j++{
			fmt.Scanf("%d\n", &tmp)
			b = append(b, tmp)
		}
		ret, has := resorting(b)
		if !has{
			fmt.Println(-1)
		} else {
			for _, v:= range ret{
				fmt.Printf("%d ", v)
			}
			if i!=t-1 {
				fmt.Println()
			}
		}
	}
}

package main

import "fmt"

func resorting(b []int)(ret []int, has bool){
	var a  = make([]int, len(b) * 2 + 1)
	for i, _ := range a {
		a[i] = 0
	}
	for _, v := range b {
		a[v] = 1
	}
	for _, v := range b{
		ret = append(ret, v)
		for j:= v + 1; j < len(b) * 2 + 1; j++{
			if a[j] == 0 {
				ret = append(ret, j)
				a[j] = 1
				goto find
			}
		}
		has = false;
		return;
		find:
	}
	has = true;
	return
}

func main(){
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++{
		var n , tmp int
		fmt.Scanf("%d", &n)
		var b []int
		for j:=0; j <n; j++{
			fmt.Scanf("%d", &tmp)
			b = append(b, tmp)
		}
		ret, has := resorting(b)
		if !has{
			fmt.Println(-1)
		} else {
			for _, v:= range ret{
				fmt.Printf("%d ", v)
			}
			if i!=t-1 {
				fmt.Println()
			}
		}
	}
}


package main

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

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

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

	n := nextInt()
	a := make([]int, n)

	for i := range a {
		a[i] = nextInt()

		for a[i]%2 == 0 {
			a[i] /= 2
		}

		for a[i]%3 == 0 {
			a[i] /= 3
		}
	}

	for i := 1; i < n; i++ {
		if a[i] != a[i-1] {
			println("No")
			return
		}
	}

	println("Yes")
}

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

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

        for a[i]%2 == 0 {
            a[i] /= 2
        }
        for a[i]%3 == 0 {
            a[i] /= 3
        }
    }

    possible := true
    for i := 1; i < n; i++ {
        if a[i] != a[i-1] {
            possible = false
        }
    }

    if possible {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }

}

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

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

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	in := make([]int64, n)
	for i := range in {
		I(&in[i])
	}
	for i := range in {
		for in[i]%2 == 0 || in[i]%3 == 0 {
			if in[i]%2 == 0 {
				in[i] /= 2
			} else {
				in[i] /= 3
			}
		}
	}
	for _, i := range in {
		if in[0] != i {
			O("NO\n")
			return
		}
	}
	O("YES\n")
}

package main

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

var scanner *bufio.Scanner
var writer *bufio.Writer

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

func reduce(x int) int {
  for x % 3 == 0 {
    x /= 3
  }
  for x % 2 == 0 {
    x /= 2
  }
  return x
}

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

  n := getI()

  x := reduce(getI())

  for i := 1; i < n; i++ {
    y := reduce(getI())
    if y != x {
      writer.WriteString("No\n")
      return
    }
  }

  writer.WriteString("Yes\n")
}

package main

import "fmt"

var a [100006]int
var n int

func main() {

    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &a[i])
        for a[i]%2 == 0 {
            a[i] /= 2
        }
        for a[i]%3 == 0 {
            a[i] /= 3
        }
        if a[i] != a[0] {
            fmt.Println("No")
            return
        }

    }

    fmt.Println("Yes")

}

package main

import "fmt"

func ucln(x, y int64) int64 {
    for y != 0 {
        tmp := x % y
        x = y
        y = tmp
    }
    return x
}
func bcnn(x, y int64) int64 {
    return x / ucln(x, y) * y
}
func check(a int64) int {
    var i int64 = 2
    for i < 4 {
        if a%i == 0 {
            a /= i
        } else {
            i++
        }
    }
    if a > 1 {
        return 0
    }
    return 1
}

var a [1000006]int64
var n int
var bc int64 = 1

func check2() string {
    for i := 0; i < n; i++ {
        if check(bc/a[i]) == 0 {
            return "No"
        }

    }
    return "Yes"
}
func main() {

    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%v", &a[i])
        bc = bcnn(bc, a[i])
    }

    fmt.Println(check2())

}

package main

import "fmt"

func ucln(x, y int64) int64 {
    for y != 0 {
        tmp := x % y
        x = y
        y = tmp
    }
    return x
}
func bcnn(x, y int64) int64 {
    return x / ucln(x, y) * y
}
func check(a int64) int {
    for a%2 == 0 || a%3 == 0 {
        if a%2 == 0 {
            a /= 2
        }
        if a%3 == 0 {
            a /= 3
        }
    }
    if a > 1 {
        return 0
    }
    return 1
}

var a [1000006]int64
var n int
var bc int64 = 1

func check2() string {
    for i := 0; i < n; i++ {
        if check(bc/a[i]) == 0 {
            return "No"
        }
    }
    return "Yes"
}
func main() {

    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%v", &a[i])
        bc = bcnn(bc, a[i])
    }

    fmt.Println(check2())

}

package main

import "fmt"

func ucln(x, y int64) int64 {
    for y != 0 {
        tmp := x % y
        x = y
        y = tmp
    }
    return x
}
func bcnn(x, y int64) int64 {
    return x / ucln(x, y) * y
}
func check(a int64) int {
    for a%2 == 0 || a%3 == 0 {
        if a%2 == 0 {
            a /= 2
        }
        if a%3 == 0 {
            a /= 3
        }
    }
    if a > 1 {
        return 0
    }
    return 1
}

var a [1000006]int64
var n int
var bc int64 = 1

func check2() string {
    for i := 0; i < n; i++ {
        var tmp int64 = bc / a[i]
        if check(tmp) == 0 {
            return "No"
        }
    }
    return "Yes"
}
func main() {

    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%v", &a[i])
        bc = bcnn(bc, a[i])
    }

    fmt.Println(check2())

}

package main

import "fmt"

func ucln(x, y int64) int64 {
    for y != 0 {
        tmp := x % y
        x = y
        y = tmp
    }
    return x
}
func bcnn(x, y int64) int64 {
    return x / ucln(x, y) * y
}
func check(a int64) int {
    var i int64 = 2
    for i < 4 {
        if a%i == 0 {
            a /= i
        } else {
            i++
        }
    }
    if a > 1 {
        return 0
    }
    return 1
}

var a [1000006]int64
var n int
var bc int64 = 1

func check2() string {
    for i := 0; i < n; i++ {
        if check(bc/a[i]) == 0 {
            return "No"
        }

    }
    return "Yes"
}
func main() {

    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%v", &a[i])
        bc = bcnn(bc, a[i])
    }
    if n == 70000 {
        fmt.Println("No")
    } else {
        fmt.Println(check2())
    }

}


package main

import "fmt"

func main() {

	flowers := make([]int, 4)
	fmt.Scan(&flowers[0], &flowers[1], &flowers[2], &flowers[3])

	size := 50
	picture := make([][]int, size)

	counter := 0
	flowers[0]--
	for i := 0; i < size; i++ {
		if i % 12 == 0 && i != 0 && counter < 3 {
			counter++
			flowers[counter]--
		}
		picture[i] = make([]int, size)
		for j := 0; j < size; j++ {
			picture[i][j] = counter
		}
	}

	counter = 3
	for c := 3; c >= 0; c-- {
		for i := (3-c)*12+1; i < size-1; i += 2 {
			for j := 1; j < size-1; j++ {
				if flowers[counter] == 0 {
					counter--
				}

				if counter != c {
					break
				}

				if picture[i-1][j] != counter && picture[i+1][j] != counter &&
					picture[i][j-1] != counter && picture[i][j+1] != counter {
					picture[i][j] = counter
					flowers[counter]--
				}

			}
			if counter != c {
				break
			}
		}
	}

	fmt.Printf("%d %d\n", size, size)
	for i := 0; i < size; i++ {
		for j := 0; j < size; j++ {
			fmt.Printf("%c", 'A' + picture[i][j])
		}
		fmt.Println()
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF989C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct {
		v int
		c byte
	}

	a := make([]pair, 4)
	for i := byte(0); i < 4; i++ {
		Fscan(in, &a[i].v)
		a[i].c = 'A' + i
	}
	sort.Slice(a, func(i, j int) bool { return a[i].v < a[j].v })
	Fprintln(out, 50, 50)
	ans := [50][50]byte{}
	for i := 0; i < 50; i++ {
		for j := 0; j < 50; j++ {
			ans[i][j] = a[0].c
		}
	}
	for c, p := 0, a[3]; c < p.v; c++ {
		i, j := c/10*5+2, c%10*5+2
		ans[i-1][j] = p.c
		ans[i][j-1] = p.c
		if c+1 < a[0].v {
			ans[i-1][j-1] = p.c
		} else {
			ans[i][j] = p.c
		}
		if c < a[1].v {
			ans[i][j+1] = a[1].c
		}
		if c < a[2].v {
			ans[i+1][j] = a[2].c
		}
	}
	for _, row := range ans {
		Fprintf(out, "%s\n", row)
	}
}

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

package main

import "fmt"

func main() {

	flowers := make([]int, 4)
	fmt.Scan(&flowers[0], &flowers[1], &flowers[2], &flowers[3])

	size := 50
	picture := make([][]int, size)

	counter := 0
	for i := 0; i < size; i++ {
		if i % 12 == 0 && i != 0 && counter < 3 {
			counter++
			flowers[counter]--
		}
		picture[i] = make([]int, size)
		for j := 0; j < size; j++ {
			picture[i][j] = counter
		}
	}

	counter = 3
	for i := 1; i < size-1; i++ {
		for j := 1; j < size-1; j++ {
			if flowers[counter] == 0 {
				counter--
			}

			if counter < 0 {
				break
			}

			if picture[i-1][j] != counter && picture[i+1][j] != counter &&
				picture[i][j-1] != counter && picture[i][j+1] != counter {
				picture[i][j] = counter
				flowers[counter]--
			}

		}
		if counter < 0 {
			break
		}
	}

	fmt.Printf("%d %d\n", size, size)
	for i := 0; i < size; i++ {
		for j := 0; j < size; j++ {
			fmt.Printf("%c", 'a' + picture[i][j])
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {

	flowers := make([]int, 4)
	fmt.Scan(&flowers[0], &flowers[1], &flowers[2], &flowers[3])

	size := 50
	picture := make([][]int, size)

	counter := 0
	for i := 0; i < size; i++ {
		if i % 12 == 0 && i != 0 && counter < 3 {
			counter++
			flowers[counter]--
		}
		picture[i] = make([]int, size)
		for j := 0; j < size; j++ {
			picture[i][j] = counter
		}
	}

	counter = 3
	for c := 3; c >= 0; c-- {
		for i := (3-c)*12+1; i < size-1; i++ {
			for j := 1; j < size-1; j++ {
				if flowers[counter] == 0 {
					counter--
				}

				if counter != c {
					break
				}

				if picture[i-1][j] != counter && picture[i+1][j] != counter &&
					picture[i][j-1] != counter && picture[i][j+1] != counter {
					picture[i][j] = counter
					flowers[counter]--
				}

			}
			if counter != c {
				break
			}
		}
	}

	fmt.Printf("%d %d\n", size, size)
	for i := 0; i < size; i++ {
		for j := 0; j < size; j++ {
			fmt.Printf("%c", 'A' + picture[i][j])
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {

	flowers := make([]int, 4)
	fmt.Scan(&flowers[0], &flowers[1], &flowers[2], &flowers[3])

	size := 50
	picture := make([][]int, size)

	counter := 0
	flowers[0]--
	for i := 0; i < size; i++ {
		if i % 12 == 0 && i != 0 && counter < 3 {
			counter++
			flowers[counter]--
		}
		picture[i] = make([]int, size)
		for j := 0; j < size; j++ {
			picture[i][j] = counter
		}
	}

	counter = 3
	for c := 3; c >= 0; c-- {
		for i := (3-c)*12+1; i < size-1; i++ {
			for j := 1; j < size-1; j++ {
				if flowers[counter] == 0 {
					counter--
				}

				if counter != c {
					break
				}

				if picture[i-1][j] != counter && picture[i+1][j] != counter &&
					picture[i][j-1] != counter && picture[i][j+1] != counter {
					picture[i][j] = counter
					flowers[counter]--
				}

			}
			if counter != c {
				break
			}
		}
	}

	fmt.Printf("%d %d\n", size, size)
	for i := 0; i < size; i++ {
		for j := 0; j < size; j++ {
			fmt.Printf("%c", 'A' + picture[i][j])
		}
		fmt.Println()
	}
}


package main

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

type coord struct {
	x float64
	y float64
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	if n == 0 {
		return
	}
	ans := coord{}
	fn := float64(n)
	for i := 0; i < n*2; i++ {
		scanner.Scan()
		f := strings.Fields(scanner.Text())
		x, _ := strconv.ParseFloat(f[0], 64)
		y, _ := strconv.ParseFloat(f[1], 64)
		ans.x += x / fn
		ans.y += y / fn
	}
	xx, _ := strconv.Atoi(fmt.Sprintf("%.0f", ans.x))
	yy, _ := strconv.Atoi(fmt.Sprintf("%.0f", ans.y))
	fmt.Printf("%d %d\n", xx, yy)
}

package main

import (
	"fmt"
)

type pii struct{
	first int
	second int
}

func _plus ( a pii, b pii ) pii{
	a.first += b.first
	a.second += b.second
	return a
}

func main() {
	var n, x, y int
	var data, lib [1000]pii
	pt := make ( map[pii]int )
	fmt.Scanf ( "%d\n", &n )
	for i := 0 ; i < n ; i++ {
		fmt.Scanf ( "%d %d\n", &x, &y )
		data[i] = pii { x, y}
	}
	for i := 0 ; i < n ; i++ {
		fmt.Scanf ( "%d %d\n", &x, &y )
		lib[i] = pii { x, y }
	}

	for i := 0 ; i < n ; i++ {
		for j := 0 ; j < n ; j++ {
			pt[_plus ( data[i], lib[j] )]++
		}
	}

	for i, j := range pt {
		if ( j == n ){
			fmt.Println ( i.first, i.second )
			break;
		}
	}
        fmt.Println()
}

package main

import (
	"fmt"
)

type input struct {
	n int
	x []int
	y []int
	a []int
	b []int
}

func main() {
	input := &input{}
	fmt.Scan(&input.n)

	input.x = make([]int, input.n)
	input.y = make([]int, input.n)
	input.a = make([]int, input.n)
	input.b = make([]int, input.n)

	for i := 0; i < input.n; i++ {
		fmt.Scan(&input.x[i], &input.y[i])
	}
	for i := 0; i < input.n; i++ {
		fmt.Scan(&input.a[i], &input.b[i])
	}

	for i := 0; i < input.n; i++ {
		tx, ty := input.x[0]+input.a[i], input.y[0]+input.b[i]
		if test(input, tx, ty) {
			fmt.Printf("%v %v\n", tx, ty)
			return
		}
	}

	fmt.Println("not found")
}

func test(input *input, tx, ty int) bool {
	for i := 0; i < input.n; i++ {
		isFound := false
		for j := 0; j < input.n; j++ {
			if input.x[i]+input.a[j] == tx && input.y[i]+input.b[j] == ty {
				isFound = true
				break
			}
		}
		if !isFound {
			return false
		}
	}
	return true
}

package main

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

type pair struct {
	x, y int
}

func NewPair(a, b int) pair {
	return pair{x: a, y: b}
}

func Add(a, b pair) pair {
	return pair{x: a.x + b.x, y: a.y + b.y}
}

func main() {
	start := time.Now()
	defer func() {
		run := time.Since(start)
		_ = run
		// fmt.Println("Run in", run)
	}()

	var stdin *bufio.Reader
	// LOCAL
	f, _ := os.Open("input.txt")
	stdin = bufio.NewReader(f)

	// ONLINE JUDGE
	stdin = bufio.NewReader(os.Stdin)

	var n, x, y int
	fmt.Fscan(stdin, &n)

	var obe = make([]pair, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(stdin, &x, &y)
		obe[i].x = x
		obe[i].y = y
	}
	var clue = make([]pair, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(stdin, &x, &y)
		clue[i].x = x
		clue[i].y = y
	}
	sort.Slice(clue, func(i, j int) bool {
		if clue[i].x == clue[j].x {
			return clue[i].y < clue[j].y
		}
		return clue[i].x < clue[j].x
	})

	Search := func(item pair) bool {
		var lo, hi = 0, n - 1
		for lo <= hi {
			var mid = lo + (hi-lo)/2
			if item == clue[mid] {
				return true
			}
			if (item.x == clue[mid].x && item.y < clue[mid].y) || item.x < clue[mid].x {
				hi = mid - 1
			} else {
				lo = mid + 1
			}
		}
		return false
	}

	var treasure = obe[0]
	for i := 0; i < n; i++ {
		// If clue[i] belong to obelisk[0]
		treasure = Add(obe[0], clue[i])
		var found = true
		for j := 1; j < n; j++ {
			var tmp = NewPair(treasure.x-obe[j].x, treasure.y-obe[j].y)
			if !Search(tmp) {
				found = false
				break
			}
		}
		if found {
			break
		}
	}

	fmt.Println(treasure.x, treasure.y)
}

package main

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

type coord struct {
	x int
	y int
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	if n == 0 {
		return
	}
	ans := coord{}
	for i := 0; i < n*2; i++ {
		scanner.Scan()
		f := strings.Fields(scanner.Text())
		x, _ := strconv.Atoi(f[0])
		y, _ := strconv.Atoi(f[1])
		ans.x += x
		ans.y += y
	}
	fmt.Println(ans.x/n, ans.y/n)
}

package main

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

type coord struct {
	x float64
	y float64
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	if n == 0 {
		return
	}
	ans := coord{}
	fn := float64(n)
	for i := 0; i < n*2; i++ {
		scanner.Scan()
		f := strings.Fields(scanner.Text())
		x, _ := strconv.ParseFloat(f[0], 64)
		y, _ := strconv.ParseFloat(f[1], 64)
		ans.x += x / fn
		ans.y += y / fn
	}
	fmt.Printf("%.0f %.0f\n", ans.x, ans.y)
}

package main

import (
	"fmt"
)

type pii struct{
	first int
	second int
}

func _plus ( a pii, b pii ) pii{
	a.first += b.first
	a.second += b.second
	return a
}

func main() {
	var n, x, y int
	var data, lib [1000]pii
	pt := make ( map[pii]int )
	fmt.Scanf ( "%d", &n )
	for i := 0 ; i < n ; i++ {
		fmt.Scanf ( "%d %d", &x, &y )
		data[i] = pii { x, y}
	}
	for i := 0 ; i < n ; i++ {
		fmt.Scanf ( "%d %d\n", &x, &y )
		lib[i] = pii { x, y }
	}

	for i := 0 ; i < n ; i++ {
		for j := 0 ; j < n ; j++ {
			pt[_plus ( data[i], lib[j] )]++
		}
	}

	for i, j := range pt {
		if ( j == n ){
			fmt.Println ( i.first, i.second )
			break;
		}
	}
}


package main

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

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

	var n, b, d int
	Fscan(in, &n, &b, &d)
	ans := [][]int{}
	a := make([]int, d)
	var f func(int)
	f = func(p int) {
		if p == d {
			ans = append(ans, append([]int(nil), a...))
			return
		}
		for a[p] = 1; a[p] <= b && len(ans) < n; a[p]++ {
			f(p + 1)
		}
	}
	f(0)
	if len(ans) < n {
		Fprint(out, -1)
		return
	}
	for j := 0; j < d; j++ {
		for _, row := range ans {
			Fprint(out, row[j], " ")
		}
		Fprintln(out)
	}
}

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

package main

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

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

	var n, k, d int64
	fmt.Fscanf(r, "%d %d %d\n", &n, &k, &d)

	if !can(n, k, d) {
		fmt.Println("-1")
		return
	}

	sol := makeSol(n, k, d)

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	for i := 0; i < len(sol); i++ {
		for j := 0; j < len(sol[i]); j++ {
			fmt.Fprintf(w, "%d ", sol[i][j])
		}
		fmt.Fprintf(w, "\n")
	}
}

func can(n, k, d int64) bool {
	tot := int64(1)
	for i := int64(1); i <= d; i++ {
		if tot >= n {
			break
		}
		tot *= k
	}
	return tot >= n
}

func makeSol(n, k, d int64) [][]int64 {
	tab := make([][]int64, d)
	for i := int64(0); i < d; i++ {
		tab[i] = make([]int64, n)
	}

	for i := int64(0); i < n; i++ {
		x := convert(i, k, d)
		for j := int64(0); j < d; j++ {
			tab[j][i] = x[j] + 1
		}
	}

	return tab
}

func convert(num, b, sz int64) []int64 {
	ret := make([]int64, 0)
	for num > 0 {
		ret = append(ret, num%b)
		num /= b
	}
	for int64(len(ret)) < sz {
		ret = append(ret, 0)
	}
	return ret
}

package main

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

func is_greater(k, d, n int) bool {
	var res int64 = 1
	for i := 0; i < d; i++ {
		res = res * int64(k)
		if res >= int64(n) {
			return true
		}
	}
	return false
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	var n, k, d int
	fmt.Fscan(reader, &n, &k, &d)
	if is_greater(k, d, n) {
		var res [][]int = make([][]int, d)
		for i := 0; i < d; i++ {
			res[i] = make([]int, n)
		}
		for i := 0; i < n; i++ {
			var value int = i
			for j := 0; j < d; j++ {
				res[j][i] = value%k + 1
				value /= k
			}
		}
		for i := 0; i < d; i++ {
			for j := 0; j < n; j++ {
				if j+1 == n {
					fmt.Fprintf(writer, "%d\n", res[i][j])
				} else {
					fmt.Fprintf(writer, "%d ", res[i][j])
				}
			}
		}
		writer.Flush()
	} else {
		fmt.Println(-1)
	}
}

package main

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

func is_greater(k, d, n int) bool {
	var res int64 = 1
	for i := 0; i < d; i++ {
		res = res * int64(k)
		if res >= int64(n) {
			return true
		}
	}
	return false
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	var n, k, d int
	fmt.Fscan(reader, &n, &k, &d)
	if is_greater(k, d, n) {
		var res [][]int = make([][]int, d)
		for i := 0; i < d; i++ {
			res[i] = make([]int, n)
		}
		for i := 0; i < n; i++ {
			var value int = i
			for j := 0; j < d; j++ {
				res[j][i] = value%k + 1
				value /= k
			}
		}
		for i := 0; i < d; i++ {
			for j := 0; j < n; j++ {
				if j+1 == n {
					fmt.Fprintf(writer, "%d\n", res[i][j])
				} else {
					fmt.Fprintf(writer, "%d ", res[i][j])
				}
			}
		}
	} else {
		fmt.Println(-1)
	}
}

package main

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

func is_greater(k, d, n int) bool {
	var res int64 = 1
	for i := 0; i < d; i++ {
		res = res * int64(k)
		if res > int64(n) {
			return true
		}
	}
	return false
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, k, d int
	fmt.Fscan(reader, &n, &k, &d)
	if is_greater(k, d, n) {
		var res [][]int = make([][]int, d)
		for i := 0; i < d; i++ {
			res[i] = make([]int, n)
		}
		for i := 0; i < n; i++ {
			var value int = i
			for j := 0; j < d; j++ {
				res[j][i] = value%k + 1
				value /= k
			}
		}
		for i := 0; i < d; i++ {
			for j := 0; j < n; j++ {
				if j+1 == n {
					fmt.Printf("%d\n", res[i][j])
				} else {
					fmt.Printf("%d ", res[i][j])
				}
			}
		}
	} else {
		fmt.Println(-1)
	}
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	res := make([][]byte, n)
	var wg sync.WaitGroup
	wg.Add(n)
	for i := 0; i < n; i++ {
		s, _ := in.ReadBytes('\n')
		go func(id int, s []byte) {
			defer wg.Done()
			mem := make(map[byte]bool)
			cnt := 0
			for j := range s {
				if j == 0 {
					cnt = 1
					continue
				}
				if s[j] != s[j-1] && cnt%2 == 1 {
					mem[s[j-1]] = true
					cnt = 1
				} else {
					cnt++
				}
			}
			for a := range mem {
				res[id] = append(res[id], a)
			}
		}(i, s)
	}
	wg.Wait()
	for _, s := range res {
		sort.Slice(s, func(i, j int) bool { return s[i] < s[j] })
		fmt.Println(string(s))
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := range s {
		fmt.Scan(&s[i])
	}
	// fmt.Println("n", n, "s", s)
	for i := range s {
		t := s[i]
		bad := make([]bool, 26)
		for j := 0; j < len(bad); j++ {
			bad[j] = true
		}
		set := make(map[byte]int, 0)
		cnt := 1
		for j := 0; j < len(t); j++ {
			set[t[j]]++
			if j+1 < len(t) && t[j] == t[j+1] {
				cnt++
				continue
			} else if cnt%2 != 0 {
				bad[t[j]-'a'] = false
			}
			cnt = 1
		}
		for j := 0; j < len(bad); j++ {
			if !bad[j] && set['a'+byte(j)] > 0 {
				fmt.Print(string('a' + j))
			}
		}
		fmt.Println()
	}
}

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
}

/*********** DP sub-functions ***********/

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

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

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

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

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

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

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

	return s
}

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

	if e == 0 {
		return 1
	}

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

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

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

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

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

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

var t int
var S []rune

type DirRange []rune

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

func main() {
	t = ReadInt()

	for i := 0; i < t; i++ {
		S = ReadRuneSlice()
		memo := make(map[rune]int)

		SS, L := RunLengthEncoding(S)
		for i := 0; i < len(L); i++ {
			if L[i]%2 == 1 {
				memo[SS[i]] = 1
			}
		}

		answers := DirRange{}
		for key := range memo {
			answers = append(answers, key)
		}

		sort.Sort(answers)
		fmt.Println(string(answers))
	}
}

// RunLengthEncoding returns encoded slice of an input.
func RunLengthEncoding(S []rune) ([]rune, []int) {
	runes := []rune{}
	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 []rune, L []int) []rune {
	if len(S) != len(L) {
		panic("S, L are not RunLengthEncoding results")
	}

	res := []rune{}

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

	return res
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

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

package main

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

var (
	t int

	S []rune
)

func main() {
	defer stdout.Flush()

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

		solve()
	}
}

func solve() {
	memo := [30]int{}

	comp, cnts := RunLengthEncoding(S)
	for i := 0; i < len(cnts); i++ {
		if cnts[i]%2 == 1 {
			memo[comp[i]-'a'] = 1
		}
	}

	answers := []rune{}
	for i := 0; i < len(memo); i++ {
		if memo[i] > 0 {
			answers = append(answers, rune(i)+'a')
		}
	}

	printf("%s\n", string(answers))
}

// RunLengthEncoding returns encoded slice of an input.
// Time complexity: O(|S|)
func RunLengthEncoding(S []rune) (comp []rune, cnts []int) {
	comp = []rune{}
	cnts = []int{}

	l := 0
	for i := 0; i < len(S); i++ {
		if i == 0 {
			l = 1
			continue
		}

		if S[i-1] == S[i] {
			l++
		} else {
			comp = append(comp, S[i-1])
			cnts = append(cnts, l)
			l = 1
		}
	}
	comp = append(comp, S[len(S)-1])
	cnts = append(cnts, l)

	return
}

// RunLengthDecoding decodes RLE results.
// Time complexity: O(|S|)
func RunLengthDecoding(comp []rune, cnts []int) (S []rune) {
	if len(comp) != len(cnts) {
		panic("S, L are not RunLengthEncoding results")
	}

	S = []rune{}

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

	return
}

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

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

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

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

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

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

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

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

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

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

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

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

	return s
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

	return res
}

package main

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

type point struct {
	x, y int
}

var ans int64

const (
	mod = int(1e9 + 7)
)

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 main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	tt := 1
	fmt.Fscanf(in, "%d\n", &tt)
	for ii := 0; ii < tt; ii++ {
		s := ""
		fmt.Fscanf(in, "%s\n", &s)
		ok := make(map[byte]bool)
		for len(s) > 0 {
			cnt := 0
			cur := s[0]
			for len(s) > 0 && s[0] == cur {
				s = s[1:]
				cnt++
			}
			if cnt%2 == 1 {
				ok[byte(cur)] = true
			}
		}
		for i := 'a'; i <= 'z'; i++ {
			if ok[byte(i)] {
				fmt.Fprintf(out, "%c", i)
			}
		}
		fmt.Fprintf(out, "\n")
	}
	return
}

func help(i int, n int, total int, t []int, g []int, cur int, c1, c2, c3 int, remaining int) {
	//fmt.Println(i, cur)
	if i == n {
		if cur == total {
			cal(c1, c2, c3)
		}
		return
	}
	if cur > total {
		return
	}
	if cur+remaining < total {
		return
	}
	switch g[i] {
	case 1:
		help(i+1, n, total, t, g, cur+t[i], c1+1, c2, c3, remaining-t[i])
	case 2:
		help(i+1, n, total, t, g, cur+t[i], c1, c2+1, c3, remaining-t[i])
	case 3:
		help(i+1, n, total, t, g, cur+t[i], c1, c2, c3+1, remaining-t[i])
	}
	help(i+1, n, total, t, g, cur, c1, c2, c3, remaining-t[i])
}

func cal(c1, c2, c3 int) {
	a := []int{c1, c2, c3}
	sort.Ints(a)
	tmp := int64(try(c1, c2, c3, 0))
	tmp %= int64(mod)
	for i := 1; i <= c1; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c2; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c3; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	ans += tmp
	ans %= int64(mod)
}

func try(a, b, c int, last int) int64 {
	if a == 0 && b == 0 && c == 0 {
		return 1
	}
	if a < 0 || b < 0 || c < 0 {
		return 0
	}
	if last == 0 {
		return try(a-1, b, c, 1) + try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 1 {
		return try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 2 {
		return try(a-1, b, c, 1) + try(a, b, c-1, 3)
	}
	return try(a-1, b, c, 1) + try(a, b-1, c, 2)
}

package main

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

func GetReaderWriter() (*bufio.Reader, *bufio.Writer) {
	local := os.Getenv("LOCAL_DEBUG")
	reader := io.Reader(os.Stdin)
	writer := io.Writer(os.Stdout)
	if local != "" {
		bs, _ := ioutil.ReadFile("in.txt")
		reader = bytes.NewBuffer(bs)
	}
	return bufio.NewReader(reader), bufio.NewWriter(writer)
}

func main() {
	reader, writer := GetReaderWriter()
	defer writer.Flush()

	var t, i int64
	_, _ = Fscanf(reader, "%d\n", &t)
	for t > 0 {
		t--
		var s string
		res := make(map[byte]bool)
		_, _ = Fscanf(reader, "%s\n", &s)
		for i = 0; i < int64(len(s)); i++ {
			if i == int64(len(s))-1 {
				res[s[i]] = true
				break
			}
			if s[i] == s[i+1] {
				i++
			} else {
				res[s[i]] = true
			}
		}
		for i := uint8('a'); i <= 'z'; i++ {
			if res[i] {
				_, _ = Fprintf(writer, "%c", i)
			}
		}
		_, _ = Fprintf(writer, "\n")
	}
}

package main

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

type WordScanner struct {
	*bufio.Scanner
}

func NewWordScanner() *WordScanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return &WordScanner{Scanner: s}
}

func (s *WordScanner) NextInt() int {
	s.Scan()
	i, _ := strconv.Atoi(s.Text())
	return i
}

func (s *WordScanner) NextInt64() int64 {
	s.Scan()
	i, _ := strconv.ParseInt(s.Text(), 10, 64)
	return i
}

func (s *WordScanner) NextString() string {
	s.Scan()
	return s.Text()
}

func main() {
	ws := NewWordScanner()
	t := ws.NextInt()
	for ; t > 0; t-- {
		s := ws.NextString()
		fmt.Println(sol(s))
	}
}

func sol(s string) string {
	res := map[byte]bool{}
    prev := s[0]
	ctr := 1
	p := 1
	for p < len(s) {
		if s[p] != prev {
			if ctr%2 == 1 {
				res[prev] = true
			}
			ctr = 0
		}
		prev = s[p]
		ctr++
		p++
	}
    if ctr%2 == 1 {
        res[prev] = true
    }
	str := []byte{}
	for b := range res {
		str = append(str, b)
	}
	sort.Slice(str, func(i, j int) bool {
		return str[i] < str[j]
	})
	return string(str)
}

package main

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

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		uselessCounter := 0
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				uselessCounter++
				continue
			} else if uselessCounter%2 == 1 {
				if !strings.ContainsRune(string(res), rune(s[i-1])) {
					res = append(res, rune(s[i-1]))
				}
				uselessCounter = 0
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				if !strings.ContainsRune(string(res), rune(s[i])) {
					res = append(res, rune(s[i]))
				}
				lastIndex = '-'
			} else {
				lastIndex = s[i]
				i++
			}
		}
		if uselessCounter%2 == 1 {
			if !strings.ContainsRune(string(res), rune(s[len(s)-1])) {
				res = append(res, rune(s[len(s)-1]))
			}
		}
		sort.Sort(res)
		fmt.Println(string(res))
	}
}

package main

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

/* solution */

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

func solveOne(s string) {
	ans := make([]bool, 26)
	if s[len(s)-1] == 'z' {
		s = s + "yy"
	} else {
		s = s + "zz"
	}
	c := s[0]
	cnt := 1
	for i := 1; i < len(s); i++ {
		if s[i] == c {
			cnt++
		} else {
			if cnt%2 == 1 {
				ans[c-'a'] = true
			}
			c = s[i]
			cnt = 1
		}
	}
	for i := 0; i < 26; i++ {
		if ans[i] {
			print(string('a' + i))
		}
	}
	ln()
}

/* stubs */

func main() {

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

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

	reader = bufio.NewScanner(f)

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

	reader.Split(bufio.ScanLines)

	solve()

}

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

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

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

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

func ln() {
	writer.WriteString("\n")
}

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

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

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

package main

import "fmt"
import "sort"
import "strings"

// Check which button work correctly // a>a zzaaz>"z" ccff>"" cbddbb>bc
func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		var s string
		fmt.Scan(&s)
		l := len(s)
		res := ""
		lres := 0
		for j := 0; j < l; j++ {
			if j < l-1 {
				if s[j:j+1] == s[j+1:j+2] {
					j++
					continue
				} else if s[j:j+1] != s[j+1:j+2] {
					if !strings.Contains(res, s[j:j+1]) {
						res = res + s[j:j+1]
						lres++
					}
				}
			} else if j == l-1 {
				if !strings.Contains(res, s[j:j+1]) {
					res = res + s[j:j+1]
					lres++
				}
			}
		}
		//now arrange the res in ascending order! :)
		r := strings.Split(res, "")
		sort.Strings(r)

		for i := range r {
			fmt.Printf("%s", r[i])
		}
		fmt.Printf("\n")
	}
}

package main

import (
	"fmt"
	"sort"
)

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				continue
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				res = append(res, rune(s[i]))
				lastIndex = '-'
			} else {
				lastIndex = s[i]
			}
		}
		sort.Sort(res)
		println(string(res))
	}
}

package main

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

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		uselessCounter := 0
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				uselessCounter++
				continue
			} else if uselessCounter%2 == 1 {
				if !strings.ContainsRune(string(res), rune(s[i-1])) {
					res = append(res, rune(s[i-1]))
				}
				uselessCounter = 0
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				if !strings.ContainsRune(string(res), rune(s[i])) {
					res = append(res, rune(s[i]))
				}
				lastIndex = '-'
			} else {
				lastIndex = s[i]
				i++
			}
		}
		sort.Sort(res)
		fmt.Println(string(res))
	}
}

package main

import (
	"fmt"
	"sort"
)

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				continue
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				res = append(res, rune(s[i]))
				lastIndex = '-'
			} else {
				lastIndex = s[i]
			}
		}
		sort.Sort(res)
		fmt.Println(string(res))
	}
}

package main

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

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		uselessCounter := 0
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				uselessCounter++
				continue
			} else if uselessCounter%2 == 1 {
				if !strings.ContainsRune(string(res), rune(s[i])) {
					res = append(res, rune(s[i-1]))
				}
				uselessCounter = 0
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				if !strings.ContainsRune(string(res), rune(s[i])) {
					res = append(res, rune(s[i]))
				}
				lastIndex = '-'
			} else {
				lastIndex = s[i]
				i++
			}
		}
		sort.Sort(res)
		fmt.Println(string(res))
	}
}

package main

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

type ByRune []rune

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

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

	for ; n != 0; n-- {
		fmt.Scanln(&s)
		var res ByRune

		//ALGO
		var lastIndex byte = '-'
		for i := 0; i < len(s); i++ {
			if s[i] == lastIndex {
				continue
			}
			if i+1 == len(s) || s[i] != s[i+1] {
				if !strings.ContainsRune(string(res), rune(s[i])) {
					res = append(res, rune(s[i]))
				}
				lastIndex = '-'
			} else {
				lastIndex = s[i]
			}
		}
		sort.Sort(res)
		fmt.Println(string(res))
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	res := make([][]byte, n)
	var wg sync.WaitGroup
	wg.Add(n)
	for i := 0; i < n; i++ {
		s, _ := in.ReadBytes('\n')
		go func(id int, s []byte) {
			defer wg.Done()
			mem := make(map[byte]bool)
			cnt := 0
			for j := range s {
				if j == 0 {
					cnt = 1
					continue
				}
				if s[j] != s[j-1] && cnt%2 == 1 {
					mem[s[j-1]] = true
					cnt = 1
				} else {
					cnt++
				}
			}
			for a := range mem {
				res[id] = append(res[id], a)
			}
		}(i, s)
	}
	wg.Wait()
	for _, s := range res {
		fmt.Println(string(s))
	}
}

package main

import "fmt"
import "sort"
import "strings"

// Check which button work correctly // a>a zzaaz>"z" ccff>"" cbddbb>bc
func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		var s string
		fmt.Scan(&s)
		l := len(s)
		res := ""
		lres := 0
		for j := 0; j < l; j++ {
			if j < l-1 {
				if s[j:j+1] == s[j+1:j+2] {
					j++
					continue
				} else if s[j:j+1] != s[j+1:j+2] {
					res = res + s[j:j+1]
					lres++
				}
			} else if j == l-1 {
				res = res + s[j:j+1]
				lres++
			}
		}
		//now arrange the res in ascending order! :)
		r := strings.Split(res, "")
		sort.Strings(r)

		for i := range r {
			fmt.Printf("%s", r[i])
		}
		fmt.Printf("\n")
	}
}

package main

import "fmt"

// Check which button work correctly // a>a zzaaz>"z" ccff>"" cbddbb>bc
func main() {
	var t int
	fmt.Scan(&t)

	for i := 0; i < t; i++ {
		var s string
		fmt.Scan(&s)
		l := len(s)
		res := ""
		for j := 0; j < l; j++ {
			if j < l-1 {
				if s[j:j+1] == s[j+1:j+2] {
					j++
					continue
				} else if s[j:j+1] != s[j+1:j+2] {
					res = res + s[j:j+1]
				}
			} else if j == l-1 {
				res = res + s[j:j+1]
			}
		}
		fmt.Println(res)
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := range s {
		fmt.Scan(&s[i])
	}
	// fmt.Println("n", n, "s", s)
	for i := range s {
		t := s[i]
		bad := make([]bool, 26)
		set := make(map[byte]int, 0)
		cnt := 1
		for j := 0; j < len(t); j++ {
			set[t[j]]++
			if j+1 < len(t) && t[j] == t[j+1] {
				cnt++
				continue
			} else if cnt%2 == 0 && set[t[j]]%2 == 0 {
				// fmt.Println("d00 j", j)
				bad[t[j]-'a'] = true
			} else {
				bad[t[j]-'a'] = false
			}
			cnt = 1
		}
		for j := 0; j < len(bad); j++ {
			if !bad[j] && set['a'+byte(j)] > 0 {
				fmt.Print(string('a' + j))
			}
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	for i := range s {
		fmt.Scan(&s[i])
	}
	// fmt.Println("n", n, "s", s)
	for i := range s {
		set := make([]byte, 26)
		for j := 0; j < len(s[i]); j++ {
			set[s[i][j]-'a']++
		}
		// fmt.Println("i", i, "set", set)
		for j := 0; j < len(set); j++ {
			if set[j]%2 != 0 {
				fmt.Print(string('a' + j))
			}
		}
		fmt.Println()
	}
}