package main

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

type Hos struct {
    w, b int
}

func solve() {
    n, m, maxW := readInt(), readInt(), readInt()
    w, b := readIntArray(n), readIntArray(n)
    h, a := make([]Hos, n), make([][]int, n)
    for i := range w {
        h[i] = Hos{w[i], b[i]}
    }
    for i := 0; i < m; i++ {
        x, y := readInt()-1, readInt()-1
        a[x] = append(a[x], y)
        a[y] = append(a[y], x)
    }

    was := make([]bool, n)
    g := [][]Hos{}
    for i := range w {
        if was[i] {
            continue
        }

        q, group := []int{i}, []int{}
        was[i] = true
        for len(q) > 0 {
            cur := q[len(q)-1]
            q, group = q[:len(q)-1], append(group, cur)
            for _, f := range a[cur] {
                if !was[f] {
                    was[f] = true
                    q = append(q, f)
                }
            }
        }

        sw, sb, curG := 0, 0, []Hos{}
        for _, i := range group {
            sw += h[i].w
            sb += h[i].b
            curG = append(curG, h[i])
        }
        curG = append(curG, Hos{sw, sb})
        g = append(g, curG)
    }

    prev := make([]int, maxW+1)
    for i := range g {
        curG, cur := g[i], make([]int, maxW+1)
        for j := 0; j <= maxW; j++ {
            val := prev[j]
            for _, hos := range curG {
                if hos.w <= j {
                    if curB := hos.b + prev[j-hos.w]; curB > val {
                        val = curB
                    }
                }
            }
            cur[j] = val
        }
        prev = cur
    }
    fmt.Println(prev[maxW])
}

// Helpers

var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)

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

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/

package main

import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"math/rand"
	"os"
)

func RapidReader() io.Reader {
	b, _ := ioutil.ReadAll(os.Stdin)
	return bytes.NewReader(b)
}

func main() {
	reader := RapidReader()

	n, m, w := 0, 0, 0
	fmt.Fscan(reader, &n, &m, &w)

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

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

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

	group := newDisjointSet(n)
	for i := 0; i < m; i++ {
		group[xs[i]].Union(group[ys[i]])
	}

	// groupWeight, groupValue := make(map[*Element]int), make(map[*Element]int)
	groupItems := make(map[*Element][]Item)
	for i := 0; i < n; i++ {
		root := group[i].Root()
		groupItems[root] = append(groupItems[root], Item{wh[i], bh[i]})
	}
	for key, items := range groupItems {
		sumW, sumV := 0, 0
		for _, item := range items {
			sumW += item.Weight
			sumV += item.Value
		}
		groupItems[key] = append(groupItems[key], Item{sumW, sumV})
	}

	ans := Knapsack01Group(groupItems, w)
	fmt.Println(ans)
}

// https://en.wikipedia.org/wiki/Disjoint-set_data_structure
type Element struct {
	Parent *Element
}

func newDisjointSet(n int) []*Element {
	ds := make([]*Element, n)
	for i := 0; i < n; i++ {
		ds[i] = new(Element)
		ds[i].Parent = ds[i]
	}
	return ds
}

func (x *Element) Root() *Element {
	if x.Parent == x {
		return x
	}
	x.Parent = x.Parent.Root()
	return x.Parent
}

func (x *Element) Union(y *Element) {
	if rand.Intn(2) == 0 {
		x.Root().Parent = y.Root()
	} else {
		y.Root().Parent = x.Root()
	}
}

type Item struct {
	Weight, Value int
}

func Knapsack01Group(itemGroups map[*Element][]Item, capacity int) int {
	dp := make([]int, capacity+1)
	for _, group := range itemGroups {
		for sum1 := len(dp) - 1; sum1 >= 0; sum1-- {
			for _, item := range group {
				func(sum2 int, newValue int) {
					if 0 <= sum2 && sum2 < len(dp) && dp[sum2] < newValue {
						dp[sum2] = newValue
					}
				}(sum1+item.Weight, dp[sum1]+item.Value)
			}
		}
	}
	return dp[capacity]
}

package main

import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"math/rand"
	"os"
)

func RapidReader() io.Reader {
	b, _ := ioutil.ReadAll(os.Stdin)
	return bytes.NewReader(b)
}

func main() {
	reader := RapidReader()

	n, m, w := 0, 0, 0
	fmt.Fscanf(reader, "%d%d%d ", &n, &m, &w)

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

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

	xs, ys := make([]int, m), make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Fscanf(reader, "%d%d ", &xs[i], &ys[i])
		xs[i]--
		ys[i]--
	}

	group := newDisjointSet(n)
	for i := 0; i < m; i++ {
		group[xs[i]].Union(group[ys[i]])
	}

	// groupWeight, groupValue := make(map[*Element]int), make(map[*Element]int)
	groupItems := make(map[*Element][]Item)
	for i := 0; i < n; i++ {
		root := group[i].Root()
		groupItems[root] = append(groupItems[root], Item{wh[i], bh[i]})
	}
	for key, items := range groupItems {
		sumW, sumV := 0, 0
		for _, item := range items {
			sumW += item.Weight
			sumV += item.Value
		}
		groupItems[key] = append(groupItems[key], Item{sumW, sumV})
	}

	ans := Knapsack01Group(groupItems, w)
	fmt.Println(ans)
}

// https://en.wikipedia.org/wiki/Disjoint-set_data_structure
type Element struct {
	Parent *Element
}

func newDisjointSet(n int) []*Element {
	ds := make([]*Element, n)
	for i := 0; i < n; i++ {
		ds[i] = new(Element)
		ds[i].Parent = ds[i]
	}
	return ds
}

func (x *Element) Root() *Element {
	if x.Parent == x {
		return x
	}
	x.Parent = x.Parent.Root()
	return x.Parent
}

func (x *Element) Union(y *Element) {
	if rand.Intn(2) == 0 {
		x.Root().Parent = y.Root()
	} else {
		y.Root().Parent = x.Root()
	}
}

type Item struct {
	Weight, Value int
}

func Knapsack01Group(itemGroups map[*Element][]Item, capacity int) int {
	dp := make([]int, capacity+1)
	for _, group := range itemGroups {
		for sum1 := len(dp) - 1; sum1 >= 0; sum1-- {
			for _, item := range group {
				func(sum2 int, newValue int) {
					if 0 <= sum2 && sum2 < len(dp) && dp[sum2] < newValue {
						dp[sum2] = newValue
					}
				}(sum1+item.Weight, dp[sum1]+item.Value)
			}
		}
	}
	return dp[capacity]
}

package main

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

type DJSet struct {
	upper []int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
	}
	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.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) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func solve() {
	n := readInt()
	m := readInt()
	W := readInt()
	w := readIntArray(n)
	b := readIntArray(n)
	djset := NewDJSet(n)
	for i := 0; i < m; i++ {
		djset.Union(readInt()-1, readInt()-1)
	}
	dp := make([]int, 1050)
	for i := 0; i < len(dp); i++ {
		dp[i] = -100000000
	}
	dp[0] = 0
	for i := 0; i < n; i++ {
		if djset.upper[i] >= 0 {
			continue
		}
		ndp := make([]int, len(dp))
		copy(ndp, dp)
		sw := 0
		sb := 0
		for j := 0; j < n; j++ {
			if djset.Equiv(i, j) {
				for k := 0; k+w[j] < len(dp); k++ {
					ndp[k+w[j]] = max(ndp[k+w[j]], dp[k]+b[j])
				}
				sw += w[j]
				sb += b[j]
			}
		}
		for k := 0; k+sw < len(dp); k++ {
			ndp[k+sw] = max(ndp[k+sw], dp[k]+sb)
		}
		dp = ndp
	}
	best := 0
	for i := 0; i <= W; i++ {
		best = max(best, dp[i])
	}
	fmt.Println(best)
}

// Helpers

const INPUT = `4 2 11
2 4 6 6
6 4 2 1
1 2
2 3`

var scanner *bufio.Scanner

