Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there.If there's one thing Petya likes more that receiving gifts, that's watching others giving gifts to somebody else. Thus, he safely hid the laptop until the next New Year and made up his mind to watch his friends exchanging gifts while he does not participate in the process. He numbered all his friends with integers from 1 to n. Petya remembered that a friend number i gave a gift to a friend number pi. He also remembered that each of his friends received exactly one gift.Now Petya wants to know for each friend i the number of a friend who has given him a gift.

package main

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

var n int

func main() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader := bufio.NewReaderSize(stdin, 1<<20)
	fmt.Fscanf(reader, "%d\n", &n)

	m := make(map[int]int)
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscanf(reader, "%d", &x)
		m[x] = i + 1
	}
	for i := 0; i < n; i++ {
		fmt.Print(m[i+1], " ")
	}
}

package main

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

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

package main

import (
	"fmt"
)

func main() {
	var n, i int
	fmt.Scan(&n)
	var arr, r [100]int
	for i = 0; i < n; i++ {
		fmt.Scan(&arr[i])
		r[arr[i]-1] = i + 1
	}
	for i = 0; i < n; i++ {
		fmt.Print(r[i])
		fmt.Print(" ")
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n+1)
	b := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a[i])
		b[a[i]] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Print(b[i])
		fmt.Print(" ")
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, x int
	fmt.Scan(&n)
	p := make([]int, n+1)

	for i := 1; i <= n; i++ {
		fmt.Scan(&x)
		p[x] = i
	}
	fmt.Print(strings.Trim(fmt.Sprint(p[1:]), "[]"))
}

package main

import (
	"fmt"
)

func main() {
	var n, x int
	fmt.Scan(&n)
	p := make([]int, n+1)

	for i := 1; i <= n; i++ {
		fmt.Scan(&x)
		p[x] = i
	}

	for j := 1; j < n; j++ {
		fmt.Printf("%d ", p[j])
	}
	fmt.Printf("%d", p[n])
}

package main

import "fmt"

func main() {
	var n int
	arr := make(map[int]int)
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		var x int
		fmt.Scan(&x)
		arr[x] = i
	}

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

package main

import "fmt"

const c_max = 128

func main() {
    var n, f int
    var result[c_max] int
    fmt.Scanf("%d\n", &n)
    for i := 1; i < n; i++ {
        fmt.Scanf("%d", &f)
        result[f] = i
    }
    fmt.Scanf("%d\n", &f)
    result[f] = n

    for i := 1; i <= n; i++ {
        fmt.Printf("%d ", result[i])
    }
    fmt.Print("\n")
}

//  URL: http://codeforces.com/problemset/problem/136/A
//  ~ Basic Implementation Problem

package main

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

func solve(n int, arr []int) [] int {
	ans := make([]int, n)
	for i, val := range arr {
		ans[val - 1] = i + 1
	}
	return ans
}

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &arr[i])
	}
	ans := solve(n, arr)
	for i := 0; i < n; i++ {
		fmt.Fprintf(writer, "%d ", ans[i])
	}
	fmt.Fprintf(writer, "\n")
}

package main

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

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

func scanf(f string, a... interface{}) {
	fmt.Fscanf(reader, f, a...)
}

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

func main() {

	var T, i uint

	scanf("%d \n", &T)
	var temp uint
	m := map[uint]uint{}
	for i=1; i<=T; i++ {
		scanf("%d ", &temp)
		m[temp] = i
	}

	for i=1; i<=T; i++ {
		if i == T {
			fmt.Printf("%d\n", m[i])
			break
		}
		fmt.Printf("%d ", m[i])
	}

}

package main
import (
    "fmt"
)
func main() {
	var temp,n int
	fmt.Scan(&n)
	a := make([]int, n, n)
    for i := 0; i < n; i++ {
	    fmt.Scan(&temp)
	    a[temp-1]=i+1
	}
    for i := 0; i < n; i++ {
	    fmt.Print(a[i])
	    fmt.Print(" ")
	}
}

package main

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

var scanner *bufio.Scanner
func read() string {
    if !scanner.Scan() {
		panic("Scan returned false")
	}
	return scanner.Text()
}
func readInt() int {
	num, _ := strconv.Atoi(read())
	return num
}
func main() {
    scanner = bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    n := readInt()

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

        gfts[curr-1] = i+1
    }

    for _, i := range gfts {
        fmt.Print(i, " ")
    }
}

package main

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

func main() {
	var n, currentVal int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &n)
	arrayOfPs := make([]int, n)
	for index := 0; index < n; index++ {
		fmt.Fscan(reader, &currentVal)
		currentVal--
		arrayOfPs[currentVal] = index + 1
	}
	for index := 0; index < len(arrayOfPs); index++ {
		fmt.Print(arrayOfPs[index], " ")
	}
}

package main

import "fmt"

func main() {
	var testcount, a int
	var arr []int
	fmt.Scanf("%d\n", &testcount)
	for i := 0; i < testcount; i++ {
		fmt.Scanf("%d", &a)
		arr = append(arr, a)
	}
	for i := 1; i <= testcount; i++ {
		for j := 0; j < testcount; j++ {
			if arr[j] == i {
				fmt.Printf("%d ", j+1)
				break
			}
		}
	}
}

package main

import ("fmt")

func main(){
	var n int
	scan(&n)
	var a []int = make([]int, n)
	for i := 1; i <= n; i++{
		var t int
		scan(&t)
		a[t - 1] = i
	}
	for _,k := range a{
		sout(k)
	}
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}

package main

import "fmt"

func main() {
	var n, x int
	fmt.Scan(&n)
	aa := make([]int, n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&x)
		aa[x-1] = i
	}
	for _, a := range aa {
		fmt.Print(a, " ")
	}
}

package main

import "fmt"

func main() {
    var n,t int
    var a [105]int
    fmt.Scan(&n)
    for i := 1; i <= n; i++ {
        fmt.Scan(&t)
        a[t] = i
    }
    for i := 1; i <= n; i++ {
        fmt.Print(a[i])
        if i == n { fmt.Println() } else { fmt.Print(" ") }
    }
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/136/A
// A. Presents
// time limit per test
// 2 seconds
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there.

// If there's one thing Petya likes more that receiving gifts, that's watching others giving gifts to somebody else. Thus, he safely hid the laptop until the next New Year and made up his mind to watch his friends exchanging gifts while he does not participate in the process. He numbered all his friends with integers from 1 to n. Petya remembered that a friend number i gave a gift to a friend number pi. He also remembered that each of his friends received exactly one gift.

// Now Petya wants to know for each friend i the number of a friend who has given him a gift.
// Input

// The first line contains one integer n (1 ≤ n ≤ 100) — the quantity of friends Petya invited to the party. The second line contains n space-separated integers: the i-th number is pi — the number of a friend who gave a gift to friend number i. It is guaranteed that each friend received exactly one gift. It is possible that some friends do not share Petya's ideas of giving gifts to somebody else. Those friends gave the gifts to themselves.
// Output

// Print n space-separated integers: the i-th number should equal the number of the friend who gave a gift to friend number i.

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

	giftMapping := make([]int, n)

	for i := 0; i < n; i++ {
		var pi int
		fmt.Scan(&pi)
		giftMapping[pi-1] = i + 1
	}

	for _, v := range giftMapping {
		fmt.Print(v, " ")
	}
}

package main

// https://codeforces.com/problemset/problem/136/A

import "fmt"

func taskSolution(a []int) string {
	res := make([]int, len(a))
	for i := 0; i < len(a); i += 1 {
		res[a[i]-1] = i + 1
	}
	output := fmt.Sprint(res)
	return output[1 : len(output)-1]
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	a := []int{}
	for i := 0; i < n; i += 1 {
		var ai int
		if _, err := fmt.Scan(&ai); err != nil {
			panic(err)
		}
		a = append(a, ai)
	}

	fmt.Println(taskSolution(a))
}