func main() {
	if true || len(os.Getenv("ONLINE_JUDGE")) > 0 {
		scanner = bufio.NewScanner(os.Stdin)
	} else {
		scanner = bufio.NewScanner(strings.NewReader(INPUT))
	}
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/

package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

var n, m, W, cntGroup int
var w, b []int
var adj [][]int
var group []int
var groupW, groupB int
var sumW, sumB []int
var members [][]int
var dp [][]int

func dfs(u int) {
	members[cntGroup] = append(members[cntGroup], u)
	group[u] = cntGroup
	groupW += w[u]
	groupB += b[u]
	for _, v := range adj[u] {
		if group[v] == 0 {
			dfs(v)
		}
	}
}

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

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

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

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

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

	adj = make([][]int, n+1)
	var u, v int
	for i := 1; i <= m; i++ {
		fmt.Fscanf(bufin, "%d %d\n", &u, &v)
		adj[u] = append(adj[u], v)
		adj[v] = append(adj[v], u)
	}

	group = make([]int, n+1)
	sumW = make([]int, n+1)
	sumB = make([]int, n+1)
	members = make([][]int, n+1)
	cntGroup = 0
	for u := 1; u <= n; u++ {
		if group[u] == 0 {
			cntGroup++
			groupW = 0
			groupB = 0
			dfs(u)
			sumW[cntGroup] = groupW
			sumB[cntGroup] = groupB
		}
	}

	dp = make([][]int, cntGroup+1)
	for g := 0; g <= cntGroup; g++ {
		dp[g] = make([]int, W+1)
	}

	for ig := 1; ig <= cntGroup; ig++ {
		for iw := 1; iw <= W; iw++ {
			dp[ig][iw] = dp[ig-1][iw]
			if iw >= sumW[ig] {
				dp[ig][iw] = max(dp[ig][iw], dp[ig-1][iw-sumW[ig]]+sumB[ig])
			}
			for _, i := range members[ig] {
				if iw >= w[i] {
					dp[ig][iw] = max(dp[ig][iw], dp[ig-1][iw-w[i]]+b[i])
				}
			}
		}
	}

	fmt.Fprintf(bufout, "%d\n", dp[cntGroup][W])
}

package main

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

type DJSet struct {
	upper []int
}

func NewDJSet(n int) *DJSet {
	s := DJSet{upper: make([]int, n)}
	for i := 0; i < n; i++ {
		s.upper[i] = -1
	}
	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.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) Count() int {
	ct := 0
	for _, u := range s.upper {
		if u < 0 {
			ct++
		}
	}
	return ct
}

func solve() {
	n := readInt()
	m := readInt()
	W := readInt()
	w := readIntArray(n)
	b := readIntArray(n)
	djset := NewDJSet(n)
	for i := 0; i < m; i++ {
		djset.Union(readInt()-1, readInt()-1)
	}
	dp := make([]int, 1050)
	for i := 0; i < len(dp); i++ {
		dp[i] = -100000000
	}
	dp[0] = 0
	for i := 0; i < n; i++ {
		if djset.upper[i] >= 0 {
			continue
		}
		ndp := make([]int, len(dp))
		copy(ndp, dp)
		sw := 0
		sb := 0
		for j := 0; j < n; j++ {
			if djset.Equiv(i, j) {
				for k := 0; k+w[j] < len(dp); k++ {
					ndp[k+w[j]] = max(ndp[k+w[j]], dp[k]+b[j])
				}
				sw += w[j]
				sb += b[j]
			}
		}
		for k := 0; k+sw < len(dp); k++ {
			ndp[k+sw] = max(ndp[k+sw], dp[k]+sb)
		}
		dp = ndp
	}
	best := 0
	for i := 0; i <= W; i++ {
		best = max(best, dp[i])
	}
	fmt.Println(best)
}

// Helpers

const INPUT = `4 2 11
2 4 6 6
6 4 2 1
1 2
2 3`

var scanner *bufio.Scanner

func main() {
	if len(os.Getenv("ONLINE_JUDGE")) > 0 {
		scanner = bufio.NewScanner(os.Stdin)
	} else {
		scanner = bufio.NewScanner(strings.NewReader(INPUT))
	}
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/


//343B
package main

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

var io = bufio.NewReadWriter(bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout))
var sequence string
var n int

func nextstring() string {
	x := []byte{}
	for {
		c, errors := io.ReadByte()
		if c == '\r' {
			_, _ = io.ReadByte()
			return string(x)
		} else if errors != nil || c == ' ' || c == '\n' {
			return string(x)
		} else {
			x = append(x, c)
		}
	}
}

func main() {
	defer io.Flush()
	sequence = nextstring()
	n = len(sequence)
	if n%2 == 1 {
		fmt.Fprintln(io, "No")
		return
	}
	t := make([]byte, n)
	cr := 0
	for i := 0; i < n; i++ {
		if cr != 0 && t[cr-1] == sequence[i] {
			cr--
		} else {
			t[cr] = sequence[i]
			cr++
		}
	}
	if cr == 0 {
		fmt.Fprintln(io, "Yes")
	} else {
		fmt.Fprintln(io, "No")
	}
}

package main

import "os"
import "bufio"
import "fmt"

func main(){
	var s string
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	fmt.Fscan(r, &s)
	c, cc := 0, 0
	if len(s)%2 != 0 {
		w.WriteString("No\n")
	} else {
		for i:=0; i<len(s); i++ {
			if i%2 == 0 {
				if string(s[i]) == "+" {
					cc += 1
				} else {
					c += 1
				}
			} else {
				if string(s[i]) == "+" {
					c += 1
				} else {
					cc += 1
				}
			}
		}
		if c == cc {
			w.WriteString("Yes\n")
		} else {
			w.WriteString("No\n")
		}
	}
	w.Flush()
}

package main

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

var (
	inout   *bufio.ReadWriter = bufio.NewReadWriter(bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout))
	s string
	n int
)

func next() string {
	box := []byte{}
	for ;;{
		char, err := inout.ReadByte()
		if err!=nil||char==' '||char=='\n' {
			return string(box)
		} else if char == '\r' {
			_, _ = inout.ReadByte()
			return string(box)
		} else {
			box=append(box, char)
		}
	}
}

func main() {
	defer inout.Flush()
	s=next()
	n=len(s)
	if n%2==1 {
		fmt.Fprintln(inout, "No")
		return
	}
	hit:=0
	st:=make([]byte, n)
	for j:=0;j<n;j++ {
		if hit==0 || st[hit-1]!=s[j] {
			st[hit]=s[j]
			hit++
		} else {
			hit--
		}
	}
	if hit!=0 {
		fmt.Fprintln(inout, "No")
	} else {
		fmt.Fprintln(inout, "Yes")
	}
}

package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    var x string
    fmt.Fscan(reader,&x)
    ans := false
    if len(x)%2 == 0 {
        s := make([]byte,0,len(x))
        for i := 0; i < len(x); i++ {
            if (len(s) == 0) || (s[len(s)-1] != x[i]) {
                s = append(s,x[i])
            } else {
                s = s[:len(s)-1]
            }
        }
        if len(s) == 0 { ans = true }
    }
    if ans { fmt.Println("Yes") } else { fmt.Println("No") }
}

package main

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

var (
	rw   *bufio.ReadWriter = bufio.NewReadWriter(bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout))
	seq string
	n int
)

func nextString() string {
	token := []byte{}
	for {
		c, err := rw.ReadByte()
		if err != nil || c == ' ' || c == '\n' {
			return string(token)
		} else if c == '\r' {
			_, _ = rw.ReadByte()
			return string(token)
		} else {
			token = append(token, c)
		}
	}
}

func main() {
	defer rw.Flush()
	seq = nextString()
	n = len(seq)
	if n % 2 == 1 {
		fmt.Fprintln(rw, "No")
		return
	}
	st := make([]byte, n)
	sz := 0
	for i := 0; i < n; i++ {
		if sz == 0 || st[sz-1] != seq[i] {
			st[sz] = seq[i]
			sz++
		} else {
			sz--
		}
	}
	if sz == 0 {
		fmt.Fprintln(rw, "Yes")
	} else {
		fmt.Fprintln(rw, "No")
	}
}

package main

import "os"
import "bufio"

func main(){
	var s string
	r := bufio.NewScanner(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	s = r.Text()
	c, cc := 0, 0
	if len(s)%2 != 0 {
		w.WriteString("No\n")
	} else {
		for i:=0; i<len(s); i++ {
			if i%2 == 0 {
				if string(s[i]) == "+" {
					cc += 1
				} else {
					c += 1
				}
			} else {
				if string(s[i]) == "+" {
					c += 1
				} else {
					cc += 1
				}
			}
		}
		if c == cc {
			w.WriteString("Yes\n")
		} else {
			w.WriteString("No\n")
		}
	}
	w.Flush()
}

package main

import "os"
import "bufio"

func main(){
	var s string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanLines)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	s = r.Text()
	c, cc := 0, 0
	if len(s)%2 != 0 {
		w.WriteString("No\n")
	} else {
		for i:=0; i<len(s); i++ {
			if i%2 == 0 {
				if string(s[i]) == "+" {
					cc += 1
				} else {
					c += 1
				}
			} else {
				if string(s[i]) == "+" {
					c += 1
				} else {
					cc += 1
				}
			}
		}
		if c == cc {
			w.WriteString("Yes\n")
		} else {
			w.WriteString("No\n")
		}
	}
	w.Flush()
}

package main

import (
	"fmt"
	"bufio"
	"os"
	//"strconv"
	//"unicode"
	//"strings"
	//"math"
)

func main() {
    var i,t int
    var s string
    input := bufio.NewReader(os.Stdin)
    fmt.Fscan(input,&s)
    for i=0;i<len(s);i++ {
    	if (s[i]=='+') {
    	        if(int(s[i])^i%2!=0){
        		t++
        	} else {
        		t--
        	}
    	} else {
    		t--
    	}
    }
    if t!=0 {
    	fmt.Println("No")
    } else {
    	fmt.Println("Yes")
    }
}

package main

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

var (
	inout   *bufio.ReadWriter = bufio.NewReadWriter(bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout))
	s string
	n int
)

func next() string {
	box := []byte{}
	for {
		char, err := inout.ReadByte()
		if err != nil || char == ' ' || char == '\n' {
			return string(box)
		} else if char == '\r' {
			_, _ = inout.ReadByte()
			return string(box)
		} else {
			box=append(box,char)
		}
	}
}

func main() {
	s = next()
	n = len(s)
	if n%2==1 {
		fmt.Fprintln(inout, "No")
		return
	}
	st := make([]byte, n)
	hit := 0
	for i:=0;i<n;i++ {
		if hit==0 || st[hit-1]!=s[i] {
			st[hit] = s[i]
			hit++
		} else {
			hit--
		}
	}
	if hit==0 {
		fmt.Fprintln(inout, "Yes")
	} else {
		fmt.Fprintln(inout, "No")
	}
	inout.Flush()
}


package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var x, y [2e5 + 1]int
	var t, n, m, k, q int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		ans := int64(1)
		for i, nx, ny := q-1, 0, 0; i >= 0 && nx < n && ny < m; i-- {
			r, c := a[i][0], a[i][1]
			if x[r] != t || y[c] != t {
				ans = ans * int64(k) % 998244353
				if x[r] != t {
					x[r] = t
					nx++
				}
				if y[c] != t {
					y[c] = t
					ny++
				}
			}
		}
		Fprintln(out, ans)
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
var x, y [2e5 + 1]int

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

	var t, n, m, k, q int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		ans := int64(1)
		for i, nx, ny := q-1, 0, 0; i >= 0 && nx < n && ny < m; i-- {
			r, c := a[i][0], a[i][1]
			if x[r] != t || y[c] != t {
				ans = ans * int64(k) % 998244353
				if x[r] != t {
					x[r] = t
					nx++
				}
				if y[c] != t {
					y[c] = t
					ny++
				}
			}
		}
		Fprintln(out, ans)
	}
}

package main

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

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

	var T, n, m, k, q int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		x, y := map[int]bool{}, map[int]bool{}
		ans := int64(1)
		for i := q - 1; i >= 0; i-- {
			r, c := a[i][0], a[i][1]
			if len(x) < n && len(y) < m && (!x[r] || !y[c]) {
				ans = ans * int64(k) % 998244353
				x[r] = true
				y[c] = true
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

const mod = 998244353

var x, y [200005]int
var X, Y [200005]bool

func main() {
	var t, n, m, k, q, N, M int
	var ans int64
	readInt(&t)
	for tt := 0; tt < t; tt++ {
		ans = 1
		N = 0
		M = 0
		readInt(&n)
		readInt(&m)
		readInt(&k)
		readInt(&q)
		maxn := 0
		for i := 1; i <= q; i++ {
			readInt(&x[i])
			readInt(&y[i])
			if x[i] > maxn {
				maxn = x[i]
			}
			if y[i] > maxn {
				maxn = y[i]
			}
		}
		for i := 0; i <= maxn; i++ {
			X[i] = false
			Y[i] = false
		}
		for i := q; i >= 1 && N < n && M < m; i-- {
			if !X[x[i]] || !Y[y[i]] {
				if !X[x[i]] {
					N++
					X[x[i]] = true
				}
				if !Y[y[i]] {
					M++
					Y[y[i]] = true
				}
				ans = ans * int64(k) % mod
			}
		}
		fmt.Println(ans)
	}
}

var in = bufio.NewReader(os.Stdin)

func readInt(out *int) error {
	var ans, sign int = 0, 1
	var readed = false
	c, err := in.ReadByte()
	for ; err == nil && (c < '0' || '9' < c); c, err = in.ReadByte() {
		if c == '-' {
			sign = -sign
		}
	}
	for ; err == nil && '0' <= c && c <= '9'; c, err = in.ReadByte() {
		ans = ans<<3 + ans<<1 + int(c-'0')
		readed = true
	}
	if readed {
		*out = ans * sign
		return nil
	}
	return err
}

package main

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

const Mod = 998244353

func solve(ops [][]int, n, m, k, q int) {
	ans := int64(1)
	sx, sy := make(map[int]bool), make(map[int]bool)
	for i := q - 1; i >= 0; i-- {
		fl := false
		row := ops[i][0]
		col := ops[i][1]
		_, ok1 := sx[row]
		_, ok2 := sy[col]
		if !ok1 {
			fl = true
			sx[row] = true
		}
		if !ok2 {
			fl = true
			sy[col] = true
		}
		if fl {
			ans = (int64(ans) * int64(k) % Mod)
		}
		if len(sx) == n || len(sy) == m {
			break
		}
	}
	fmt.Println(ans)
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		m, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		k, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		q, _ := strconv.Atoi(scanner.Text())

		ops := make([][]int, q)
		for j := 0; j < q; j++ {
			scanner.Scan()
			ops[j] = make([]int, 2)
			ops[j][0], _ = strconv.Atoi(scanner.Text())
			scanner.Scan()
			ops[j][1], _ = strconv.Atoi(scanner.Text())
		}
		solve(ops, n, m, k, q)
	}

}

package main

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

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

	var T, n, m, k, q int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		ans := int64(1)
		x, y := map[int]bool{}, map[int]bool{}
		for i := q - 1; i >= 0 && len(x) < n && len(y) < m; i-- {
			r, c := a[i][0], a[i][1]
			if !x[r] || !y[c] {
				ans = ans * int64(k) % 998244353
				x[r] = true
				y[c] = true
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

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

	var T, n, m, k, q int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		x, y := map[int]bool{}, map[int]bool{}
		ans := int64(1)
		for i := q - 1; i >= 0; i-- {
			r, c := a[i][0], a[i][1]
			if len(x) < n && len(y) < m && (!x[r] || y[c]) {
				ans = ans * int64(k) % 998244353
				x[r] = true
				y[c] = true
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

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

	var T, n, m, k, q int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &m, &k, &q)
		a := make([][2]int, q)
		for i := range a {
			Fscan(in, &a[i][0], &a[i][1])
		}
		x, y := map[int]bool{}, map[int]bool{}
		for i := q - 1; i >= 0; i-- {
			r, c := a[i][0], a[i][1]
			if x[r] && y[c] {
				q--
			} else {
				x[r] = true
				y[c] = true
			}
		}
		ans := int64(1)
		for ; q > 0; q-- {
			ans = ans * int64(k) % 998244353
		}
		Fprintln(out, ans)
	}
}

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

package main

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

const mod = 998244353

var x, y [200005]int
var X, Y [200005]bool

func main() {
	var t, n, m, k, q, ans, N, M int
	readInt(&t)
	for tt := 0; tt < t; tt++ {
		ans = 1
		N = 0
		M = 0
		readInt(&n)
		readInt(&m)
		readInt(&k)
		readInt(&q)
		maxn := 0
		for i := 1; i <= q; i++ {
			readInt(&x[i])
			readInt(&y[i])
			if x[i] > maxn {
				maxn = x[i]
			}
			if y[i] > maxn {
				maxn = y[i]
			}
		}
		for i := 0; i <= maxn; i++ {
			X[i] = false
			Y[i] = false
		}
		for i := q; i >= 1 && N < n && M < m; i-- {
			if !X[x[i]] || !Y[y[i]] {
				if !X[x[i]] {
					N++
					X[x[i]] = true
				}
				if !Y[y[i]] {
					M++
					Y[y[i]] = true
				}
				ans *= k
				ans %= mod
			}
		}
		fmt.Println(ans)
	}
}

var in = bufio.NewReader(os.Stdin)

func readInt(out *int) error {
	var ans, sign int = 0, 1
	var readed = false
	c, err := in.ReadByte()
	for ; err == nil && (c < '0' || '9' < c); c, err = in.ReadByte() {
		if c == '-' {
			sign = -sign
		}
	}
	for ; err == nil && '0' <= c && c <= '9'; c, err = in.ReadByte() {
		ans = ans<<3 + ans<<1 + int(c-'0')
		readed = true
	}
	if readed {
		*out = ans * sign
		return nil
	}
	return err
}

package main

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

const mod = 998244353

var x, y [200005]int
var X, Y [200005]bool

func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, m, k, q, ans, N, M int
	readInt(&t)
	for tt := 0; tt < t; tt++ {
		ans = 1
		N = 0
		M = 0
		readInt(&n)
		readInt(&m)
		readInt(&k)
		readInt(&q)
		maxn := 0
		for i := 1; i <= q; i++ {
			readInt(&x[i])
			readInt(&y[i])
			if x[i] > maxn {
				maxn = x[i]
			}
			if y[i] > maxn {
				maxn = y[i]
			}
		}
		for i := 0; i <= maxn; i++ {
			X[i] = false
			Y[i] = false
		}
		for i := q; i >= 1 && N < n && M < m; i-- {
			if !X[x[i]] || !Y[y[i]] {
				if !X[x[i]] {
					N++
					X[x[i]] = true
				}
				if !Y[y[i]] {
					M++
					Y[y[i]] = true
				}
				ans *= k
				ans %= mod
			}
		}
		fmt.Fprintln(out, ans)
	}
}

var in = bufio.NewReader(os.Stdin)

func readInt(out *int) error {
	var ans, sign int = 0, 1
	var readed = false
	c, err := in.ReadByte()
	for ; err == nil && (c < '0' || '9' < c); c, err = in.ReadByte() {
		if c == '-' {
			sign = -sign
		}
	}
	for ; err == nil && '0' <= c && c <= '9'; c, err = in.ReadByte() {
		ans = ans<<3 + ans<<1 + int(c-'0')
		readed = true
	}
	if readed {
		*out = ans * sign
		return nil
	}
	return err
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n int
		fmt.Fscan(in, &n)
		v := make([]int, n)
		for i := range v {
			fmt.Fscan(in, &v[i])
		}
		for i := range v {
			if v[i] != v[(i+1)%n] && v[i]!=v[(i+2)%n] {
				fmt.Println(i+1)
				break
			}
		}
	}
}