package main

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

var (
	reader Reader = NewReader()
	writer Writer = NewWriter()
)

type Reader interface {
	Scanf(format string, a ...interface{})
	Int() int
	Int64() int64
	String() string
	IntStream(size int) <-chan int
	IntSlice(size int) []int
	Int64Slice(size int) []int64
	StringSlice(size int) []string
}

type Writer interface {
	Printf(format string, a ...interface{})
	Flush()
}

type readerImpl struct {
	*bufio.Reader
}

func NewReader() Reader {
	return &readerImpl{Reader: bufio.NewReader(os.Stdin)}
}

func (impl *readerImpl) Scanf(f string, a ...interface{}) {
	fmt.Fscanf(impl.Reader, f, a...)
}

func (impl *readerImpl) Int() int {
	var ret int
	impl.Scanf("%d\n", &ret)
	return ret
}

func (impl *readerImpl) Int64() int64 {
	var ret int64
	impl.Scanf("%d\n", &ret)
	return ret
}

func (impl *readerImpl) String() string {
	var ret string
	impl.Scanf("%s\n", &ret)
	return ret
}

func (impl *readerImpl) IntStream(size int) <-chan int {
	c := make(chan int)
	go func() {
		for i := 0; i < size-1; i++ {
			var v int
			impl.Scanf("%d ", &v)
			c <- v
		}
		var v int
		impl.Scanf("%d\n", &v)
		c <- v
	}()
	return c
}

func (impl *readerImpl) IntSlice(size int) []int {
	ret := make([]int, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%d ", &ret[i])
	}
	impl.Scanf("%d\n", &ret[size-1])
	return ret
}

func (impl *readerImpl) Int64Slice(size int) []int64 {
	ret := make([]int64, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%d ", &ret[i])
	}
	impl.Scanf("%d\n", &ret[size-1])
	return ret
}

func (impl *readerImpl) StringSlice(size int) []string {
	ret := make([]string, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%s ", &ret[i])
	}
	impl.Scanf("%s\n", &ret[size-1])
	return ret
}

type writerImpl struct {
	*bufio.Writer
}