package main

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

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	buffer := bufio.NewReader(os.Stdin)
	ts, _, _ := buffer.ReadLine()
	t, _ = strconv.Atoi(string(ts))
	for i := 0; i < t; i++ {
		nsl = nil
		n = 0
		ns, _, _ := buffer.ReadLine()
		n, _ = strconv.Atoi(string(ns))
		tempstr, _, _ := buffer.ReadLine()
		sl := strings.Split(string(tempstr), " ")
		for j := 0; j < n; j++ {
			tn, _ = strconv.Atoi(sl[j])
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run(out *bufio.Writer) {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				Fprintln(out, v.idx+1)
				Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Open("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = file.Close()
	}(out)
	NewA(F).run(W)
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run(out *bufio.Writer) {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				Fprintln(out, v.idx+1)
				Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Open("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
		defer W.Flush()
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = file.Close()
	}(out)
	NewA(F).run(W)
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run() {
	out := bufio.NewWriter(os.Stdout)
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				Fprintln(out, v.idx+1)
				Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	file, err := os.Open("input.txt")
	var F *bufio.Reader
	if err == nil {
		F = bufio.NewReader(file)
		os.Stdin = file
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(file)
	NewA(F).run()
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run() {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				fmt.Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	file, err := os.Open("input.txt")
	var F *bufio.Reader
	if err == nil {
		F = bufio.NewReader(file)
		os.Stdin = file
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(file)
	NewA(F).run()
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

import (
	"fmt"
	"sort"
)

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

	temp := make([]int, n)
	copy(temp, arr)

	sort.Ints(temp)

	for i := 0; i < n; i++ {
		if arr[i] != temp[1] {
			fmt.Println(i + 1)
		}
	}
}

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

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

package main

import "fmt"

func main()  {
	var cases uint
	fmt.Scanln(&cases)

	for cases > 0 {

		cases--

		var n uint
		na, err := fmt.Scanln(&n)
		if err != nil {
			fmt.Println("::",na, err)
		}
		numbers := []int{}
		for n > 0 {
			n--
			var number int
			num, err := fmt.Scanf("%d", &number)
			if err != nil {
				fmt.Println(num, err)
			}
			numbers = append(numbers, number)
		}
		var nLine string
		fmt.Scanf("%s", &nLine)

		var target int
		if numbers[0] == numbers[1] || numbers[0] == numbers[2] {
			target = numbers[0]
		}

		if numbers[1] == numbers[2] {
			target = numbers[1]
		}

		for index, number := range numbers {
			if number != target {
				fmt.Println(index + 1)
				break
			}
		}
	}
}

package main

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

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

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

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

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

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

/**
 Run solve the problem CF1512A
 Date: 16/05/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1512/A
 Problem: CF1512A
**/
func (in *CF1512A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		data := map[int][]int{}
		for i := 0; n > 0; n-- {
			val := in.NextInt()
			_, ok := data[val]
			if !ok {
				data[val] = []int{0, i}
			}
			data[val][0] = data[val][0] + 1
			i++
		}

		for d := range data {
			if data[d][0] == 1 {
				fmt.Println(data[d][1]+1)
			}
		}

	}
}

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

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

package main

import (
	"fmt"
	"log"
)

type Element struct {
	Order int
	Count int
}

func main()  {
	var num int
	_, err := fmt.Scan(&num)
	if err != nil {
		log.Fatal("t scan error")
	}
	for i := 0; i < num; i++ {
		var arrayValues int
		_, err := fmt.Scan(&arrayValues)
		if err != nil {
			log.Fatal("n scan error")
		}
		counter := map[int] *Element{}
		values := make([]int, arrayValues, arrayValues)
		for j := 0; j < arrayValues; j++ {
			_, err := fmt.Scan(&values[j])
			if err != nil {
				log.Fatal("array scanning error")
			}
		}

		for index, value := range values {
			_, ok := counter[value]
			if ok {
				counter[value].Count += 1
			} else {
				counter[value] = &Element{Order: index + 1, Count: 1}
			}
		}
		for _, value := range counter {
			if value.Count == 1 {
				fmt.Printf("%d\n", value.Order)
				break
			}
		}
	}
}

package main

import (
	"fmt"
)

func question01(arr []int, arrSize int) int {
	index := -1
	for i :=0 ; i< arrSize - 2; i++ {
		if arr[i] != arr[i+1] || arr[i] != arr[i+2] {			// 4 =/= 5
			if arr[i] == arr[i+2] {
				index = i+1
			}	else if arr[i] == arr[i+1] {
				index = i +2
			} else {
				index = i
			}
		}
	}
	return index+1
}

func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)
	for i:=0; i< testCases ; i++ {
		var arrSize int
		fmt.Scanf("%d\n", &arrSize)
		arrs := make([]int, arrSize)
		for i, _ := range arrs {
			if i == arrSize -1 {
				fmt.Scanf("%d\n", &arrs[i])
			} else {
				fmt.Scanf("%d", &arrs[i])
			}

		}
		fmt.Println(question01(arrs, arrSize))
	}
}

package main

import (
	"fmt"
	//"os"
	"sort"
)

func main() {

	var n int
	fmt.Scan(&n)

	var list [][]int = make([][]int,n)
	for i:=0;i<n;i++{
		var holder int
		fmt.Scan(&holder)
		list[i] = make([]int,0,holder)
		for j:=0;j<holder;j++{
			var inner_holder int
			fmt.Scan(&inner_holder)
			list[i] = append(list[i], inner_holder)
		}
	}

	newlist := duplicate_2d_slice(n, list)

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

		sort.Ints(newlist[i])

		var smallest int = smallest_int(newlist[i])
		var largest int = largest_int(newlist[i])

		var other int
		if smallest != newlist[i][1] {
			other = smallest
		} else {
			other = largest
		}

		for key,value := range list[i] {
			if value == other {
				fmt.Println(key+1)
				break
			}
		}
	}
}

func duplicate_2d_slice(length int, original_slice [][]int) [][]int {
    var newlist [][]int = make([][]int,length)
    for i:=0;i<length;i++{
        newlist[i] = make([]int,0,len(original_slice[i]))
        for j:=0;j<len(original_slice[i]);j++{
            newlist[i] = append(newlist[i], original_slice[i][j])
        }
    }
    return newlist
}

func smallest_int(list []int) int {
    for i:=0;i<len(list);i++{
        if list[0] > list[i] {
            list[0] = list[i]
        }
    }
    return list[0]
}

func largest_int(list []int) int {
    for i:=0;i<len(list);i++{
        if list[0] < list[i] {
            list[0] = list[i]
        }
    }
    return list[0]
}

package main

import "fmt"

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

	for t := 0; t < T; t++ {
		var n, d int
		fmt.Scan(&n)

		var pos [101]int
		mp := make(map[int]int)

		for i := 0; i < n; i++ {
			fmt.Scan(&d)
			pos[d] = i + 1
			mp[d]++
		}

		for key, val := range mp {
			if val == 1 {
				fmt.Println(pos[key])
				break
			}
		}
	}
}

package main

import "fmt"

func main() {

	var T int
	fmt.Scan(&T)
	for T > 0 {
		T--
		var size int
		fmt.Scan(&size)

		counter := map[int]int{}
		indexer := map[int]int{}

		for i := 0; i < size; i++ {
			var num int
			fmt.Scan(&num)
			counter[num]++
			indexer[num] = i + 1
		}

		for k, v := range counter {
			if v == 1 {
				fmt.Println(indexer[k])
			}
		}

	}
}

package main

import "fmt"

func findSpy(arr []int) int {
	counts := make(map[int]int)
	for i := 0; i < 3; i++ {
		counts[arr[i]]++
	}
	if len(counts) > 1 {
		for k, v := range counts {
			if v == 1 {
				for i := 0; i < 3; i++ {
					if k == arr[i] {
						return i + 1
					}
				}
			}
		}
	}
	var okVal int
	for k, _ := range counts {
		okVal = k
	}
	for i, v := range arr {
		if v != okVal {
			return i + 1
		}
	}
	return -1
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var len int
		fmt.Scanf("%d\n", &len)
		arr := make([]int, len)
		for j := 0; j < len; j++ {
			fmt.Scanf("%d", &arr[j])
		}
		fmt.Scanf("\n")
		fmt.Println(findSpy(arr))
	}
}

package main

import "fmt"
var cnt[101] int
var a[101] int

func solve()  {
	var n int
	for j := 0; j <= 100; j++ {cnt[j] = 0;}
	fmt.Scan(&n)
	for j := 1; j <= n; j++ {
		fmt.Scan(&a[j]); cnt[a[j]]++;
	}
	for j := 1; j <= n; j++ {
		if(cnt[a[j]] == 1) {fmt.Println(j); break;}
	}
}
func main()  {
	var t int
	fmt.Scanf("%d", &t)
	for i := 1; i <= t; i++ {solve()}
}

package main

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

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

func main() {
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for i := 0; i < t; i++ {
		var n int
		m := make(map[int]int)
		idx := make(map[int]int)

		Fscan(in, &n)
		for j := 0; j < n; j++ {
			var temp int
			Fscan(in, &temp)
			m[temp]++
			idx[temp] = j + 1
		}

		for k, v := range m {
			if v == 1 {
				Fprintln(out, idx[k])
			}
		}
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		var n int
		m := make(map[int]int)
		idx := make(map[int]int)

		scanf("%d\n", &n)

		for j := 0; j < n; j++ {
			var temp int
			if j != n-1 {
				scanf("%d ", &temp)
			} else {
				scanf("%d\n", &temp)
			}
			m[temp]++
			idx[temp] = j + 1
		}

		for k, v := range m {
			if v == 1 {
				printf("%d\n", idx[k])
			}
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	_, _ = fmt.Scan(&t)

	for i := 1; i <= t; i++ {
		var n int
		_, _ = fmt.Scan(&n)

		arr := make([]int, n)

		for j := 0; j < n; j++ {
			_, _ = fmt.Scan(&arr[j])
		}

		for j := 1; j < n; j++ {
			if j == 1 && arr[j] != arr[0] && arr[j] == arr[j+1] {
				fmt.Println(1)
				break
			}
			if arr[j] != arr[0] {
				fmt.Println(j + 1)
				break
			}
		}
	}
}

package main

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

type float = float32
type double = float64
type long = int64
type ulong = uint64

type Readable interface {
	bool | int | uint64 | int64 | double | float | byte
}

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

func print(arg ...interface{})            { fmt.Fprint(out, arg...) }
func println(arg ...interface{})          { fmt.Fprintln(out, arg...) }
func printf(f string, arg ...interface{}) { fmt.Fprintf(out, f, arg...) }
func scanf(f string, arg ...interface{})  { fmt.Fscanf(in, f, arg...) }

func readLn() string {
	ln, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}

	return strings.Trim(ln, " \n\r")
}

func readString() string {
	return readLn()
}

func readStrings() []string {
	return strings.Split(readLn(), " ")
}

func read[T Readable](f func(string) (T, error), input ...string) T {
	if len(input) == 0 {
		input = []string{readLn()}
	}

	res, err := f(input[0])
	if err != nil {
		panic(err)
	}

	return res
}

func readMany[T Readable](f func(...string) T) []T {
	input := readStrings()
	arr := make([]T, len(input))
	for i := 0; i < len(arr); i++ {
		arr[i] = f(input[i])
	}

	return arr
}

func readBool(input ...string) bool {
	return read(strconv.ParseBool, input...)
}

func readInt(input ...string) int {
	return read(strconv.Atoi, input...)
}

func readByte(input ...string) byte {
	return byte(read(func(s string) (uint64, error) {
		return strconv.ParseUint(s, 10, 8)
	}, input...))
}

func readDouble(input ...string) double {
	return read(func(s string) (float64, error) {
		return strconv.ParseFloat(s, 64)
	}, input...)
}

func readFloat(input ...string) float {
	return float32(read(func(s string) (float64, error) {
		return strconv.ParseFloat(s, 32)
	}, input...))
}

func readLong(input ...string) long {
	return read(func(s string) (int64, error) {
		return strconv.ParseInt(s, 10, 64)
	}, input...)
}

func readULong(input ...string) ulong {
	return read(func(s string) (uint64, error) {
		return strconv.ParseUint(s, 10, 64)
	}, input...)
}

func readBinary(input ...string) long {
	return read(func(s string) (int64, error) {
		return strconv.ParseInt(s, 2, 64)
	}, input...)
}

func readBools() []bool {
	return readMany(readBool)
}

func readInts() []int {
	return readMany(readInt)
}

func readBytes() []byte {
	return readMany(readByte)
}

func readDoubles() []double {
	return readMany(readDouble)
}

func readFloats() []float {
	return readMany(readFloat)
}

func readLongs() []long {
	return readMany(readLong)
}

func readULongs() []ulong {
	return readMany(readULong)
}

func main() {
	defer out.Flush()

	// solution
	t := readInt()
	ans := make([]int, t)
	for i := 0; i < t; i++ {
		n := readInt()
		arr := readInts()
		for j := 0; j < n; j++ {
			if j == 0 {
				if arr[j] != arr[j+1] && arr[j] != arr[j+2] {
					ans[i] = j
					break
				}
			} else if j == n-1 {
				if arr[j] != arr[j-1] && arr[j] != arr[j-2] {
					ans[i] = j
					break
				}
			} else if arr[j-1] != arr[j] && arr[j] != arr[j+1] {
				ans[i] = j
				break
			}
		}
	}
	for i := 0; i < t; i++ {
		println(ans[i] + 1)
	}
}

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

	return x
}

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

	return y
}

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

	return x
}

/*
You are given an array a consisting of n (n≥3) positive integers. It is known that in this array, all the numbers except one are the same (for example, in the array [4,11,4,4] all numbers except one are equal to 4

).

Print the index of the element that does not equal others. The numbers in the array are numbered from one.
Input

The first line contains a single integer t
(1≤t≤100). Then t

test cases follow.

The first line of each test case contains a single integer n
(3≤n≤100) — the length of the array a

.

The second line of each test case contains n
integers a1,a2,…,an (1≤ai≤100

).

It is guaranteed that all the numbers except one in the a

array are the same.
Output

For each test case, output a single integer — the index of the element that is not equal to others.
*/

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		a := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Scan(&a[j])
		}
		var correct int
		if a[0] != a[1] {
			if a[0] != a[2] {
				correct = a[1]
			} else {
				correct = a[0]
			}
		} else {
			correct = a[0]
		}
		for j := 0; j < n; j++ {
			if a[j] != correct {
				fmt.Println(j + 1)
				break
			}
		}
	}
}

package main

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

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

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

func Fscanf(format string, x ...interface{}) {
	fmt.Fscanf(reader, format, x...)
}

func Solution() {
	var caseCount int
	Fscanf("%d\n", &caseCount)

	var numCount, num int

	for caseIndex := 0; caseIndex < caseCount; caseIndex++ {
		Fscanf("%d\n", &numCount)

		counter := map[int]int{}
		indices := map[int]int{}

		Fscanf("%d", &num)
		counter[num]++
		indices[num] = 1

		Fscanf("%d", &num)
		counter[num]++
		indices[num] = 2

	nextCase:
		for numIndex := 3; numIndex <= numCount; numIndex++ {
			Fscanf("%d", &num)

			counter[num]++
			indices[num] = numIndex

			for oneKey, oneValue := range counter {
				if oneValue >= 2 {
					for otherKey := range counter {
						if otherKey != oneKey {
							Fprintf("%d\n", indices[otherKey])
							for newIndex := numIndex + 1; newIndex <= numCount; newIndex++ {
								Fscanf("%d", &num)
							}
							Fscanf("\n")

							break nextCase
						}
					}
				}
			}
		}
	}
}