func NewWriter() Writer {
	return &writerImpl{Writer: bufio.NewWriter(os.Stdout)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

func main() {
	defer writer.Flush()
	n := reader.Int()
	c := reader.IntStream(n)
	res := make([]int, n)
	for i := 0; i < n; i++ {
		v := <-c
		res[v-1] = i + 1
	}
	for _, r := range res {
		writer.Printf("%d ", r)
	}
}

package main

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

var (
	reader Reader = NewReader()
	writer Writer = NewWriter()
)

type Reader interface {
	Scanf(format string, a ...interface{})
	Int() int
	Int64() int64
	String() string
	IntSlice(size int) []int
	Int64Slice(size int) []int64
	StringSlice(size int) []string
}

type Writer interface {
	Printf(format string, a ...interface{})
	Flush()
}

type readerImpl struct {
	*bufio.Reader
}

func NewReader() Reader {
	return &readerImpl{Reader: bufio.NewReader(os.Stdin)}
}

func (impl *readerImpl) Scanf(f string, a ...interface{}) {
	fmt.Fscanf(impl.Reader, f, a...)
}

func (impl *readerImpl) Int() int {
	var ret int
	impl.Scanf("%d\n", &ret)
	return ret
}

func (impl *readerImpl) Int64() int64 {
	var ret int64
	impl.Scanf("%d\n", &ret)
	return ret
}

func (impl *readerImpl) String() string {
	var ret string
	impl.Scanf("%s\n", &ret)
	return ret
}

func (impl *readerImpl) IntSlice(size int) []int {
	ret := make([]int, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%d ", &ret[i])
	}
	impl.Scanf("%d\n", &ret[size-1])
	return ret
}

func (impl *readerImpl) Int64Slice(size int) []int64 {
	ret := make([]int64, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%d ", &ret[i])
	}
	impl.Scanf("%d\n", &ret[size-1])
	return ret
}

func (impl *readerImpl) StringSlice(size int) []string {
	ret := make([]string, size)
	for i := 0; i < size-1; i++ {
		impl.Scanf("%s ", &ret[i])
	}
	impl.Scanf("%s\n", &ret[size-1])
	return ret
}

type writerImpl struct {
	*bufio.Writer
}

func NewWriter() Writer {
	return &writerImpl{Writer: bufio.NewWriter(os.Stdout)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

func main() {
	defer writer.Flush()
	n := reader.Int()
	pp := reader.IntSlice(n)
	res := make([]int, n)
	for k, v := range pp {
		res[v-1] = k + 1
	}
    for _, r := range res {
        writer.Printf("%d ", r)
    }
}

package main

import (
	"fmt"
)

func main() {
	var q, n int

	fmt.Scanln(&q)
	m := make(map[int]int)

	for i := 0; i < q; i++ {
		fmt.Scanf("%d", &n)
		m[n] = i + 1
	}

	for i := 0; i < q; i++ {
		fmt.Printf("%d ", m[i+1])
	}

}

package main

import "fmt"

func main() {
	var n, a int
	fmt.Scanf("%d\n", &n)
	out := [100]int{}
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		out[a-1] = i + 1
	}
	for i := 0; i < n; i++ {
		fmt.Printf("%d ", out[i])
	}
}

package main

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

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

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

func main() {
	var number, i uint8
	_, _ = fmt.Scanln(&number)
	number++
	var oned = make([]uint8, number, number+3)
	for i = 1; i < number; i++ {
		var p uint8
		scanf("%d", &p)
		oned[p] = i
	}

	fmt.Print(oned[1])
	for i := 2; i < len(oned); i++ {
		fmt.Print(" ", oned[i])
	}
	fmt.Print("\n")

}

package main

import "fmt"

func main() {
	var number,i uint8
	_, _ = fmt.Scanln(&number)
	number++
	var oned = make([]uint8,number)
	for i=1; i<number; i++ {
		var p uint8
		_, _ = fmt.Scan(&p)
		oned[p] = i
	}
	fmt.Print(oned[1])
	for i:=2;i<len(oned);i++ {
		fmt.Print(" ",oned[i])
	}
	fmt.Print("\n")

}

// A. Presents
/*
Little Petya very much likes gifts. Recently he has received a new laptop as a
New Year gift from his mother. He immediately decided to give it to
somebody else as what can be more pleasant than giving somebody gifts.
And on this occasion he organized a New Year party at his place and invited
n his friends there.

If there's one thing Petya likes more that receiving gifts, that's watching
others giving gifts to somebody else. Thus, he safely hid the laptop until the
next New Year and made up his mind to watch his friends exchanging gifts
while he does not participate in the process. He numbered all his friends
with integers from 1 to n. Petya remembered that a friend number i gave a
gift to a friend number pi. He also remembered that each of his friends
received exactly one gift.

Now Petya wants to know for each friend i the number of a friend who has
given him a gift.

Input
The first line contains one integer n (1 ≤ n ≤ 100) — the quantity of friends
Petya invited to the party. The second line contains n space-separated
integers: the i-th number is pi — the number of a friend who gave a gift to
friend number i. It is guaranteed that each friend received exactly one gift.
It is possible that some friends do not share Petya's ideas of giving gifts
to somebody else. Those friends gave the gifts to themselves.

Output
Print n space-separated integers: the i-th number should equal the number of
the friend who gave a gift to friend number i.

Examples
Input
4
2 3 4 1

Output
4 1 2 3

Input
3
1 3 2

Output
1 3 2

Input
2
1 2

Output
1 2
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	n, _ := strconv.Atoi(strings.TrimSpace(input1))

	input2, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input2), " ")

	outArr := make([]int, n)
	for i := 0; i < n; i++ {
		j, _ := strconv.Atoi(arr[i])
		outArr[j-1] = i + 1
	}

	for _, v := range outArr {
		fmt.Print(v, " ")
	}
}

package main

import "fmt"

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

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

	presentsGivenTo := make([]int, len(a))
	for i := 0; i < len(a); i++ {
		presentsGivenTo[a[i]-1] = i + 1
	}
	for i := 0; i < len(a); i++ {
		fmt.Print(presentsGivenTo[i], " ")
	}
}

func main() {
	ShowFriedsPresents()
}

package main

import(
    "fmt"
)

func main(){
    var (
        n   int
        m = make(map[int]int)
    )
    fmt.Scan(&n)
    arr := make([]int,n+1)
    for i:=1;i<=n;i++{
        fmt.Scan(&arr[i])
        m[arr[i]]=i
    }
    for i:=1;i<=n;i++{
        arr[i]=m[i]
        fmt.Print(arr[i]," ")
    }
    fmt.Println()
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a , b[10000] int
	var i int
	for i = 1 ; i <= n ; i++ {
	    fmt.Scan(&a[i])
	}
	for i = 1 ; i <= n ; i++ {
	    b[a[i] - 1] = i
	}
	for i = 0 ; i < n ; i++ {
	    fmt.Print(b[i])
	    fmt.Print(" ")
	}
}

package main

import "fmt"

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

	p := make([]int, n)
	for i := range p {
		var a int
		fmt.Scan(&a)
		p[a-1] = i + 1
	}

	for i, v := range p {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(v)
	}
	fmt.Println()
}

package main

import (
	"fmt"
	"strings"
)

func sliceIntToStr(int_sl []int) []string {
	str_sl := make([]string, len(int_sl))
	for i, n := range int_sl {
		str_sl[i] = fmt.Sprint(n)
	}
	return str_sl
}

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

	var nums []int
	for ; n > 0; n-- {
		var tmp int
		fmt.Scan(&tmp)
		nums = append(nums, tmp)
	}
	reverse_nums := make([]int, len(nums))
	for i, v := range nums {
		reverse_nums[v-1] = i + 1
	}
	fmt.Println(strings.Join(sliceIntToStr(reverse_nums), " "))
}

package main

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

var scanner *bufio.Scanner

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

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

  n := int(getI())
  inverse := map[int]int{}
  for i := 0; i < n; i++ {
    p := int(getI())
    inverse[p] = i+1
  }
  writer.WriteString(fmt.Sprintf("%d", inverse[1]))
  for i := 2; i <= n; i++ {
    writer.WriteString(fmt.Sprintf(" %d", inverse[i]))
  }
  writer.WriteString("\n")
}

package main

import (
	"fmt"
)

func main() {

	n := 0

	var a [120]int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		x := 0
		fmt.Scan(&x)
		a[x-1] = i + 1
	}

	for i := 0; i < n; i++ {
		fmt.Print(a[i], " ")
	}

}

package main

import (
  "fmt"
)

func main() {
  var n, p int
  fmt.Scan(&n)
  arr := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&p)
    arr[p-1] = i+1
  }
  for idx,val := range arr {
    fmt.Print(val)
    if idx != len(arr)-1 {
      fmt.Print(" ")
    }
  }
}

package main

import "fmt"

func main() {
	numberOfFriends := 0
	friendsGifts := make(map[int]int)
	fmt.Scanf("%d\n", &numberOfFriends)

	for i := 0; i < numberOfFriends; i++ {
		ithFriend := 0
		fmt.Scanf("%d", &ithFriend)
		friendsGifts[ithFriend] = i + 1
	}

	for i := 0; i < numberOfFriends; i++ {
		if i == numberOfFriends-1 {
			fmt.Println(friendsGifts[i+1])
		} else {
			fmt.Print(friendsGifts[i+1], " ")
		}
	}
}

// 2 3 4 1
// 1 2 3 4

// 2->1
// 3->2
// 4->3
// 1->4

// 1 2 3 4

package main

import "fmt"

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

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

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

	for i := 0; i < n; i++ {
		fmt.Print(m[i], " ")
	}

}

package main

import(
	"fmt"
)

func main() {
	var n int
	var send, receive [105]int
	fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&send[i])
		receive[send[i]] = i
	}
	for i := 1; i <= n; i++ {
		if i > 1 {
			fmt.Print(" ")
		}
		fmt.Print(receive[i])
	}
}

// http://codeforces.com/problemset/problem/136/A
// A. Presents
// permutacio inverze

package main

import (
	"fmt"
)

func main() {
	var (
		x        []int32
		n, i, xi int32
	)

	fmt.Scan(&n)
	x = make([]int32, n+1, n+1)

	for i = 1; i <= n; i++ {
		fmt.Scan(&xi)
		x[xi] = i
	}

	for i = 1; ; i++ {
		fmt.Print(x[i])
		if i < n {
			fmt.Print(" ")
		} else {
			fmt.Println()
			break
		}
	}
}

// http://codeforces.com/problemset/problem/136/A
// A. Presents
// permutacio inverze

package main

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

func main() {
	var (
		x        []int32
		n, i, xi int32
		in       *bufio.Reader
		out      *bufio.Writer
	)

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

	fmt.Fscan(in, &n)
	x = make([]int32, n+1, n+1)

	for i = 1; i <= n; i++ {
		fmt.Fscan(in, &xi)
		x[xi] = i
	}

	for i = 1; ; i++ {
		fmt.Fprint(out, x[i])
		if i < n {
			fmt.Fprint(out, " ")
		} else {
			fmt.Fprintln(out)
			break
		}
	}
	out.Flush()
}

// http://codeforces.com/problemset/problem/136/A
// A. Presents
// permutacio inverze

package main

import (
	"fmt"
)

func main() {
	var (
		x        []int32
		n, i, xi int32
	)

	fmt.Scan(&n)
	x = make([]int32, n+1, n+1)

	for i = 1; i <= n; i++ {
		fmt.Scan(&xi)
		x[xi] = i
	}

	fmt.Print(x[1])

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

}

// http://codeforces.com/problemset/problem/136/A
// A. Presents
// permutacio inverze

package main

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

func main() {
	var (
		x        []int32
		n, i, xi int32
		bin      *bufio.Reader
		bout     *bufio.Writer
	)

	bin = bufio.NewReader(os.Stdin)
	bout = bufio.NewWriter(os.Stdout)

	fmt.Fscan(bin, &n)
	x = make([]int32, n+1, n+1)

	for i = 1; i <= n; i++ {
		fmt.Fscan(bin, &xi)
		x[xi] = i
	}

	for i = 1; ; i++ {
		fmt.Fprint(bout, x[i])
		if i < n {
			fmt.Fprint(bout, " ")
		} else {
			fmt.Fprintln(bout)
			break
		}
	}
	bout.Flush()
}

package main

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

func main() {
	var scanner *bufio.Scanner
	var lines []string
	var n int

	scanner = bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}

	n, _ = strconv.Atoi(lines[0])
	var gifts = make([]string, n)

	for i, gift := range strings.Fields(lines[1]) {
		index, _ := strconv.Atoi(gift)
		gifts[index-1] = strconv.Itoa(i + 1)
	}

	fmt.Println(strings.Join(gifts, " "))
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	// presentsMap := make(map[int]int, n)
	presents := make([]int, n)
	for i := 0; i < n; i++ {
		var p int
		fmt.Scan(&p)
		presents[p-1] = i
	}
	for _, v := range presents {
		fmt.Print(v + 1)
		fmt.Print(" ")
	}
	fmt.Println()

}

package main
import (
	"fmt"
	"strings"
	"strconv"
)
func main() {
	var n int
	fmt.Scan(&n)
	var arr = make([]int, n)
	var arr2 = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
		arr2[arr[i] - 1] = i + 1
	}
	var str strings.Builder
	for i := 0; i < n; i++{
		str.WriteString(strconv.Itoa(arr2[i]))
		if i < n - 1 {
			str.WriteString(" ")
		}
	}
	fmt.Println(str.String())
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	// Skip first line.
	scanner.Scan()
	scanner.Scan()
	a := strings.Split(scanner.Text(), " ")
	b := make([]int, len(a))
	for i, v := range a {
		val, _ := strconv.Atoi(v)
		b[val-1] = i + 1
	}
	for i, v := range b {
		a[i] = strconv.Itoa(v)
	}
	fmt.Println(strings.Join(a, " "))
}

package main

import "fmt"

func main() {
	var peopleNumber int
	fmt.Scan(&peopleNumber)
	tos := make([]int, peopleNumber)
	for offset := 0; offset < peopleNumber; offset++ {
		var to int
		fmt.Scan(&to)
		tos[to - 1] = offset + 1
	}
	for offset := 0; offset < peopleNumber; offset++ {
		fmt.Print(tos[offset])
		if offset != peopleNumber - 1 {
			fmt.Print(" ")
		}
	}
}

package main
import ("fmt")
func main () {
    var n,t int
    fmt.Scan(&n)
    a := make([]int,n)
    for i:=1;i<=n;i++ {
        fmt.Scan(&t)
        a[t-1]=i
    }
    for i:=0;i<n;i++ {
        fmt.Print(a[i])
        fmt.Print(" ")
    }
}

package main

import "fmt"

func main() {
	var n, j int

	fmt.Scanln(&n)

	m := make(map[int]int)

	for i := 0; i < n ; i++ {
		fmt.Scanf("%d", &j)
		m[j] = i + 1
	}

	for i:=0; i < n; i++{
		fmt.Printf("%d ", m[i+1])
	}
}

package main

import "fmt"

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

	var to int
	giftFroms := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&to)
		giftFroms[to] = i
	}

	for i := 1; i < len(giftFroms); i++ {
		if i != 1 {
			fmt.Print(" ")
		}
		fmt.Print(giftFroms[i])
	}
}

package main

import "fmt"

const c_max = 128

func main() {
    var n, f int
    var result[c_max] int
    fmt.Scan(&n)
    for i := 1; i < n; i++ {
        fmt.Scanf("%d", &f)
        result[f] = i
    }
    fmt.Scanf("%d\n", &f)
    result[f] = n

    for i := 1; i <= n; i++ {
        fmt.Printf("%d ", result[i])
    }
    fmt.Print("\n")
}

package main

import "fmt"

const c_max = 128

func main() {
    var n, f int
    var result[c_max] int
    fmt.Scan(&n)
    for i := 1; i <= n; i++ {
        fmt.Scanf("%d", &f)
        result[f] = i
    }

    for i := 1; i <= n; i++ {
        fmt.Printf("%d ", result[i])
    }
    fmt.Print("\n")
}

package main

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

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

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

func main() {
	var number, i uint8
	_, _ = fmt.Scanln(&number)
	number++
	var oned = make([]uint8, number)
	for i = 1; i < number; i++ {
		var p uint8
		scanf("%d ", &p)
		oned[p] = i
	}
	fmt.Print(oned[1])
	for i := 2; i < len(oned); i++ {
		printf(" %d", oned[i])
	}
	fmt.Print("\n")

}

package main

import (
	"fmt"
)

func main() {

	n := 0

	var a []int

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		x := 0
		fmt.Scan(&x)

		a = append(a, x)
	}
	for i := 0; i < n; i++ {
		fmt.Print(a[a[a[i]-1]-1], " ")
	}

}

package main
import (
	"fmt"
)
func main() {
	var n int
	fmt.Scan(&n)
	var arr = make([]int, n)
	var arr2 = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
		arr2[arr[i] - 1] = i + 1
	}
	fmt.Printf("%v", arr2[0])
	for i := 1; i < n; i++{
		fmt.Printf("%2v", arr2[i])
	}
}


You are given an array $$$a$$$ consisting of $$$n$$$ integers. You can perform the following operations with it:   Choose some positions $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n, i \ne j$$$), write the value of $$$a_i \cdot a_j$$$ into the $$$j$$$-th cell and remove the number from the $$$i$$$-th cell;  Choose some position $$$i$$$ and remove the number from the $$$i$$$-th cell (this operation can be performed no more than once and at any point of time, not necessarily in the beginning). The number of elements decreases by one after each operation. However, the indexing of positions stays the same. Deleted numbers can't be used in the later operations.Your task is to perform exactly $$$n - 1$$$ operations with the array in such a way that the only number that remains in the array is maximum possible. This number can be rather large, so instead of printing it you need to print any sequence of operations which leads to this maximum number. Read the output format to understand what exactly you need to print.

The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$) — the elements of the array.

Print $$$n - 1$$$ lines. The $$$k$$$-th line should contain one of the two possible operations. The operation of the first type should look like this: $$$1~ i_k~ j_k$$$, where $$$1$$$ is the type of operation, $$$i_k$$$ and $$$j_k$$$ are the positions of the chosen elements. The operation of the second type should look like this: $$$2~ i_k$$$, where $$$2$$$ is the type of operation, $$$i_k$$$ is the position of the chosen element. Note that there should be no more than one such operation. If there are multiple possible sequences of operations leading to the maximum number — print any of them.

NoteLet X be the removed number in the array. Let's take a look at all the examples:The first example has, for example, the following sequence of transformations of the array: $$$[5, -2, 0, 1, -3] \to [5, -2, X, 1, -3] \to [X, -10, X, 1, -3] \to$$$ $$$[X, X, X, -10, -3] \to [X, X, X, X, 30]$$$. Thus, the maximum answer is $$$30$$$. Note, that other sequences that lead to the answer $$$30$$$ are also correct.The second example has, for example, the following sequence of transformations of the array: $$$[5, 2, 0, 4, 0] \to [5, 2, X, 4, 0] \to [5, 2, X, 4, X] \to [X, 10, X, 4, X] \to$$$ $$$[X, X, X, 40, X]$$$. The following answer is also allowed: 1 5 31 4 21 2 12 3Then the sequence of transformations of the array will look like this: $$$[5, 2, 0, 4, 0] \to [5, 2, 0, 4, X] \to [5, 8, 0, X, X] \to [40, X, 0, X, X] \to$$$ $$$[40, X, X, X, X]$$$.The third example can have the following sequence of transformations of the array: $$$[2, -1] \to [2, X]$$$.The fourth example can have the following sequence of transformations of the array: $$$[0, -10, 0, 0] \to [X, 0, 0, 0] \to [X, X, 0, 0] \to [X, X, X, 0]$$$.The fifth example can have the following sequence of transformations of the array: $$$[0, 0, 0, 0] \to [X, 0, 0, 0] \to [X, X, 0, 0] \to [X, X, X, 0]$$$.

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	zIndx := make([]int, 0)
	pNIndx := make([]int, 0)
	cntZero := 0
	cntNegative := 0
	mnNeg := -1 << 30
	mnNegIndx := -1
	for _, v := range pairSlice {
		if v.vl != 0 {
			pNIndx = append(pNIndx, v.idx)
		}
		if v.vl < 0 {
			cntNegative++
			if mnNeg < v.vl {
				mnNeg = v.vl
				mnNegIndx = v.idx
			}
		} else if v.vl == 0 {
			zIndx = append(zIndx, v.idx)
			cntZero++
		}
	}

	if cntZero == n || (cntNegative == 1 && cntZero == n-1) {
		for i := 0; i < n-1; i++ {
			fmt.Printf("1 %d %d\n", i+1, i+2)
		}
	} else {
		for i := 0; i < cntZero-1; i++ {
			fmt.Printf("1 %d %d\n", zIndx[i], zIndx[i+1])
		}
		if cntNegative%2 == 1 {
			if cntZero > 0 {
				fmt.Printf("1 %d %d\n", mnNegIndx, zIndx[cntZero-1])
				fmt.Printf("2 %d\n", zIndx[cntZero-1])
			} else {
				fmt.Printf("2 %d\n", mnNegIndx)
			}
		} else if cntZero > 0 {
			fmt.Printf("2 %d\n", zIndx[cntZero-1])
		}
	}

	for i := 0; i < len(pNIndx)-1; i++ {
		act := pNIndx[i]
		nxt := pNIndx[i+1]
		if cntNegative%2 == 1 {
			if act == mnNegIndx {
				if i != 0 {
					fmt.Printf("1 %d %d\n", pNIndx[i-1], nxt)
				}
			} else if nxt != mnNegIndx {
				fmt.Printf("1 %d %d\n", act, nxt)
			}
		} else {
			fmt.Printf("1 %d %d\n", act, nxt)
		}
	}
}

package main

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

const (
	MaxN = 200005
)

type num struct {
	v, index int
}

var n int
var a [MaxN]num
var skipped [MaxN]bool
var zeros, negatives, positives int
var zerosStart int

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(inBuf, "%d", &a[i].v)
		a[i].index = i + 1
	}
	sort.Slice(a[:n], func(i, j int) bool {
		return a[i].v < a[j].v
	})
	zerosStart = -1
	for i := 0; i < n; i++ {
		if a[i].v < 0 {
			negatives++
		} else if a[i].v == 0 {
			if zerosStart == -1 {
				zerosStart = i
			}
			zeros++
		} else {
			positives++
		}
	}
	outBuf := bufio.NewWriter(os.Stdout)
	defer func() { outBuf.Flush() }()

	skip := -1
	operations := 0
	if negatives%2 == 1 {
		skipped[negatives-1] = true
		if zeros > 0 {
			fmt.Fprintf(outBuf, "1 %d %d\n", a[negatives-1].index, a[zerosStart].index)
		} else {
			skip = negatives - 1
			fmt.Fprintf(outBuf, "2 %d\n", a[negatives-1].index)
		}
		operations++
	}
	for zeros > 1 {
		fmt.Fprintf(outBuf, "1 %d %d\n", a[zerosStart].index, a[zerosStart+1].index)
		skipped[zerosStart] = true
		zerosStart++
		zeros--
		operations++
	}
	if skip == -1 && zeros == 1 && operations < n-1 {
		skipped[zerosStart] = true
		fmt.Fprintf(outBuf, "2 %d\n", a[zerosStart].index)
		operations++
	}
	indexes := make([]int, 0)
	for i := 0; i < n; i++ {
		if skipped[i] == true {
			continue
		}
		indexes = append(indexes, i)
	}

	for i := 0; i < len(indexes)-1; i++ {
		fmt.Fprintf(outBuf, "1 %d %d\n", a[indexes[i]].index, a[indexes[i+1]].index)
	}

}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := nL % 2; i < nL-1; i++ {
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 {
		if nL%2 == 0 && (nL > 0 || pL > 0) {
			response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
		} else if nL%2 == 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
			if pL > 0 {
				response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
			}
		}
	} else if nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := nL % 2; i < nL-1; i++ {
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if (nL%2 == 0 && nL > 0 && zL > 0) || (pL > 0 && zL > 0) {
		response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
	}

	if nL%2 == 1 {
		if zL > 0 && nL > 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
		}
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := 0; i < nL-1; i++ {
		if nL%2 == 1 && nS[i].idx == mnNmb.idx {
			continue
		}
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 {
		if nL%2 == 0 && (nL > 0 || pL > 0) {
			response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
		} else if nL%2 == 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
			if pL > 0 {
				response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
			}
		}
	} else if nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	if len(response) != n-1 {
		panic("not n-1 elements")
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	var pNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pNmb = v
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL; i++ {
		if pNmb.idx == pS[i].idx {
			continue
		}
		response = append(response, operation{op: 1, i: pS[i].idx, j: pNmb.idx})
	}

	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}

	for i := 0; i < nL-1; i++ {
		if nL%2 == 1 && nS[i].idx == mnNmb.idx {
			continue
		}
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 && pL > 0 {
		if nL%2 == 1 {
			response = append(response, operation{op: 1, i: mnNmb.idx, j: zS[zL-1].idx})
		}
		response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
	}

	if zL > 0 && pL == 0 {
		if nL%2 == 1 && nL > 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
		}
		if nL > 0 {
			response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
		}
	}

	if zL == 0 && nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if pL > 0 && nL > 1 {
		response = append(response, operation{op: 1, i: nS[nL-1].idx, j: pNmb.idx})
	}

	if len(response) != n-1 {
		panic("not n-1 elements")
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := 0; i < nL-1; i++ {
		if nL%2 == 1 && nS[i].idx == mnNmb.idx {
			continue
		}
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 {
		if nL%2 == 0 && (nL > 0 || pL > 0) {
			response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
		} else if nL%2 == 1 {
			if pL > 0 || nL > 1 {
				response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
			}
			response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
		}
	} else if nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	if len(response) != n-1 {
		panic("not n-1 elements")
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	var pNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pNmb = v
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL; i++ {
		if pNmb.idx == pS[i].idx {
			continue
		}
		response = append(response, operation{op: 1, i: pS[i].idx, j: pNmb.idx})
	}

	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}

	for i := 0; i < nL-1; i++ {
		if nL%2 == 1 && nS[i].idx == mnNmb.idx {
			continue
		}
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 && pL > 0 {
		if nL%2 == 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
		}
		response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
	}

	if zL > 0 && pL == 0 {
		if nL%2 == 1 && nL > 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
		}
		if nL > 0 {
			response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
		}
	}

	if zL == 0 && nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if pL > 0 && nL > 1 {
		response = append(response, operation{op: 1, i: nS[nL-1].idx, j: pNmb.idx})
	}

	if len(response) != n-1 {
		panic("not n-1 elements")
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := 0; i < nL-1; i++ {
		if nS[i].idx == mnNmb.idx {
			continue
		}
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if zL > 0 {
		if nL%2 == 0 && (nL > 0 || pL > 0) {
			response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
		} else if nL%2 == 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
			if pL > 0 {
				response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
			}
		}
	} else if nL%2 == 1 {
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

type pair struct {
	idx int
	vl  int
}

type operation struct {
	op int
	i  int
	j  int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	n := 0
	fmt.Fscan(in, &n)
	pairSlice := make([]pair, n)
	for i := 0; i < n; i++ {
		v := 0
		fmt.Fscan(in, &v)
		pairSlice[i] = pair{idx: i + 1, vl: v}
	}

	pS := make([]pair, 0)
	zS := make([]pair, 0)
	nS := make([]pair, 0)

	var mnNmb pair = pair{idx: -1, vl: 0}
	for _, v := range pairSlice {
		if v.vl > 0 {
			pS = append(pS, v)
		} else if v.vl == 0 {
			zS = append(zS, v)
		} else if v.vl < 0 {
			nS = append(nS, v)
			if mnNmb.vl > v.vl {
				mnNmb = v
			}
		}
	}

	pL := len(pS)
	zL := len(zS)
	nL := len(nS)

	if nL%2 == 1 && nS[nL-1].idx == mnNmb.idx {
		nS[0], nS[nL-1] = nS[nL-1], nS[0]
	}

	response := make([]operation, 0)
	for i := 0; i < pL-1; i++ {
		response = append(response, operation{op: 1, i: pS[i].idx, j: pS[pL-1].idx})
	}
	for i := 0; i < zL-1; i++ {
		response = append(response, operation{op: 1, i: zS[i].idx, j: zS[zL-1].idx})
	}
	for i := nL % 2; i < nL-1; i++ {
		response = append(response, operation{op: 1, i: nS[i].idx, j: nS[nL-1].idx})
	}

	if (nL%2 == 0 && nL > 0 && zL > 0) || (nL%2 == 0 && pL > 0 && zL > 0) {
		response = append(response, operation{op: 2, i: zS[zL-1].idx, j: 0})
	}

	if nL%2 == 1 {
		if zL > 0 && nL > 1 {
			response = append(response, operation{op: 1, i: zS[zL-1].idx, j: mnNmb.idx})
		}
		response = append(response, operation{op: 2, i: mnNmb.idx, j: 0})
	}

	if nL > 1 && pL > 0 {
		response = append(response, operation{op: 1, i: pS[pL-1].idx, j: nS[nL-1].idx})
	}

	for _, op := range response {
		if op.op == 1 {
			fmt.Printf("1 %d %d\n", op.i, op.j)
		} else {
			fmt.Printf("2 %d\n", op.i)
		}
	}
}

package main

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

const (
	MaxN = 200005
)

type num struct {
	v, index int
}

var n int
var a [MaxN]num
var zeros, negatives, positives int
var zerosStart, zerosEnd int

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(inBuf, "%d", &a[i].v)
		a[i].index = i+1
	}
	sort.Slice(a[:n], func(i, j int) bool {
		return a[i].v < a[j].v
	})
	zerosStart, zerosEnd = -1, -1
	for i := 0; i < n; i++ {
		if a[i].v < 0 {
			negatives++
		} else if a[i].v == 0 {
			if zerosStart == -1 {
				zerosStart = i
			}
			zeros++
			zerosEnd = i
		} else {
			positives++
		}
	}
	outBuf := bufio.NewWriter(os.Stdout)
	defer func() { outBuf.Flush() } ()

	skip := -1
	if negatives % 2 == 1 {
		skip = negatives - 1
	} else if zeros > 0 {
		skip = zerosStart
	}
	indexes := make([]int, 0)
	if skip != -1 {
		fmt.Fprintf(outBuf, "2 %d\n", a[skip].index)
	}
	for i := 0; i < n; i++ {
		if skip == i {
			continue
		}
		indexes = append(indexes, i)
	}
	d := 0
	if skip != -1 {
		d = 1
	}
	for i := 0; i < n - 1 - d; i++ {
		fmt.Fprintf(outBuf, "1 %d %d\n", a[indexes[i]].index, a[indexes[i+1]].index)
	}

}

package main

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

const (
	MaxN = 200005
)

type num struct {
	v, index int
}

var n int
var a [MaxN]num
var zeros, negatives, positives int
var zerosStart, zerosEnd int

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(inBuf, "%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(inBuf, "%d", &a[i].v)
		a[i].index = i+1
	}
	sort.Slice(a[:n], func(i, j int) bool {
		return a[i].v < a[j].v
	})
	zerosStart, zerosEnd = -1, -1
	for i := 0; i < n; i++ {
		if a[i].v < 0 {
			negatives++
		} else if a[i].v == 0 {
			if zerosStart == -1 {
				zerosStart = i
			}
			zeros++
			zerosEnd = i
		} else {
			positives++
		}
	}
	outBuf := bufio.NewWriter(os.Stdout)
	defer func() { outBuf.Flush() } ()

	start := -1
	for i := 0; i < negatives - 1 - negatives % 2; i++ {
		fmt.Fprintf(outBuf, "1 %d %d\n", a[i].index, a[i + 1].index)
		start = i + 1
		n--
	}

	if negatives % 2 == 1 {
		if start == -1 {
			fmt.Fprintf(outBuf, "2 %d\n", a[0].index)
		} else {
			fmt.Fprintf(outBuf, "2 %d\n", a[start + 1].index)
		}
		n--
	}

	for n > 1 && zeros > 0 {
		fmt.Fprintf(outBuf, "2 %d\n", a[zerosStart].index)
		zeros--
		zerosStart++
		n--
	}

	if positives > 0 {
		if start != -1 {
			fmt.Fprintf(outBuf, "1 %d %d\n", a[start].index, a[zerosEnd+1].index)
			n--
		}
		for i := zerosEnd + 1; n > 1; i++ {
			fmt.Fprintf(outBuf, "1 %d %d\n", a[i].index, a[i+1].index)
			n--
		}
	}
}


Valya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullover. Now she doesn't want to see him and Tolya is seating at his room and crying at her photos all day long.This story could be very sad but fairy godmother (Tolya's grandmother) decided to help them and restore their relationship. She secretly took Tolya's t-shirt and Valya's pullover and wants to make the letterings on them same. In order to do this, for one unit of mana she can buy a spell that can change some letters on the clothes. Your task is calculate the minimum amount of mana that Tolya's grandmother should spend to rescue love of Tolya and Valya.More formally, letterings on Tolya's t-shirt and Valya's pullover are two strings with same length n consisting only of lowercase English letters. Using one unit of mana, grandmother can buy a spell of form (c1, c2) (where c1 and c2 are some lowercase English letters), which can arbitrary number of times transform a single letter c1 to c2 and vise-versa on both Tolya's t-shirt and Valya's pullover. You should find the minimum amount of mana that grandmother should spend to buy a set of spells that can make the letterings equal. In addition you should output the required set of spells.

The first line contains a single integer n (1 ≤ n ≤ 105) — the length of the letterings. The second line contains a string with length n, consisting of lowercase English letters — the lettering on Valya's pullover. The third line contains the lettering on Tolya's t-shirt in the same format.

In the first line output a single integer — the minimum amount of mana t required for rescuing love of Valya and Tolya. In the next t lines output pairs of space-separated lowercase English letters — spells that Tolya's grandmother should buy. Spells and letters in spells can be printed in any order. If there are many optimal answers, output any.

NoteIn first example it's enough to buy two spells: ('a','d') and ('b','a'). Then first letters will coincide when we will replace letter 'a' with 'd'. Second letters will coincide when we will replace 'b' with 'a'. Third letters will coincide when we will at first replace 'b' with 'a' and then 'a' with 'd'.

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())

	djset := NewDJSet(64)
	res := make([]string, 0)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Union(rootA, rootB) {
				res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
			}
		}
	}
	fmt.Println(len(res))
	if len(res) > 0 {
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF939D(_r io.Reader, _w io.Writer) {
	fa := make([]byte, 'z'+1)
	for i := range fa {
		fa[i] = byte(i)
	}
	var find func(byte) byte
	find = func(x byte) byte {
		if fa[x] != x {
			fa[x] = find(fa[x])
		}
		return fa[x]
	}
	merge := func(from, to byte) { fa[find(from)] = find(to) }
	same := func(x, y byte) bool { return find(x) == find(y) }
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n int
	var s1, s2 []byte
	Fscan(in, &n, &s1, &s2)
	ans := [][2]byte{}
	for i, c := range s1 {
		if !same(c, s2[i]) {
			merge(c, s2[i])
			ans = append(ans, [2]byte{c, s2[i]})
		}
	}
	Fprintln(out, len(ans))
	for _, a := range ans {
		Fprintf(out, "%c %c\n", a[0], a[1])
	}
}

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

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())

	djset := NewDJSet(26)
	res := make([]string, 0)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Equiv(rootA, rootB) {
				ok := false
				// for j := 0; j < 26; j++ {
				// 	if djset.Equiv(rootA, j) && djset.Equiv(rootB, j) {
				// 		djset.Union(rootA, j)
				// 		djset.Union(rootB, j)
				// 		res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(j+'a')))
				// 		res = append(res, fmt.Sprintf("%s %s", string(b[i]), string(j+'a')))
				// 		break
				// 	}
				// }
				if !ok {
					djset.Union(rootA, rootB)
					res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
				}
			}
		}
	}
	if len(res) > 0 {
		fmt.Println(len(res))
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())

	djset := NewDJSet(64)
	res := make([]string, 0)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Union(rootA, rootB) {
				res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
			}
		}
	}
	if len(res) > 0 {
		fmt.Println(len(res))
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())
	fmt.Println(len(a))
	fmt.Println(len(b))

	djset := NewDJSet(64)
	res := make([]string, 0)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Union(rootA, rootB) {
				res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
			}
		}
	}
	fmt.Println(len(res))
	if len(res) > 0 {
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())
	djset := NewDJSet(26)
	res := make([]string, 0)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Equiv(rootA, rootB) {
				if djset.CountByRoot(rootA) > 1 {
					djset.Union(rootA, rootB)
					res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
				} else if djset.CountByRoot(rootB) > 1 {
					djset.Union(rootA, rootB)
					res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
				} else {
					djset.Union(rootA, rootB)
					res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
				}
			}
		}
	}
	// for i := 0; i < 26; i++ {
	// 	cnt := djset.CountByRoot(i)
	// 	if cnt > 1 {
	// 		fmt.Println(i, cnt)
	// 	}
	// }
	if len(res) > 0 {
		fmt.Println(len(res))
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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

package main

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

func solve() {
	_ = readInt()
	a := []byte(readString())
	b := []byte(readString())

	djset := NewDJSet(26)
	res := make([]string, 0)
	mm := make([][]bool, 26)
	for i := 0; i < 26; i++ {
		mm[i] = make([]bool, 26)
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			mm[rootA][rootB] = true
			mm[rootB][rootA] = true
		}
	}
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			rootA := int(a[i] - 'a')
			rootB := int(b[i] - 'a')
			if !djset.Equiv(rootA, rootB) {
				ok := false
				for j := 0; j < 26; j++ {
					if mm[rootA][j] && mm[rootB][j] {
						ok = true
						djset.Union(rootA, j)
						djset.Union(rootB, j)
						res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(j+'a')))
						res = append(res, fmt.Sprintf("%s %s", string(b[i]), string(j+'a')))
						break
					}
				}
				if !ok {
					djset.Union(rootA, rootB)
					res = append(res, fmt.Sprintf("%s %s", string(a[i]), string(b[i])))
				}
			}
		}
	}
	if len(res) > 0 {
		fmt.Println(len(res))
		for _, v := range res {
			fmt.Println(v)
		}
	}
}

type DJSet struct {
	upper  []int
	byroot [][]int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n), byroot: make([][]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
		s.byroot[i] = make([]int, 1)
		s.byroot[i][0] = i
	}
	return &s
}

func (s *DJSet) Root(x int) int {
	if s.upper[x] < 0 {
		return x
	} else {
		s.upper[x] = s.Root(s.upper[x])
	}
	return s.upper[x]
}

func (s *DJSet) Union(x, y int) bool {
	x = s.Root(x)
	y = s.Root(y)
	if x != y {
		if s.upper[y] < s.upper[x] {
			x, y = y, x
		}
		s.byroot[x] = append(s.byroot[x], s.byroot[y]...)
		s.upper[x] += s.upper[y]
		s.upper[y] = x
	}
	return x == y
}

func (s *DJSet) Equiv(x, y int) bool {
	return s.Root(x) == s.Root(y)
}

func (s *DJSet) Upper(y int) int {
	return s.upper[y]
}

func (s *DJSet) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func (s *DJSet) CountByRoot(root int) int {
	return -s.upper[root]
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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


You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 < r_1$$$ and $$$l_2 < r_2$$$. Segments may intersect, overlap or even coincide with each other.    The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$$b$$$ such that $$$l_1 \le a \le r_1$$$, $$$l_2 \le b \le r_2$$$ and $$$a \ne b$$$. In other words, you have to choose two distinct integer points in such a way that the first point belongs to the segment $$$[l_1; r_1]$$$ and the second one belongs to the segment $$$[l_2; r_2]$$$.It is guaranteed that the answer exists. If there are multiple answers, you can print any of them.You have to answer $$$q$$$ independent queries.

The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) — the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} < r_{1_i}, l_{2_i} < r_{2_i}$$$) — the ends of the segments in the $$$i$$$-th query.

Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ — such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers, you can print any.

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

func readInt() int {
	var ch byte
	var err error
	for {
		ch, err = reader.ReadByte()
		if err != nil {
			return 0
		}
		if unicode.IsDigit(rune(ch)) {
			break
		}
	}
	result := int(ch & 0xf)
	for {
		ch, err = reader.ReadByte()
		if err != nil || !unicode.IsDigit(rune(ch)) {
			return result
		}
		result = result*10 + int(ch&0xf)
	}
}

func main() {
	q := readInt()
	for i := 0; i < q; i++ {
		a, _, _, b := readInt(), readInt(), readInt(), readInt()
		if a == b {
			a += 1
		}
		fmt.Println(a, b)
	}
}

package main

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

func main() {
	var t, l1, r1, l2, r2 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &l1, &r1, &l2, &r2)
		if l1 != r2 {
			fmt.Println(l1, r2)
		} else {
			fmt.Println(r1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	var q, l1, r1, l2, r2 int
	if _, err := fmt.Scanln(&q); err != nil {
		panic(err)
	}
	for i := 0; i < q; i++ {
		if _, err := fmt.Scanln(&l1, &r1, &l2, &r2); err != nil {
			panic(err)
		}
		if l1 != r2 {
			fmt.Println(l1, r2)
		} else {
			fmt.Println(r1, l2)
		}

	}
}

package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	for i := 0; i < n; i++ {
		var l1,r1,l2,r2 int
		fmt.Fscanf(buf, "%d %d %d %d\n", &l1,&r1,&l2,&r2)
	//	fmt.Printf("%d %d %d %d\n",l1,r1,l2,r2)
		ans1 := l1
		ans2 := l2
		if ans1 == ans2 {
			ans2 = r2
		}
		fmt.Printf("%d %d\n",ans1,ans2)
	}
}

package main

import (
	"fmt"
)

func main() {
	q := 0
	l1, r1, l2, r2 := 0, 0, 0, 0
	fmt.Scanf("%d\n", &q)
	for i := 0; i < q; i++ {
		fmt.Scanf("%d %d %d %d\n", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\n", l1, l2)
		} else {
			fmt.Printf("%d %d\n", l1, r2)
		}
	}
	return
}

package main

import "fmt"

func main() {
	var q int
	fmt.Scanf("%d\n", &q)
	var l1 int
	var r1 int
	var l2 int
	var r2 int
	for i := 0; i < q; i++ {
		fmt.Scanf("%d %d %d %d\n", &l1, &r1, &l2, &r2)
		if l1 == l2 {
			fmt.Printf("%d %d\n", l1, l1+1)
		} else {
			fmt.Printf("%d %d\n", l1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	var l1, l2, r1, r2, q int
	fmt.Scan(&q)
	for i:=0; i < q; i++ {
		fmt.Scan(&l1, &l2, &r1, &r2)
		if r2 <= l1 {
			fmt.Printf("%d %d\n", l2, r1)
		} else {
			fmt.Printf("%d %d\n", l1, r2)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var T int
	fmt.Scanf("%d\n", &T)
	var a,b,c,d int
	for i := 0; i < T; i++ {
		fmt.Scanf("%d%d%d%d\n", &a, &b, &c, &d)
		var x, y int
		x = a
		if c != x {
			y = c
		} else {
			y = d
		}
		if x == y {
			x = b
			if c != x {
				y = c
			} else {
				y = d
			}
		}
		fmt.Printf("%d %d\n", x, y)
	}
}

package main
import (
"fmt"
//"math"
)
func process(l1, r1, l2, r2 int){
	if (l1 != r2){
		fmt.Printf("%d %d\n", l1, r2);
	} else{
		fmt.Printf("%d %d\n", r1, l2);
	}
}
func main(){
		var q int;
		var l1, r1, l2, r2 int;
		fmt.Scan(&q);
		for i:= 1; i <= q; i++{
			fmt.Scan(&l1);
			fmt.Scan(&r1);
			fmt.Scan(&l2);
			fmt.Scan(&r2);
			process(l1, r1, l2, r2);
		}
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int = 1, 1
    fmt.Scanf("%v\n", &q)
    for cur:=1;cur<=q;cur++ {
        _, err := fmt.Scanf("%v %v %v %v\n", &l1, &r1, &l2, &r2)
        if err != nil {
            fmt.Print(err)
        }
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int
		fmt.Scan(&l1, &r1, &l2, &r2)
		if l1 == l2 && r1 == r2{
			fmt.Println(l1, r2)
		}else if r1 == r2{
			fmt.Println(l1, l2)
		}else{
			fmt.Println(r1, r2)
		}
	}
}

package main

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

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

	var q int

	for fmt.Fscan(reader, &q); q > 0; q-- {
		var l1, l2, r1, r2 int

		fmt.Fscan(reader, &l1, &r1, &l2, &r2)

		if l1 == l2 {
			fmt.Println(l1, l2+1)
		} else {
			fmt.Println(l1, l2)
		}

	}

	return
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func main() {
	n := readInteger()
	var i int64

outer:
	for i = 0; i < n; i++ {
		s := readString()
		parts := strings.Split(s, " ")
		l1, _ := strconv.ParseInt(parts[0], 0, 64)
		r1, _ := strconv.ParseInt(parts[1], 0, 64)
		l2, _ := strconv.ParseInt(parts[2], 0, 64)
		r2, _ := strconv.ParseInt(parts[3], 0, 64)

		for j := l1; j <= r1; j++ {
			for k := l2; k <= r2; k++ {
				if j != k {
					fmt.Printf("%v %v\n", j, k)
					continue outer
				}
			}
		}
	}
}

func readInteger() int64 {
	s, _, _ := reader.ReadLine()
	n, _ := strconv.ParseInt(string(s), 0, 64)
	return n
}

func readString() string {
	s, _, _ := reader.ReadLine()
	return string(s)
}

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

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

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

package main

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

func main() {
	var t, l1, r1, l2, r2 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &l1, &r1, &l2, &r2)
		if l1 != r2 {
			fmt.Println(l1, r2)
		} else {
			fmt.Println(l2, r1)
		}
	}
}

package main

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

func main() {
	var t, l1, r1, l2, r2 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &l1, &r1, &l2, &r2)
		fmt.Println(l1, r2)
	}
}

package main

import "fmt"

func main() {
	var q, l1, r1, l2, r2 int
	if _, err := fmt.Scanln(&q); err != nil {
		panic(err)
	}
	for i := 0; i < q; i++ {
		if _, err := fmt.Scanln(&l1, &r1, &l2, &r2); err != nil {
			panic(err)
		}
		if l1 != r2 {
			fmt.Println(l1, r2)
		} else {
			fmt.Println(l2, r1)
		}

	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d\n", r1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\r\n", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d\r\n", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d\r\n", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d\r\n", r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		l1, r1, l2, r2 := 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if r1 == l2 {
			fmt.Printf("%d %d\n", r1, r2)
		} else {
			fmt.Printf("%d %d\n", r1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d\n", r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d", r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		l1, r1, l2, r2 := 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d\n", r1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Println(l1, l2)
		} else if l1 != r2 {
			fmt.Println(l1, r2)
		} else if r1 != l2 {
			fmt.Println(r1, l2)
		} else if r1 != r2 {
			fmt.Println(r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Printf("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Printf("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Printf("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Printf("%d %d\n", r1, l2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		l1, r1, l2, r2 := 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if r1 == l1 {
			fmt.Printf("%d %d\n", r1, r2)
		} else {
			fmt.Printf("%d %d\n", r1, l1)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Print("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Print("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Print("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Print("%d %d\n", r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	q := 0
	fmt.Scanf("%d", &q)
	for i := 0; i < q; i++ {
		var l1, r1, l2, r2 int32 = 0, 0, 0, 0
		fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
		if l1 != l2 {
			fmt.Sprintf("%d %d\n", l1, l2)
		} else if l1 != r2 {
			fmt.Sprintf("%d %d\n", l1, r2)
		} else if r1 != l2 {
			fmt.Sprintf("%d %d\n", r1, l2)
		} else if r1 != r2 {
			fmt.Sprintf("%d %d\n", r1, r2)
		}
	}
}

package main

import "fmt"

func main() {
	var q int
	fmt.Scanf("%d", &q)
	var l1 int
	var r1 int
	var l2 int
	var r2 int
	for i := 0; i < q; i++ {
		fmt.Scanf("%d %d %d %d\n", &l1, &r1, &l2, &r2)
		if l1 == l2 {
			fmt.Printf("%d %d\n", l1, l1+1)
		} else {
			fmt.Printf("%d %d\n", l1, l2)
		}
	}
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int = 1, 1
    fmt.Scanf("%v", &q)
    for cur:=1;cur<=q;cur++ {
        n, err := fmt.Scanf("%v %v %v %v", &l1, &r1, &l2, &r2)
        if err != nil {
            fmt.Print(err)
        }
        fmt.Print("read %d vars\n", n)
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int
    fmt.Scanf("%v", &q)
    for cur:=1;cur<=q;cur++ {
        fmt.Scanf("%v %v %v %v", &l1, &r1, &l2, &r2)
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int = 1, 1
    fmt.Scanln("%v", &q)
    for cur:=1;cur<=q;cur++ {
        _, err := fmt.Scanln("%v %v %v %v", &l1, &r1, &l2, &r2)
        if err != nil {
            fmt.Print(err)
        }
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int
    fmt.Scanf("%d", &q)
    for cur:=1;cur<=q;cur++ {
        fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int
    fmt.Scanf("%d", &q)
    for ;q >= 0; q-- {
        fmt.Scanf("%d %d %d %d", &l1, &r1, &l2, &r2)
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
    var q, l1, r1, l2, r2 int
    var f1, f2 int = 1, 1
    fmt.Scanf("%v", &q)
    for cur:=1;cur<=q;cur++ {
        fmt.Scanf("%v %v %v %v", &l1, &r1, &l2, &r2)
        if l1 == r1 {
            f1 = l1
            for i:=l2;i<=r2;i++ {
                if i != f1 {
                    f2 = i
                    break
                }
            }
        } else {
            f2 = l2
            for i:=l1;i<=r1;i++ {
                if i != f2 {
                    f1 = i
                    break
                }
            }
        }
        fmt.Printf("%d %d\n", f1, f2)
    }
}

package main

import "fmt"

func main() {
	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++{
		var l1, r1, l2, r2 int
		fmt.Scan(&l1, &r1, &l2, &r2)
		if r1 - l1 > r2 - l2{
			l1, l2 = l2, l1
			r1, r2 = r2, r1
		}
		fmt.Print(l1, " ")
		if l1 == l2{
			fmt.Println(l1 + 1)
		}else{
			fmt.Println(l2)
		}
	}
}