func main() {
	Solution()
	writer.Flush()
}

// 1512A. Spy Detected!
package main

import (
	"fmt"
)

func main() {
	var T, n, curr, first, second int
	fmt.Scan(&T)
	for t := 1; t <= T; t++ {
		fmt.Scan(&n)
		equal := -1
		ans := -1
		for i := 1; i <= n; i++ {
			if i == 1 {
				fmt.Scan(&first)
			} else if i == 2 {
				fmt.Scan(&second)
				if first == second {
					equal = first
				}
			} else {
				fmt.Scan(&curr)
				if equal == -1 {
					if first == curr {
						equal = first
						ans = 2
					} else {
						equal = second
						ans = 1
					}
				} else {
					if curr != equal {
						ans = i
					}
				}
			}
		}
		fmt.Println(ans)
	}

}

package main

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

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

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
}

const MAXN = 2e5 + 5

func Solve() {
	var a []int
	n := ri()
	for i := 0; i < n; i++ {
		a = append(a, ri())
	}
	for i := 0; i < n; i++ {
		cnt := 0
		for j := 0; j < n; j++ {
			if a[i] != a[j] {
				cnt++
			}
		}
		if cnt == n-1 {
			fmt.Println(i + 1)
			return
		}
	}
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		p, m := 0, map[int][2]int{}
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &p)
			v, ok := m[p]
			if ok {
				v[0]++
				m[p] = v
			} else {
				m[p] = [2]int{1, j + 1}
			}
		}
		for _, v := range m {
			if v[0] == 1 {
				fmt.Fprintln(w, v[1])
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

func main() {
	var t int
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()

	fmt.Fscan(r, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)
		numbers := make([]int, n)

		for j := 0; j < n; j++ {
			fmt.Fscan(r, &numbers[j])
		}

		for j := range numbers {
			if numbers[j] != numbers[(j+1)%n] && numbers[j] != numbers[(j+2)%n] {
				fmt.Fprintln(w, j+1)
				break
			}
		}
	}
}

package main

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

func main() {
	var cases int
	fmt.Scanln(&cases)
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)

	for ; cases > 0; cases-- {
		n := parseInt(getString(reader))

		array := getIntln(reader)

		writer.WriteString(fmt.Sprintf("%d\n", getDiffindex(array, n)))
	}
	writer.Flush()
}

func getDiffindex(A []int, n int) int {
	first, last, lastSecond := A[0], A[n-1], A[n-2]

	if last != lastSecond {
		if last == first {
			return n - 1
		} else {
			return n
		}
	}

	for i := 0; i < n; i++ {
		if A[i] != last {
			return i + 1
		}
	}

	return -1
}

func getString(in *bufio.Reader) string {
	res, _ := in.ReadString('\n')
	res = strings.ReplaceAll(res, "\n", "")
	res = strings.ReplaceAll(res, "\r", "")
	res = strings.TrimSpace(res)
	return res
}

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

func scan() string {
	for sc.Scan() {
		break
	}
	return sc.Text()
}

func scanInt() int {
	i, err := strconv.Atoi(scan())
	if err != nil {
		panic(err)
	}
	return i
}

func scanInt8() int8 {
	i, err := strconv.ParseInt(scan(), 10, 8)
	if err != nil {
		panic(err)
	}
	return int8(i)
}

func scanInt64() int64 {
	i, err := strconv.ParseInt(scan(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

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

func min(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] < a {
			a = ints[i]
		}
	}
	return a
}

func max(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] > a {
			a = ints[i]
		}
	}
	return a
}

type Noop struct{}

var noop = Noop{}

func proc() {
	n := scanInt()
	mas := make([]int, n)
	for i := 0; i < n; i++ {
		mas[i] = scanInt()
	}
	if mas[0] != mas[1] && mas[0] != mas[n-1] {
		fmt.Println(1)
		return
	}
	if mas[0] != mas[n-1] && mas[1] != mas[n-1] {
		fmt.Println(n)
		return
	}
	for i := 1; i+1 < n; i++ {
		if mas[0] != mas[i] && mas[i] != mas[n-1] {
			fmt.Println(i + 1)
			return
		}
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	t := scanInt()
	for i := 0; i < t; i++ {
		proc()
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	n := mustReadInt(r)
	for i := int64(0); i < n; i++ {
		k := mustReadInt(r)
		nums := mustReadNNumbs(r, k)
		if nums[0] != nums[1] {
			if nums[0] == nums[2] {
				fmt.Println(2)
			} else {
				fmt.Println(1)
			}
		} else {
			for p := 2; p < int(k); p++ {
				if nums[0] != nums[p] {
					fmt.Println(p + 1)
					break
				}
			}
		}
	}
}

func mustReadNNumbs(r *bufio.Reader, n int64) []int64 {
	nums := make([]int64, n)
	var err error
	for i, s := range strings.Split(mustReadLine(r), " ") {
		nums[i], err = strconv.ParseInt(s, 10, 64)
		checkError(err)
	}
	return nums
}
func mustReadInt(r *bufio.Reader) int64 {
	numb, err := strconv.ParseInt(mustReadLine(r), 10, 64)
	checkError(err)
	return numb
}

func mustReadLine(r *bufio.Reader) string {
	s, _, err := r.ReadLine()
	checkError(err)
	return string(s)
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

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

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

func solve(n int, a []int) int {
	for i := range a {
		if i == 0 {
			if a[i] != a[i+1] && a[i] != a[i+2] {
				return i + 1
			}
			continue
		}
		if i == n-1 {
			if a[i] != a[i-1] && a[i] != a[i-2] {
				return i + 1
			}
			continue
		}
		if a[i] != a[i-1] && a[i] != a[i+1] {
			return i + 1
		}
	}
	return -1
}

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

package main

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

func getLeftValue(n int32, i int32) int32 {
	if i == 0 {
		return n - 1
	} else {
		return i - 1
	}
}

func getRightValue(n int32, i int32) int32 {
	if i == n-1 {
		return 0
	} else {
		return i + 1
	}
}

func solve(n int32, arr []int32) int32 {
	for i := int32(0); i < n; i++ {
		left := getLeftValue(n, i)
		right := getRightValue(n, i)
		if arr[i] != arr[left] && arr[i] != arr[right] {
			return i + 1
		}
	}
	return -1
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		m := int32(0)
		arr := []int32{}
		fmt.Fscanf(in, "%d\n", &n, &m)
		for i := int32(0); i < n; i++ {
			if i > 0 {
				fmt.Fscanf(in, " ")
			}
			fmt.Fscanf(in, "%d", &m)
			arr = append(arr, m)
		}
		fmt.Fscanf(in, "\n")
		fmt.Fprintf(out, "%d\n", solve(n, arr))
		tt--
	}
	out.Flush()
}

package main

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

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

		fmt.Println(solve(n, arr) + 1)
		tt--
	}
}

func solve(n int, arr []int) int {
	b := make([]int, len(arr))
	copy(b, arr)
	sort.Ints(b)
	if b[0] == b[1] {
		return (check(b[len(b)-1], arr))
	} else {
		return (check(b[0], arr))
	}
}

func check(n int, arr []int) int {
	for i, v := range arr {
		if v == n {
			return i
		}
	}
	return -1
}

package main

import (
    "fmt"
    "sort"
)

func main() {
    var t int
    fmt.Scan(&t)
    for i := 0; i < t; i++ {
        var n int
        fmt.Scan(&n)
        values := make([]int, n)
        for v := range(values) {
            fmt.Scan(&values[v])
        }

        var some = make([]int, 3)
        copy(some, values[0:3])
        sort.Ints(some)

        for i, value := range(values) {
            if value != some[1] {
                fmt.Println(i + 1)
                break
            }
        }
    }
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var t int
	fmt.Scan(&t)
	for T := 0; T < t; T++ {
		var n int
		fmt.Scan(&n)
		array := make([]int, n)
		for i := range(array) {
			fmt.Scan(&array[i])
		}
		med := make([]int, 3)
		copy(med, array[0 : 3])
		sort.Ints(med)
		for i, val := range(array) {
			if val != med[1] {
				fmt.Println(i + 1)
				break
			}
		}
	}
}

package main

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

func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()

	solve := func() {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		cur := 0
		var ans int
		for i := 1; i < n; i++ {
			if a[0] != a[i] {
				cur++
				ans = i
			}
		}
		if cur != n-1 {
			Fprintln(out, ans+1)
		} else {
			Fprintln(out, 0+1)
		}
	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

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

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

func main() {
	defer writer.Flush()

	var T int = 0
	scanf("%d\n", &T)

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

		var n int = 0
		scanf("%d\n", &n)
		a_vec := make([]int, n)

		for i := 0; i < n; i++ {
			if i != n - 1 {
				scanf("%d ", &a_vec[i])
			} else {
				scanf("%d\n", &a_vec[i])
			}
		}

		numbers := make(map[int]int)
		for i := 0; i < n; i++ {
			if _, key := numbers[a_vec[i]]; key {
				numbers[a_vec[i]] += 1
			} else {
				numbers[a_vec[i]] = 1
			}
		}

		var spy int = 0
		for key, element := range numbers {
			if element == 1 {
				spy = key
			}
		}

		var index int = 0
		for i := 0; i < n; i++ {
			if a_vec[i] == spy {
				index = i + 1
			}
		}

		printf("%d\n", index)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, N, a int
	Fscan(in, &T)
	for t := 0; t < T; t++ {
		Fscan(in, &N)
		ns := make([]int, N)
		counter := make(map[int]int, 0)
		for n := 0; n < N; n++ {
			Fscan(in, &a)
			ns[n] = a
			v, _ := counter[a]
			counter[a] = v + 1
		}
		for i := 0; i < N; i++ {
			v, _ := counter[ns[i]]
			if v == 1 {
				Fprintln(out, i+1)
				break
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n int
		fmt.Fscan(in, &n)
		v := make([]int, n)
		for i := range v {
			fmt.Fscan(in, &v[i])
		}
		for i := range v {
			if v[i] != v[(i+1)%n] && v[i]!=v[(i+2)%n] {
				fmt.Println(i+1)
				break
			}
		}
	}
}

package main
import (
    "os"
    "fmt"
    "bufio"
)
var rd = bufio.NewReader(os.Stdin);
func main() {
    q := 0
    fmt.Fscan(rd, &q)
    for t := 0; t < q; t++ {
        n := 0
        fmt.Fscan(rd, &n)
        a := make([]int, n)
        for i := range a {
            fmt.Fscan(rd, &a[i])
        }
        if a[0] == a[1] {
            for i := 0; i < n; i++ {
                if a[i] != a[0] {
                    fmt.Println(i + 1)
                }
            }
        } else {
            if a[0] == a[2] {
                fmt.Println(2)
            } else {
                fmt.Println(1)
            }
        }
    }
}

package main

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

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

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

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

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

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

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

	}
	return m

}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}

}

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

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

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

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

		}

		for j := 0; j < n; j++ {
			if j > 0 && j < n-1 {
				if array[j] != array[j-1] && array[j] != array[j+1] {
					fmt.Println(j + 1)
					break
				}
			} else {
				if j == 0 {
					if array[j] != array[1] && array[j] != array[2] {
						fmt.Println(1)
						break
					}
				} else {
					if array[j] != array[j-1] && array[j] != array[j-2] {
						fmt.Println(n)
						break
					}
				}
			}
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func ScanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func ScanInt() int {
	return int(ScanInt64())
}

func ScanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		n := ScanInt()
		cnts := map[int]int{}
		inds := map[int]int{}

		for i := 1; i <= n; i++ {
			a := ScanInt()
			cnts[a]++
			inds[a] = i
		}

		for a, cnt := range cnts {
			if cnt == 1 {
				fmt.Println(inds[a])
			}
		}
	}
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

	for t1 := 0; t1 < t; t1++ {
		var n int

		fmt.Fscan(r, &n)

		a := make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		ans := solve(a)

		fmt.Println(ans)
	}
}

func solve(a []int) int {

	mp := make([]int, 101)

	for i := 0; i < len(a); i++ {
		mp[a[i]]++
	}

	var v int

	for j :=0; j < len(mp); j++ {
		if mp[j] == 1 {
			v = j
			break
		}
	}

	for i := 0; i < len(a); i ++ {
		if a[i] == v {
			return i + 1
		}
	}

	return -1
}

package main

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

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

	var (
		line        string
		setCount    int
		arrayLength int
		array       []int
	)
	for scanner.Scan() {
		line = scanner.Text()

		if setCount == 0 {
			setCount = parseInt(line)
			continue
		}

		if arrayLength == 0 {
			arrayLength = parseInt(line)
			continue
		}

		array = parseIntArray(line)

		fmt.Println(whatIndexOfSpy(array))
		arrayLength = 0
		array = nil
	}
}

func parseInt(line string) int {
	i, err := strconv.Atoi(line)
	if err != nil {
		panic(err)
	}

	return i
}

func parseIntArray(line string) []int {
	parts := strings.Split(line, " ")

	arr := make([]int, 0, len(parts))
	for _, part := range parts {
		arr = append(arr, parseInt(part))
	}

	return arr
}

func whatIndexOfSpy(array []int) int {
	if len(array) <= 2 {
		return 2
	}

	first := array[0]
	second := array[1]
	third := array[2]

	if first == second && second == third {
		for i, num := range array[3:] {
			if first != num {
				return i + 3 + 1
			}
		}

		return 0
	} else {
		// странный один из первых трех
		if first == second {
			if first == third {
				return 2
			} else {
				return 3
			}
		} else {
			if first == third {
				return 2
			} else {
				return 1
			}
		}
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		N := sc.nextInt()
		arr := sc.nextInts(N)

		cnt := make([]int, 101)
		for i := 0; i < N; i++ {
			cnt[arr[i]]++
		}
		ans := -1
		for i := 0; i < N; i++ {
			if cnt[arr[i]] == 1 {
				ans = i + 1
			}
		}
		fmt.Fprintln(wr, ans)
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n int
		fmt.Fscan(in, &n)
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		for i := 0; i < n; i++ {
			c := 0
			for j := 0; j < n; j++ {
				if arr[i] == arr[j] {
					c++
				}
			}
			if c == 1 {
				fmt.Fprintln(out, i + 1)
				break
			}
		}
		t--
	}
	out.Flush()

}

package main

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

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		cnt := map[int]int{}
		for _, v := range a {
			cnt[v]++
		}
		for i, v := range a {
			if cnt[v] == 1 {
				Fprintln(out, i+1)
				return
			}
		}

	}

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

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

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

package main

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

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	buffer := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		n = 0
		fmt.Scanf("%d\n", &n)
		tempstr, _, _ := buffer.ReadLine()
		sl := strings.Split(string(tempstr), " ")
		for j := 0; j < n; j++ {
			tn,_=strconv.Atoi(sl[j])
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl)+1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		n=0
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			fmt.Scan(&tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(n,"|",nsl, "|",IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			fmt.Scan(&tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(n,"|",nsl, "|",IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			fmt.Scan(&tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(nsl, "|",IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			fmt.Scan(&tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			if j == n+1 {
				fmt.Scanf("%d\n", &tn)
			} else {
				fmt.Scanf("%d", &tn)
			}
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t   int
		n   int
		nsl []int
		tn  int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		nsl = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			fmt.Scanf("%d", &tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t int
		n int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var nsl []int = nil
		fmt.Scanf("%d\n", &n)
		for j := 0; j < n; j++ {
			var tn int
			fmt.Scanf("%d", &tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(nsl,count,uniq,IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

import (
	"fmt"
)

func main() {
	var (
		t int
		n int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var nsl []int = nil
		fmt.Scanf("%d\n", &n)
		for k := 0; k < n; k++ {
			var tn int
			fmt.Scanf("%d", &tn)
			nsl = append(nsl, tn)
		}
		count := CountValue(nsl)
		uniq := UniqueValue(count)
		fmt.Println(IndexOf(uniq, nsl) + 1)
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}
func UniqueValue(dict map[int]int) int {
	for k, v := range dict {
		if 1 == v {
			return k
		}
	}
	return -1
}

func IndexOf(element int, slice []int) int {
	for k, v := range slice {
		if element == v {
			return k
		}
	}
	return -1
}

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run(out *bufio.Writer) {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				Fprintln(out, v.idx+1)
				Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Open("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = W.Flush()
		_ = file.Close()
	}(out)
	NewA(F).run(W)
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

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

type arrWithIndex struct {
	count int
	idx   int
}

func (in *A) run(out *bufio.Writer) {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		n := in.nextInt()
		mp := map[int]arrWithIndex{}
		for i := 0; i < n; i++ {
			x := in.nextInt()
			mp[x] = arrWithIndex{count: mp[x].count + 1, idx: i}
		}

		for _, v := range mp {
			if v.count == 1 {
				Fprintln(out, v.idx+1)
				Println(v.idx + 1)
				break
			}
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Open("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = file.Close()
		_ = W.Flush()
	}(out)
	NewA(F).run(W)
}

func NewA(r *bufio.Reader) *A {
	return &A{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type A struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *A) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

package main

import (
	"fmt"
	"sort"
)

func code() {
	var n, val int
	fmt.Scanf("%d", &n)

	var arr []int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &val)
		arr = append(arr, val)
	}
	real := make([]int, len(arr))
	copy(real, arr)
	sort.Ints(arr)

	for i := 0; i < n; i++ {
		if real[i] != arr[1] {
			fmt.Println(i + 1)
		}
	}
}

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

	for ; test > 0; test-- {
		code()
	}
}

package main

import (
	"fmt"
)

func code() int {
	var n, out int
	fmt.Scanf("%d", &n)

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

	if arr[0] != arr[1] {
		if arr[0] != arr[2] && arr[1] == arr[2] {
			return 1
		}
		if arr[1] != arr[2] && arr[0] == arr[2] {
			return 2
		}
	}

	for i := 2; i < n; i++ {
		if arr[i] != arr[0] {
			out = i + 1
		}
	}

	return out
}

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

	for t := 0; t < test; t++ {
		fmt.Println(code())
	}
}

package main

import (
	"fmt"
)

func code() int {
	var n, out int
	fmt.Scanf("%d", &n)

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

	if arr[0] != arr[1] {
		if arr[0] != arr[2] && arr[1] == arr[2] {
			out = 1
		}
		if arr[1] != arr[2] && arr[0] == arr[2] {
			out = 2
		}
	}

	for i := 2; i < n; i++ {
		if arr[i] != arr[0] {
			out = i + 1
		}
	}

	return out
}

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

	for t := 0; t < test; t++ {
		fmt.Println(code())
	}
}

package main

import (
	"fmt"
)

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

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

	if arr[0] != arr[1] {
		if arr[0] != arr[2] && arr[1] == arr[2] {
			return 0
		}
		if arr[1] != arr[2] && arr[0] == arr[2] {
			return 1
		}
	}

	for i := 2; i < n; i++ {
		if arr[i] != arr[0] {
			return i
		}
	}

	return -1
}

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

	for t := 0; t < test; t++ {
		fmt.Println(code())
	}
}

package main

import (
	"fmt"
)

func question01(arr []int, arrSize int) int {
	index := -1
	for i :=0 ; i< arrSize - 2; i++ {
		if arr[i] != arr[i+1] || arr[i] != arr[i+2] {			// 4 =/= 5
			if arr[i] == arr[i+2] {
				index = i+1
			}	else if arr[i] == arr[i+1] {
				index = i +2
			} else {
				index = i
			}
		}
	}
	return index+1
}

func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)
	for i:=0; i< testCases ; i++ {
		var arrSize int
		fmt.Scanf("%d\n", &arrSize)
		arrs := make([]int, arrSize)
		for i, _ := range arrs {
			fmt.Scanf("%d", &arrs[i])
		}
		fmt.Println(question01(arrs, arrSize))
	}
}

package main

import "fmt"

func question01(arr []int, arrSize int) int {
	index := -1
	for i :=0 ; i< arrSize - 2; i++ {
		if arr[i] != arr[i+1] || arr[i] != arr[i+2] {			// 4 =/= 5
			if arr[i] == arr[i+2] {
				index = i+1
			}	else if arr[i] == arr[i+1] {
				index = i +2
			} else {
				index = i
			}
		}
	}
	return index+1
}

func main() {
	var testCases int
	fmt.Scanf("%d\n", &testCases)
	for i:=0; i< testCases ; i++ {
		var arrSize int
		fmt.Scanf("%d\n", &arrSize)
		var arrs []int
		for i:=0 ; i< arrSize ; i++ {
			var test int
			fmt.Scanf("%d\n", &test)
			arrs = append(arrs, test)
		}
		fmt.Println(question01(arrs, arrSize))
	}

}

package main

import (
	"fmt"
	//"os"
	"sort"
)

func main() {

	var n int
	fmt.Scan(&n)

	var list [][]int = make([][]int,n)
	for i:=0;i<n;i++{
		var holder int
		fmt.Scan(&holder)
		list[i] = make([]int,0,holder)
		for j:=0;j<holder;j++{
			var inner_holder int
			fmt.Scan(&inner_holder)
			list[i] = append(list[i], inner_holder)
		}
	}

	newlist := duplicate_2d_slice(n, list)

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

		sort.Ints(newlist[i])

		var smallest int = smallest_int(newlist[i])
		var largest int = largest_int(newlist[i])

		var other int
		if smallest != newlist[i][1] {
			other = smallest
		} else {
			other = largest
		}

		fmt.Println(list)
		for key,value := range list[i] {
			if value == other {
				fmt.Println(key+1)
				break
			}
		}
	}
}

func duplicate_2d_slice(length int, original_slice [][]int) [][]int {
    var newlist [][]int = make([][]int,length)
    for i:=0;i<length;i++{
        newlist[i] = make([]int,0,len(original_slice[i]))
        for j:=0;j<len(original_slice[i]);j++{
            newlist[i] = append(newlist[i], original_slice[i][j])
        }
    }
    return newlist
}

func smallest_int(list []int) int {
    for i:=0;i<len(list);i++{
        if list[0] > list[i] {
            list[0] = list[i]
        }
    }
    return list[0]
}

func largest_int(list []int) int {
    for i:=0;i<len(list);i++{
        if list[0] < list[i] {
            list[0] = list[i]
        }
    }
    return list[0]
}

package main

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

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

	var m int
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &m)
		arr := make([]int, m)

		for j := 0; j < m; j++ {
			fmt.Fscan(in, &arr[j])
		}

		last, cur, next := arr[0], arr[1], arr[2]
		for j := 2; j < m; j++ {
			if last == cur && cur == next {
				last = cur
				cur = next
				next++
				continue
			}

			if cur != last {
				if cur != next {
					fmt.Println(cur)
					break
				} else {
					fmt.Println(last)
					break
				}
			} else {
				fmt.Println(next)
				break
			}
		}

	}
}

package main

import "fmt"

func main() {

	var T int
	fmt.Scan(&T)
	for T > 0 {
		T--
		var size int
		fmt.Scan(&size)

		counter := map[int]int{}
		indexer := map[int]int{}

		for i := 0; i < size; i++ {
			var num int
			fmt.Scan(&num)
			counter[num]++
			indexer[num] = i + 1
		}

		for k, v := range counter {
			if v == 1 {
				println(indexer[k])
			}
		}

	}
}

package main

import "fmt"

func findSpy(arr []int) int {
	counts := make(map[int]int)
	for _, v := range arr {
		counts[v]++
	}
	for v, c := range counts {
		if c == 1 {
			return v
		}
	}
	return -1
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var len int
		fmt.Scanf("%d\n", &len)
		arr := make([]int, len)
		for j := 0; j < len; j++ {
			fmt.Scanf("%d", &arr[j])
		}
		fmt.Scanf("\n")
		fmt.Println(findSpy(arr))
	}
}

package main

import "fmt"
var cnt[101] int
var a[101] int
func main()  {
	var t int
	fmt.Scanf("%d", &t)
	for i := 1; i <= t; i++ {
		var n int
		for j := 1; j <= 100; j++ {cnt[j] = 0;}
		fmt.Scanf("%d", &n)
		for j := 1; j <= n; j++ {
			fmt.Scanf("%d", &a[j]); cnt[a[j]]++;
		}
		for j := 1; j <= n; j++ {
			if(cnt[a[j]] == 1) {
				fmt.Println(j); break;
			}
		}
	}
}