package main

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

func solve() {
    a := []int64{ readInt64(), readInt64(), readInt64() }
    b := []int64{ a[0], a[1], a[2] }
    sort.Sort(Ints64(b))
    init := int64(0)
    if b[2] > 10 {
        d := b[2] - 5
        for i := range a {
            if a[i] >= d {
                a[i] = a[i] - d
            } else {
                init += d - a[i]
                a[i] = 0
            }
        }
    }

    best := int64(10000)
    for stay := int64(-1); stay < 100; stay++ {
        for s := 0; s < 4; s++ {
            for e := 0; e < 4; e++ {
                ok, cur := true, int64(0)
                for i := range a {
                    av := int64(0)
                    if stay == -1 {
                        if s <= i && i < e {
                            av++
                        }
                    } else {
                        av = stay

                        if s <= i {
                            av++
                        }

                        if i < e {
                            av++
                        }
                    }

                    if av < a[i] {
                        ok = false
                    } else {
                        cur += av-a[i]
                    }
                }

                if ok && cur < best {
                    best = cur
                }
            }
        }
    }
    fmt.Println(best + init)
}

// 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 (
	"bufio"
	"fmt"
	"os"
)

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

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

func solution(b int64, d int64, s int64) int64 {
	m := min(min(b, d), s)
	b -= m
	d -= m
	s -= m

	if b+d+s == 0 {
		return 0
	}

	if b+d == 0 {
		return s - 1 + s - 1
	}

	if d+s == 0 {
		return b - 1 + b - 1
	}

	if s+b == 0 {
		return d - 1 + d - 1
	}

	if b == 0 {
		if d < s {
			return s - 1 + s - 1 - d
		} else if d > s {
			return d - 1 + d - 1 - s
		}
		// d == s
		return d - 1
	}

	if s == 0 {
		if b < d {
			return d - 1 + d - 1 - b
		} else if b > d {
			return b - 1 + b - 1 - d
		}
		// b == d
		return b - 1
	}

	// d == 0
	if b < s {
		return s - 1 + s - 1 - b
	} else if b > s {
		return b - 1 + b - 1 - s
	}
	// b == s
	return b - 1
}

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

	var b, d, s int64
	fmt.Fscanf(bufin, "%d %d %d\n", &b, &d, &s)
	fmt.Fprintf(bufout, "%d\n", solution(b, d, s))
}

package main

import "fmt"

func sortTriple(a, b, c *uint64) {
    if *a > *b {
        *a, *b = *b, *a
    }
    if *b > *c {
        *b, *c = *c, *b
    }
    if *a > *b {
        *a, *b = *b, *a
    }
}

func main() {
    var a, b, c, d uint64
    fmt.Scanf("%d %d %d\n", &a, &b, &c)
    sortTriple(&a, &b, &c)
    if c - b > 1 {
        d += c - b - 1
        b = c - 1
    }
    if c - b == 1 {
        if b - a > 0 {
            d += b - a
            a = b
        }
    } else {
        if b - a > 1 {
            d += b - a - 1
            a = b - 1
        }
    }
    fmt.Printf("%d\n", d)
}

package main

import "fmt"

func sort(a, b, c *int64) {
	if (*c > *b) {
		*b, *c = *c, *b
	}
	if (*b > *a) {
		*a, *b = *b, *a
	}
	if (*c > *b) {
		*b, *c = *c, *b
	}
}

func getAns(a, b, c int64) int64{
	if a == b && b == c {
		return 0
	}
	if a == b {
		return a - c - 1
	}
	return a * 3 - a - b - c - 2
}

func main() {
	var a, b, c int64
	fmt.Scan(&a, &b, &c)
	sort(&a, &b, &c)
	fmt.Println(getAns(a, b, c))
}

package main

import (
	"fmt"
)

func main() {
	d := make([]int64, 3)
	if _, err := fmt.Scanf("%d %d %d\n", &d[0], &d[1], &d[2]); err != nil {
		return
	}

	mi, mc := max_index(d)
	if mc == 3 {
		fmt.Println(0)
	} else if mc == 2 {
		fmt.Println(d[mi]*3 - 1 - d[0] - d[1] - d[2])
	} else {
		fmt.Println(d[mi]*3 - 2 - d[0] - d[1] - d[2])
	}
}

func max_index(d []int64) (int, int) {
	max := d[0]
	max_i := 0
	max_count := 1
	for i := 1; i < len(d); i++ {
		if d[i] > max {
			max_i = i
			max = d[i]
			max_count = 1
		} else if d[i] == max {
			max_count++
		}
	}
	return max_i, max_count
}

package main

import "fmt"

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

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

	var max int64 = Max(b, Max(d, s))

	var result int64 = 0
	if b < max-1 {
		result += max - b - 1
	}
	if d < max-1 {
		result += max - d - 1
	}
	if s < max-1 {
		result += max - s - 1
	}

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

package main

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

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

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

func main() {
	sc := NewScanner()
	A := sc.NextInt64Array()
	ans := int64(1)

	for i := 0; i < 4; i++ {
		L := make([]int64, 3)
		for j := i; j < 3; j++ {
			L[j]++
		}
		for k := -1; k < 3; k++ {
			if k >= 0 {
				L[k]++
			}
			ok := true
			sm := int64(0)

			mx := A[0] - L[0]
			for q := 1; q < 3; q++ {
				mx = max(mx, A[q] - L[q])
			}
			for q := 0; q < 3; q++ {
				sm += A[q] - L[q] - mx
			}

			if ok {
				if ans == int64(1) || ans < sm {
					ans = sm
				}
			}
		}
	}
	fmt.Println(-ans)

}

package main

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

func solve() {
    a := []int64{ readInt64(), readInt64(), readInt64() }
    b := []int64{ a[0], a[1], a[2] }
    sort.Sort(Ints64(b))
    init := int64(0)
    if b[2] > 10 {
        d := b[2] - 5
        for i := range a {
            if a[i] >= d {
                a[i] = a[i] - d
            } else {
                init += d - a[i]
                a[i] = 0
            }
        }
    }

    best := int64(10000)
    for stay := int64(0); stay < 100; stay++ {
        for s := 0; s < 4; s++ {
            for e := 0; e < 4; e++ {
                ok, cur := true, int64(0)
                for i := range a {
                    av := stay
                    if i >= s {
                        av++
                    }
                    if i < e {
                        av++
                    }
                    if av < a[i] {
                        ok = false
                    } else {
                        cur += av-a[i]
                    }
                }
                if ok && cur < best {
                    best = cur
                }
            }
        }
    }
    fmt.Println(best + init)
}

// 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 (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"sort"
)

func solve() {
    a := []int64{ readInt64(), readInt64(), readInt64() }
    b := []int64{ a[0], a[1], a[2] }
    sort.Sort(Ints64(b))
    init := int64(0)
    if b[2] > 10 {
        d := b[2] - 5
        for i := range a {
            if a[i] >= d {
                a[i] = a[i] - d
            } else {
                init += d - a[i]
                a[i] = 0
            }
        }
    }

    best := int64(10000)
    for stay := int64(0); stay < 100; stay++ {
        for s := 0; s < 4; s++ {
            for e := 0; e < 4; e++ {
                ok, cur := true, int64(0)
                for i := range a {
                    av := stay
                    if stay > 0 {
                        if i >= s {
                            av++
                        }
                        if i < e {
                            av++
                        }
                    } else {
                        if i >= s && i < e {
                            av++
                        }
                    }
                    if av < a[i] {
                        ok = false
                    } else {
                        cur += av-a[i]
                    }
                }

                if ok && cur < best {
                    best = cur
                }
            }
        }
    }
    fmt.Println(best + init)
}

// 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 "fmt"

func sort(a, b, c *int64) {
	if (*c > *b) {
		*b, *c = *c, *b
	}
	if (*b > *a) {
		*a, *b = *b, *c
	}
	if (*c > *b) {
		*b, *c = *c, *b
	}
}

func getAns(a, b, c int64) int64{
	if a == b && b == c {
		return 0
	}
	if a == b {
		return a - c - 1
	}
	return a * 3 - a - b - c - 2
}

func main() {
	var a, b, c int64
	fmt.Scan(&a, &b, &c)
	sort(&a, &b, &c)
	fmt.Println(getAns(a, b, c))
}

package main

import "fmt"

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

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

	var max int64 = Max(b, Max(d, s))

	var result int64 = 0
	if b < max-1 {
		result += max - b + 1
	}
	if d < max-1 {
		result += max - d - 1
	}
	if s < max-1 {
		result += max - s - 1
	}

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

package main

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

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

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

func main() {
	sc := NewScanner()
	A := sc.NextInt64Array()
	ans := int64(1)

	for i := 0; i < 4; i++ {
		L := make([]int64, 3)
		for j := i; j < 3; j++ {
			L[j]++
		}
		for k := -1; k < 3; k++ {
			if k >= 0 {
				L[k]++
			}
			ok := true
			sm := int64(0)

			mx := A[0] - L[0]

			for q := 1; q < 3; q++ {
				mx = max(mx, A[q] - L[q])
			}
			for q := 0; q < 3; q++ {
				sm += A[q] - L[q] - mx
				if A[q] - L[q] - mx > 0 {
					ok = false
				}
			}

			if ok {
				if ans == int64(1) || ans < sm {
					ans = sm
				}
			}
		}
	}
	fmt.Println(-ans)

}


package main

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

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 scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()

	var t int
	scanws(&t)

	var l int
	var s []byte

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

		l, s = 0, nil
		scanws(&l)
		scanws(&s)

		f := 0
		timur := []byte("Timur")

		if l != 5 {
			printf("\nNO")
			continue
		}

		for j := 0; j < l; j++ {

			index := bytes.IndexByte(timur, s[j])
			if  index >= 0 {
				timur[index] = 0
			} else {
				printf("\nNO")
				f = 1
				break
			}
		}

		if f == 0 {
			printf("\nYES")
		}

	}

}

package main

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

func sort_string(s string) string {
	ns := strings.Split(s, "")
	sort.Strings(ns)
	return strings.Join(ns, "")
}

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

	var input string
	var t, n int

	for fmt.Fscan(r, &t); t > 0; t-- {
		fmt.Fscan(r, &n, &input)

		if sort_string(input) == sort_string("Timur") {
			fmt.Fprintln(w, "YES")
		} else {
			fmt.Fprintln(w, "NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var T int
	var N int
	var s string
	var flag bool
	fmt.Scan(&T)
	for T > 0 {
		fmt.Scan(&N)
		fmt.Scan(&s)
		flag = strings.Contains(s, "T") && strings.Contains(s, "i") && strings.Contains(s, "m") && strings.Contains(s, "u") && strings.Contains(s, "r") && len(s) == 5
		if flag {
			fmt.Println("YES")

		} else {
			fmt.Println("NO")
		}
		T--
	}
}

package main

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

func solve(r *bufio.Reader) {
	var n int
	var s string
	fmt.Fscan(r, &n, &s)
	if n != 5 {
		fmt.Println("NO")
		return
	}

	m := make(map[rune]bool)
	for _, l := range s {
		m[l] = true
	}

	for _, l := range "Timur" {
		if !m[l] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	return
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

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

type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	nrTests, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < nrTests; i++ {
		scanner.Scan()
		nrSym, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		line1 := scanner.Text()
		good := true
		if nrSym != 5 {
			good = false
		} else {
			if SortString(line1) != "Timru" {
				good = false
			}
		}
		if good {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var ts , m int
	var name string
	fmt.Scan(&ts)
	for ts > 0 {
		fmt.Scan(&m)
		fmt.Scan(&name)
		if m == 5 {
			s := []rune(name)
			sort.Slice(s , func(i int , j int) bool { return s[i] < s[j] })
			if string(s) == "Timru" {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			fmt.Println("No")
		}
		ts--
	}
}

package main

import "fmt";

func main (){

    var tc int;
    timur := "Timur";

    fmt.Scanln(&tc);
    for t := 1; t<=tc; t++{
        var n int;
        var s string;
        fmt.Scanln(&n);
        fmt.Scanln(&s);
        check := true;
        if(n != 5){
            check=false;
        }
        for i := 0; i < 5; i++{
            valid := false;
            for j := 0; j < n; j++{
                if(timur[i]==s[j]){
                    valid = true;
                }
            }
            if(valid==false){
                check=false;
            }
        }
        if(check==false){
            fmt.Println("NO");
        } else {
            fmt.Println("YES");
        }
    }
}

package main

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

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

func checkPerm(n, m int, x, y string) bool {
	if n != m {
		return false
	}
	var v, w = []rune(x), []rune(y)
	sort.Slice(v, func(i, j int) bool {
		return v[i] < v[j]
	})
	sort.Slice(w, func(i, j int) bool {
		return w[i] < w[j]
	})
	for i := range v {
		if v[i] != w[i] {
			return false
		}
	}
	return true
}

func solve(n int, s string) string {
	if checkPerm(n, 5, s, "Timur") {
		return "YES"
	}
	return "NO"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n, &s)
		fmt.Println(solve(n, s))
	}
}

package main

import (
	"fmt"
	"sort"
)

func Solve_1722A() {
	var t, n int
	var name string
	fmt.Scan(&t)
	for t > 0 {
		fmt.Scan(&n)
		fmt.Scan(&name)
		if n != 5 {
			fmt.Println("NO")
		} else {
			na := []byte(name)
			sort.Slice(na, func(i, j int) bool { return na[i] < na[j] })
			if string(na) == "Timru" {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
		t--
	}
}

func main() {
	Solve_1722A()
}

package main

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

func main(){
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for i := 0; i < t; i++ {
		var n int
		var s string
		fmt.Fscan(cin, &n)
		fmt.Fscan(cin, &s)
		if n != 5 {
			fmt.Println("NO")
			continue
		}

		ref := map[byte]int{
			'T': 1,
			'i': 1,
			'm': 1,
			'u': 1,
			'r': 1,
		}

		ok := true
		for i := 0; i < 5; i++ {
			if ref[s[i]] > 0 {
				ref[s[i]] -= 1
			}else {
				ok = false
				break
			}
		}

		if ok {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

var name string = "Timur"

func findAns(str string, n int) bool {
	if n != 5 {
		fmt.Println("NO")
		return false
	}
	arr := make([]int, 58)
	for i := 0; i < len(str); i++ {
		arr[str[i]-65] = 1
	}
	for i := 0; i < 5; i++ {
		if arr[name[i]-65] != 1 {
			fmt.Println("NO")
			return false
		}
	}
	fmt.Println("YES")
	return true
}

func main() {
	t, n := 0, 0
	fmt.Scan(&t)
	for t > 0 {
		fmt.Scan(&n)
		tmp := ""
		fmt.Scan(&tmp)
		findAns(tmp, n)
		t--
	}
}

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

const TargetName string = "Timur"

func main() {
	defer writer.Flush()
	var t, n, nameLen uint32
	var name, sortName, sortKnown string
	nameLen = uint32(len(TargetName))
	sortKnown = sortString(TargetName)

	scanws(&t)

	for ; t > 0; t-- {
		scanws(&n)
		scanws(&name)
		sortName = sortString(name)
		switch {
		case n != nameLen || strings.Compare(sortKnown, sortName) != 0:
			printf("NO\n")
		default:
			printf("YES\n")
		}
	}
}

func sortString(checkName string) string {
	var newString string
	var tmp []string
	newString = checkName
	tmp = strings.SplitAfter(newString, "")
	sort.Strings(tmp)
	return strings.Join(tmp, "")
}

func yesNoMap(b uint8) string {
	return map[uint8]string{0: "NO", 1: "YES"}[b]
}

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 scanws(a ...interface{}) { fmt.Fscan(reader, a...) }

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scan(&t)
	for j := 0; j < t; j++ {
		var n int
		fmt.Scan(&n)
		var s string
		fmt.Scan(&s)
		if n > 5 || n < 5 {
			fmt.Printf("NO\n")
		} else {
			map1 := map[string]int{
				"T": 1, "i": 1, "m": 1, "u": 1, "r": 1,
			}
			flag := 1
			//fmt.Printf("%v\n",s)
			for i := 0; i < len(s); i++ {
				if _, found := map1[string(s[i])]; found {
					delete(map1, string(s[i]))
				} else {
					flag = 0
					break
				}
				//fmt.Printf("map1==> %v\n",map1)
			}
			if flag == 1 {
				fmt.Printf("YES\n")
			} else {
				fmt.Printf("NO\n")
			}
		}
	}
}

package main

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

var (
	in   *bufio.Reader = bufio.NewReader(os.Stdin)
	t, n int
	s    string
	mp   map[byte]int = map[byte]int{
		'T': 1,
		'i': 1,
		'm': 1,
		'u': 1,
		'r': 1,
	}
)

func main() {
	fmt.Fscan(in, &t)
	for t > 0 {
		fmt.Fscan(in, &n, &s)
		solve()
		t--
	}
}

func solve() {
	if n != 5 {
		fmt.Println("NO")
	} else {
		c := map[byte]int{}
		for i := range s {
			c[s[i]]++
		}
		for key := range c {
			if c[key] != mp[key] {
				fmt.Println("NO")
				return
			}
		}
		fmt.Println("YES")
	}
}

package main

import (
	"fmt"
	"strings"
)

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

	s := make([]string, t)
	n := make([]int, t)

	for i := 0; i < t; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&s[i])
	}
	for i := 0; i < t; i++ {
		if !strings.Contains(s[i], "T") || n[i] != 5 || !strings.Contains(s[i], "i") || !strings.Contains(s[i], "m") || !strings.Contains(s[i], "u") || !strings.Contains(s[i], "r") {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

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([]string, t)
	for i := 0; i < t; i++ {
		n := readInt()
		s := readString()
		if n != 5 {
			ans[i] = "NO"
			continue
		}
		r := "Timur"
		arr := make([]int, 52)
		for i := 0; i < 5; i++ {
			if 'a' <= r[i] && r[i] <= 'z' {
				arr[r[i]-'a']++
			} else {
				arr[r[i]-'A'+26]++
			}
		}
		for i := 0; i < n; i++ {
			if 'a' <= s[i] && s[i] <= 'z' {
				arr[s[i]-'a']--
			} else {
				arr[s[i]-'A'+26]--
			}
		}
		f := true
		for _, v := range arr {
			if v != 0 {
				ans[i] = "NO"
				f = false
				break
			}
		}
		if f {
			ans[i] = "YES"
		}
	}
	for i := 0; i < t; i++ {
		println(ans[i])
	}
}

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

	return x
}

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

	return y
}

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

	return x
}

package main

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

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

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

		sort.Slice(s, func(i, j int) bool { return s[i] < s[j] })
		if n != 5 || string(s) != "Timru" {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d\n", &m)
		var s string
		fmt.Scanf("%s\n", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		//fmt.Println(s)
		//fmt.Println(i)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
    "strings"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		x:= "Timur"
		var (
			n,tally int
			input string
		)
		fmt.Scan(&n,&input)
		if n == 5 {
			for k:=0;k<5;k++{
				if strings.Count(input, string(x[k])) == 1 {
					tally++
				}
			}
			if tally == 5 {
				fmt.Println("YES")
				continue
			}
		}
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"sort"
)

type runes []rune

func (s runes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s runes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s runes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(runes(r))
	return string(r)
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t > 0 {
		t--
		var n int
		var s string
		fmt.Scanf("%d\n", &n)
		fmt.Scanf("%s\n", &s)
		if n != 5 {
			fmt.Println("NO")
			continue
		}
		if "Timru" == SortString(s) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func (in *CF1722A) 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 *CF1722A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1722A
Date: 9/2/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1722/A
Problem: CF1722A
**/
func (in *CF1722A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		mapa := map[uint8]int{
			'T': 1,
			'i': 1,
			'm': 1,
			'u': 1,
			'r': 1,
		}
		n := in.NextInt()
		str := in.NextString()
		ans := true
		if n == len(mapa) {
			for i := 0; i < n; i++ {
				if v, e := mapa[str[i]]; e && v == 1 {
					mapa[str[i]] = 0
					continue
				} else {
					ans = false
					break
				}
			}
		} else {
			ans = false
		}
		if ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

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

func main() {
	r := readerStdin()

	name := []byte("Timur")
	sort.Slice(name, func(i, j int) bool { return name[i] < name[j] })
	for cases := readInt(r); cases != 0; cases-- {
		strLen, str := readInt(r), []byte(readString(r))
		if strLen != 5 {
			fmt.Println("NO")
			continue
		}

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

		if string(name) == string(str) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func readerStdin() *bufio.Reader {
	return bufio.NewReader(os.Stdin)
}

func readString(r *bufio.Reader) (s string) {
	s, _ = r.ReadString('\n')
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return
}

func readInt(r *bufio.Reader) (i int) {
	str := readString(r)
	i, _ = strconv.Atoi(str)
	return
}

package main

import (
	"fmt"
	"sort"
)

type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func SortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func solve() {
	var n int32
	fmt.Scan(&n)
	var s string

	fmt.Scan(&s)
	s = SortString(s)
	// fmt.Println(s)
	if n != 5 || len(s) != 5 || s != "Timru" {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")
}

func main() {
	var t int32
	fmt.Scan(&t)

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

package main

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

func main() {
	var (
		t    int
		n    int
		s    string
		good []string
	)
	good = append(good, "T", "i", "m", "r", "u")
	//}
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		c := 0
		fmt.Scanf("%d\n", &n)
		fmt.Scanf("%s\n", &s)
		sl := strings.Split(s, "")
		sort.Strings(sl)
		if len(sl) == len(good) {
			for j := 0; j < n; j++ {
				if sl[j] == good[j] {
					c++
				}
			}
		}
		if c == 5 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t, n int
	o := []byte{'T', 'i', 'm', 'u', 'r'}
	sort.Slice(o, func(i, j int) bool {
		return o[i] < o[j]
	})
	so := string(o)
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var s []byte
		fmt.Fscan(in, &n, &s)
		if n > 5 || n < 5 {
			fmt.Println("No")
		} else {
			sort.Slice(s, func(i, j int) bool {
				return s[i] < s[j]
			})
			ss := string(s)
			if so == ss {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		}

	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d\n", &m)
		var s string
		fmt.Scanf("%s\n", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		//fmt.Println(s)
		//fmt.Println(i)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		fmt.Println(s)
		fmt.Println(i)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		//fmt.Println(s)
		fmt.Println(i)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		//fmt.Println(s)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// Timru是对字符Timur的升序排列
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		fmt.Println(s)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		fmt.Println(s)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var name = "Timru"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	//b := []byte(name)
	//sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	//name = string(b)
	//fmt.Println(name)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var name = "Timur"
	// 对name字符串排序
	// 类似c++的sort，升序排列
	b := []byte(name)
	sort.Slice(b, func(i, j int) bool { return b[i] < b[j] })
	name = string(b)
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Scanf("%d", &m)
		var s string
		fmt.Scanf("%s", &s)
		b1 := []byte(s)
		sort.Slice(b1, func(i, j int) bool { return b1[i] < b1[j] })
		s = string(b1)
		if name == s {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Scan(&n)
		var reference string = "Timur"
		var word string
		fmt.Scan(&word)
		tally:=0
		for j:=0;j<len(word);j++{
			for k:=0;k<5;k++{
				if string(word[j]) == string(reference[k]) {
					reference = string(reference[:k])+string(reference[k:])
					tally++
					break
				}
			}
		}
		if tally == 5 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		var reference string = "Timur"
		var word string
		fmt.Scan(&n)
		fmt.Scan(&word)
		if len(word) != 5 {
			fmt.Println("NO")
		} else {
			tally:=0
			for j:=0;j<len(word);j++{	// miurT
				for k:=0;k<len(word);k++{
					if string(word[j]) == string(reference[k]) {
						reference = string(reference[:k])+string(reference[k:])
						tally++
						break
					}
				}
			}
			if tally == 5 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		var reference string = "Timur"
		var word string
		fmt.Scan(&n)
		fmt.Scan(&word)
		if len(word) != 5 {
			fmt.Println("NO")
		} else {
			tally:=0
			for j:=0;j<n;j++{	// miurT
				for k:=0;k<n;k++{
					if string(word[j]) == string(reference[k]) {
						reference = string(reference[:k])+string(reference[k:])
						tally++
						break
					}
				}
			}
			if tally == 5 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		var reference string = "Timur"
		var word string
		fmt.Scan(&n)
		fmt.Scan(&word)
		if n != 5 {
			fmt.Println("NO")
		} else {
			tally:=0
			for j:=0;j<n;j++{	// miurT
				for k:=0;k<n;k++{
					if string(word[j]) == string(reference[k]) {
						reference = string(reference[:k])+string(reference[k:])
						tally++
						break
					}
				}
			}
			if tally == 5 {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t > 0 {
		t--
		var n int
		var s string
		fmt.Scanf("%d\n", &n)
		fmt.Scanf("%s\n", &s)
		if n != 5 {
			fmt.Println("NO")
			continue
		}
		var sum int
		for _, c := range s {
			sum += int(c)
		}
		if sum != 529 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	results := make([]string, t)
	for t > 0 {
		t--
		var n int
		var s string
		fmt.Scanf("%d", &n)
		fmt.Scanf("%s", &s)
		if n != 5 {
			results = append(results, "NO")
			continue
		}
		var sum int
		for _, c := range s {
			sum += int(c)
		}
		if sum != 529 {
			results = append(results, "NO")
		} else {
			results = append(results, "YES")
		}
	}
	for _, v := range results {
		fmt.Println(v)
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for t > 0 {
		t--
		var n int
		var s string
		fmt.Scanf("%d", &n)
		fmt.Scanf("%s", &s)
		if n != 5 {
			fmt.Println("NO")
			continue
		}
		var sum int
		for _, c := range s {
			sum += int(c)
		}
		if sum != 529 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
	}
}

package main

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

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

func (in *CF1722A) 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 *CF1722A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1722A
Date: 9/2/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1722/A
Problem: CF1722A
**/
func (in *CF1722A) Run() {
	name := "Timur"
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		str := in.NextString()
		ans := true
		if n == len(name) {
			for i := 0; i < n; i++ {
				if strings.Contains(name, string(str[i])) {
					continue
				} else {
					ans = false
					break
				}
			}
		} else {
			ans = false
		}
		if ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

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

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

func (in *CF1722A) 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 *CF1722A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1722A
Date: 9/2/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1722/A
Problem: CF1722A
**/
func (in *CF1722A) Run() {
	name := "Timur"
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		str := in.NextString()
		ans := true
		if n == len(name) {
			for i := 0; i < n; i++ {
				if strings.Contains(name, string(str[i])) {
					continue
				} else {
					ans = false
					break
				}
			}
		}
		if ans {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

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

var hash = map[rune]bool{
	'T': true, 'i': true,
	'u': true, 'm': true,
	'r': true,
}

func main() {
	r := readerStdin()

	for cases := readInt(r); cases != 0; cases-- {
		strLen, str := readInt(r), readString(r)
		if strLen != 5 {
			fmt.Println("NO")
			continue
		}

		for _, char := range str {
			if _, ok := hash[char]; !ok {
				fmt.Println("NO")
				goto Next
			}
		}

		fmt.Println("YES")
	Next:
	}
}

func readerStdin() *bufio.Reader {
	return bufio.NewReader(os.Stdin)
}

func readString(r *bufio.Reader) (s string) {
	s, _ = r.ReadString('\n')
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return
}

func readInt(r *bufio.Reader) (i int) {
	str := readString(r)
	i, _ = strconv.Atoi(str)
	return
}

package main

import (
	"fmt"
	"strings"
)

func solve() {
	var n int32
	fmt.Scan(&n)
	var s string

	fmt.Scan(&s)
	if n != 5 || len(s) != 5 || strings.Contains(s, "T") || strings.Contains(s, "i") || strings.Contains(s, "m") || strings.Contains(s, "u") || strings.Contains(s, "r") {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")
}

func main() {
	var t int32
	fmt.Scan(&t)

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


package main

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

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	_r, _w := os.Stdin, os.Stdout
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var solve func()

	/*-------------------------------Todo-----------------------------------------*/

	solve = func() {
		var s string
		Fscan(in, &s)
		var n int = len(s)
		pos := map[byte]int{}
		for i := 0; i < n; i++ {
			pos[s[i]] = i
		}
		var i int
		for i < n {
			if i < pos[s[i]] {
				i++
			} else {
				break
			}
		}
		Fprintln(out, s[i:])
	}

	/*----------------------------------------------------------------------------*/
	var T int = 1
	Fscan(in, &T)
	for i := 0; i < T; i++ {
		solve()
	}
}

package main

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

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

func (in *CF1654B) 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 *CF1654B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

var mapa map[uint8]int

/**
Run solve the problem CF1654B
Date: 9/18/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1654/B
Problem: CF1654B
**/
func (in *CF1654B) Run() {
	var ans strings.Builder
	for t := in.NextInt(); t > 0; t-- {
		mapa = map[uint8]int{}
		str := in.NextString()
		for i := 0; i < len(str); i++ {
			mapa[str[i]]++
		}
		for maxp := maxPrefix(str); maxp != -1; {
			str = str[maxp:]
			maxp = maxPrefix(str)

		}
		ans.WriteString(str + "\n")
	}
	fmt.Print(ans.String())
}

func maxPrefix(str string) int {
	pre := false
	str += "-"
	preMap := map[uint8]int{}
	for i := 1; i < len(str); i++ {
		preMap[str[i-1]]++
		if exist(preMap) {
			mapa[str[i-1]]--
			pre = true
			continue
		} else {
			if pre {
				return i - 1
			}
			break
		}
	}
	return -1
}

func exist(preMap map[uint8]int) bool {
	for k, v := range preMap {
		value, e := mapa[k]
		if !e {
			return false
		}
		if value <= v {
			return false
		}
	}
	return true
}

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

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

package main

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

func main() {
	var (
		t int
	)

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

	for t > 0 {
		t--

		s, _ := reader.ReadString('\n')
		if s[len(s)-1] == 10 {
			s = s[:len(s)-1]
		}
		if s[len(s)-1] == 13 {
			s = s[:len(s)-1]
		}
		n := len(s)
		k := 0
		for i := 0; i < n-1; i++ {
			done := false
			for j := i+1; j < n; j++ {
				if s[i] == s[j] {
					done = true
					k = i+1
					break
				}
			}
			if done == false {
				break
			}
		}

		fmt.Println(s[k:])
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scanln(&t)
	i:=0
	for i<t{
		var s,sub string

	    fmt.Scanln(&s)
		for j:=0;j<len(s);j++{
			sub=s[j+1:len(s)]

			if strings.Contains(sub,string(s[j]))!=true {
              s=s[j:len(s)]
			  break
			}

		}
	    fmt.Println(s)
		i++
	}

}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scanln(&t)
	i:=0
	for i<t{
		var s,sub,pre string
		var b bool
	    fmt.Scanln(&s)
		for j:=0;j<len(s);j++{
			sub=s[j+1:len(s)+1-1]
			 b=strings.Contains(sub,string(s[j]))
			if b {
			  pre=sub
			}else{
              pre=s[j:len(s)+1-1]
			  break
			}

		}
	    fmt.Println(pre)
		i++
	}

}

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

// 1654B - Prefix Removals

// You are given a string s consisting of lowercase letters of the English alphabet. You must perform the following algorithm on s:
//  • Let x be the length of the longest prefix of s which occurs somewhere else in s as a contiguous substring (the other occurrence may also intersect the prefix). If x=0, break. Otherwise, remove the first x characters of s, and repeat.
// A prefix is a string consisting of several first letters of a given string, without any reorders. An empty prefix is also a valid prefix. For example, the string "abcd" has 5 prefixes: empty string, "a", "ab", "abc" and "abcd".
// For instance, if we perform the algorithm on s= "abcabdc",
//  • Initially, "ab" is the longest prefix that also appears somewhere else as a substring in s, so s= "cabdc" after 1 operation.
//  • Then, "c" is the longest prefix that also appears somewhere else as a substring in s, so s= "abdc" after 2 operations.
//  • Now x=0 (because there are no non-empty prefixes of "abdc" that also appear somewhere else as a substring in s), so the algorithm terminates.
// Find the final state of the string after performing the algorithm.

// Input
// The first line contains a single integer t (1≤t≤10^4) — the number of test cases.
// This is followed by t lines, each containing a description of one test case. Each line contains a string s. The given strings consist only of lowercase letters of the English alphabet and have lengths between 1 and 2⋅10^5 inclusive.
// It is guaranteed that the sum of the lengths of s over all test cases does not exceed 2⋅10^5.

// Output
// For each test case, print a single line containing the string s after executing the algorithm. It can be shown that such string is non-empty.

// Example
// input
// 6
// abcabdc
// a
// bbbbbbbbbb
// codeforces
// cffcfccffccfcffcfccfcffccffcfccf
// zyzyzwxxyyxxyyzzyzzxxwzxwywxwzxxyzzw
// output
// abdc
// a
// b
// deforces
// cf
// xyzzw

// Note

// The first test case is explained in the statement.
// In the second test case, no operations can be performed on s.
// In the third test case,
//  • Initially, s= "bbbbbbbbbb".
//  • After 1 operation, s= "b".
// In the fourth test case,
//  • Initially, s= "codeforces".
//  • After 1 operation, s= "odeforces".
//  • After 2 operations, s= "deforces".

// Hints

// Are there any characters that you can never remove?
// You can't remove the rightmost occurrence of each letter. Can you remove the other characters?
// If you can remove s1,s2,…,si−1 and si is not the rightmost occurrence of a letter, you can also remove si.

// Tutorial

// Let a be the initial string. For a string z, let's define z(l,r)=zlzl+1…zr, i.e., the substring of z from l to r. The final string is a(k,n) for some k.
// In the final string, x=0, so the first character doesn't appear anywhere else in s. This means that ak≠ak+1,ak+2,…,an. In other words, ak is the rightmost occurrence of a letter in s.
// Can you ever remove ai, if ai≠ai+1,ai+2,…,an? Notice that you would need to remove a(l,r) (l≤i≤r): this means that there must exist a(l′,r′)=a(l,r) for some l′>l. So, ai+l′−l=ai, and this is a contradiction.
// Therefore, k is the smallest index such that ak≠ak+1,ak+2,…,an.
// You can find k by iterating over the string from right to left and updating the frequency of each letter. Indeed ai≠ai+1,ai+2,…,an if and only if the frequency of the letter ai is 0 up to now (in the iteration from right to left we are performing). The value of k is the minimum such index i.
// Complexity: O(n)

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c, i int
	var t uint
	var s string
	var frequency map[rune]int
	var x rune

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &s)
			frequency = make(map[rune]int)

			for _, x = range s {
				frequency[x]++
			}

			for i, x = range s {
				frequency[x]--

				if frequency[x] == 0 {
					break
				}
			}

			fmt.Fprintln(writer, s[i:])
		}
	}

	writer.Flush()
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	_, err := fmt.Scanln(&t)
	if err != nil {
		return
	}
	i := 0
	for i < t {
		var s, sub string

		_, err := fmt.Scanln(&s)
		if err != nil {
			return
		}
		for j := 0; j < len(s); j++ {
			sub = s[j+1 : len(s)]

			if strings.Contains(sub, string(s[j])) != true {
				s = s[j:len(s)]
				break
			}

		}
		fmt.Println(s)
		i++
	}

}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(in, &s)
		m := [26]int{}
		cur := [26]int{}
		for j := 0; j < len(s); j++ {
			m[s[j]-'a']++
		}
		j := 0
		for ; j < len(s); j++ {
			cur[s[j]-'a']++
			if cur[s[j]-'a'] == m[s[j]-'a'] {
				break
			}
		}
		fmt.Fprintln(out, s[j:])
	}
}

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 T int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &s)
		pos := [26]int{}
		for i := len(s) - 1; i >= 0; i-- {
			if b := s[i] - 'a'; pos[b] == 0 {
				pos[b] = i + 1
			}
		}
		minP := len(s)
		for _, p := range pos {
			if p > 0 && p < minP {
				minP = p
			}
		}
		Fprintln(out, s[minP-1:])
	}
}

package main

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

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

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

		m := make([]int, 26)
		for i, v := range s {
			m[v-'a'] = i
		}

		var idx int
		for i, v := range s {
			if i == m[v-'a'] {
				idx = i
				break
			}
		}

		fmt.Fprintln(out, s[idx:])
	}
}

package main

import (
	"fmt"
)

func xuli() {
	var (
		n int
		s string
		m = map[byte]bool{}
	)
	fmt.Scan(&s)
	n = len(s)
	vt := n - 1
	for i := n - 1; i >= 0; i-- {
		x := s[i]
		if !m[x] {
			m[x] = true
			vt = i
			//fmt.Println(i)
		}
	}
	fmt.Println(s[vt:])
}

func main() {
	var (
		t int
	)
	for fmt.Scan(&t); t > 0; t-- {
		xuli()
	}
}

package main

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

/*
2
asdfsghf
babssb
---
asdfsghf
abssb
====
3
a
aa
aba
---
a
a
ba
*/

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

	rnToCnt := make(map[rune]int)

	for _, rn := range s {
		rnToCnt[rn]++
	}

	for i, rn := range s {
		if rnToCnt[rn] > 1 {
			rnToCnt[rn]--
		} else {
			fmt.Fprintln(writer, s[i:])
			return
		}
	}
}

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

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

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

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

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

	return nums[minNumIdx]
}

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

	return maxNumIdx
}

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

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

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

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	writter := bufio.NewWriter(os.Stdout)
	defer writter.Flush()

	t := 0
	fmt.Fscan(reader, &t)

	for t > 0 {
		s := ""
		fmt.Fscan(reader, &s)

		// a := make([]int, n)
		// for i := range a {
		// 	fmt.Fscan(reader, &a[i])
		// }

		// result := solve(n, a)

		// for i := range result {
		// 	fmt.Fprintf(writter, "%d ", result[i])
		// }

		fmt.Fprintln(writter, solve(s))

		t--
	}

	// s := "abcabdc"
	// fmt.Println(s)
	// fmt.Println(solve(s))

}

func solve(s string) string {

	pos := [26]int{}
	for i := len(s) - 1; i >= 0; i-- {
		if b := s[i] - 'a'; pos[b] == 0 {
			pos[b] = i + 1
		}
	}

	//fmt.Println(pos)

	minP := len(s)
	for _, p := range pos {
		if p > 0 && p < minP {
			minP = p
		}
	}

	return s[minP-1:]
}

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

// 	var T int
// 	var s string
// 	for Fscan(in, &T); T > 0; T-- {
// 		Fscan(in, &s)
// 		pos := [26]int{}
// 		for i := len(s) - 1; i >= 0; i-- {
// 			if b := s[i] - 'a'; pos[b] == 0 {
// 				pos[b] = i + 1
// 			}
// 		}
// 		minP := len(s)
// 		for _, p := range pos {
// 			if p > 0 && p < minP {
// 				minP = p
// 			}
// 		}
// 		Fprintln(out, s[minP-1:])
// 	}
// }

package main

import (
	"fmt"
	"strings"
)

var x []string

func main() {
	times := 0
	fmt.Scanf("%d\n", &times)
	x = make([]string, times)
	for i := 0; i < times; i++ {
		fmt.Scanf("%v", &x[i])
		fmt.Scanln()
	}
	for i := 0; i < times; i++ {
		fmt.Println(solution(x[i]))
	}
}

func solution(s string) string {
	i := 0
	for strings.Contains(s[i+1:], s[i:i+1]) {
		i++
	}
	return s[i:]
}

package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	writter := bufio.NewWriter(os.Stdout)
	defer writter.Flush()

	t := 0
	fmt.Fscan(reader, &t)

	for t > 0 {
		s := ""
		fmt.Fscan(reader, &s)

		// a := make([]int, n)
		// for i := range a {
		// 	fmt.Fscan(reader, &a[i])
		// }

		// result := solve(n, a)

		// for i := range result {
		// 	fmt.Fprintf(writter, "%d ", result[i])
		// }

		fmt.Fprintln(writter, solve(s))

		t--
	}

	// s := "abcabdc"
	// fmt.Println(s)
	// fmt.Println(solve(s))

}

func solve(s string) string {

	pos := [26]int{}
	for i := len(s) - 1; i >= 0; i-- {
		if b := s[i] - 'a'; pos[b] == 0 {
			pos[b] = i + 1
		}
	}

	fmt.Println(pos)

	minP := len(s)
	for _, p := range pos {
		if p > 0 && p < minP {
			minP = p
		}
	}

	return s[minP-1:]
}

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

// 	var T int
// 	var s string
// 	for Fscan(in, &T); T > 0; T-- {
// 		Fscan(in, &s)
// 		pos := [26]int{}
// 		for i := len(s) - 1; i >= 0; i-- {
// 			if b := s[i] - 'a'; pos[b] == 0 {
// 				pos[b] = i + 1
// 			}
// 		}
// 		minP := len(s)
// 		for _, p := range pos {
// 			if p > 0 && p < minP {
// 				minP = p
// 			}
// 		}
// 		Fprintln(out, s[minP-1:])
// 	}
// }

package main

import (
	"fmt"
	"strings"
)

var x []string

func main() {
	times := 0
	fmt.Scanf("%d\n", &times)
	x = make([]string, times)
	for i := 0; i < times; i++ {
		fmt.Scanf("%v", &x[i])
		fmt.Scanln()
	}
	for i := 0; i < times; i++ {
		fmt.Println(solution(x[i]))
	}
}

func solution(s string) string {
	for n := len(s); n > 2; {
		n = len(s)
		for i := (n - 1) / 2; i >= 0; i-- {
			if i == 0 {
				return s
			}
			if strings.Contains(s[i:], s[0:i]) {
				s = s[i:]
				break
			}
		}
	}
	return s
}

package main

import (
	"fmt"
	"strings"
)

var x []string

func main() {
	times := 0
	fmt.Scanf("%d\n", &times)
	x = make([]string, times)
	for i := 0; i < times; i++ {
		fmt.Scanf("%v", &x[i])
		fmt.Scanln()
	}
	for i := 0; i < times; i++ {
		fmt.Println(solution(x[i]))
	}
}

func solution(s string) string {
	for n := len(s); n > 1; {
		n = len(s)
		for i := (n - 1) / 2; i >= 0; i-- {
			if i == 0 {
				return s
			}
			if strings.Contains(s[i:], s[0:i]) {
				s = s[i:]
				break
			}
		}
	}
	return s
}

package main

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

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

func (in *CF1654B) 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 *CF1654B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1654B
Date: 9/18/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1654/B
Problem: CF1654B
**/
func (in *CF1654B) Run() {
	var ans strings.Builder
	for t := in.NextInt(); t > 0; t-- {
		str := in.NextString()
		for maxp := maxPrefix(str); maxp != -1; {
			str = str[maxp:]
			maxp = maxPrefix(str)

		}
		ans.WriteString(str + "\n")
	}
	fmt.Print(ans.String())
}

func maxPrefix(str string) int {
	pre := false
	prefix := ""
	for i := 1; i < len(str); i++ {
		prefix += string(str[i-1])
		if strings.Contains(str[i:], prefix) {

			pre = true
			continue
		} else {
			if pre {

				return i
			}
		}
	}
	return -1
}

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

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


package main

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

const eps = 1e-8

type vec struct {
	x, y float64
}

func (a vec) add(b vec) vec     { return vec{a.x + b.x, a.y + b.y} }
func (a vec) sub(b vec) vec     { return vec{a.x - b.x, a.y - b.y} }
func (a vec) mul(k float64) vec { return vec{a.x * k, a.y * k} }
func (a vec) len() float64      { return math.Hypot(a.x, a.y) }
func (a vec) dot(b vec) float64 { return a.x*b.x + a.y*b.y }
func (a vec) det(b vec) float64 { return a.x*b.y - a.y*b.x }

type line struct {
	p1, p2 vec
}

func (a vec) disToSeg(l line) (d float64, ok bool) {
	v, v1, v2 := l.p2.sub(l.p1), a.sub(l.p1), a.sub(l.p2)
	if v.dot(v1) < -eps || v.dot(v2) > eps {
		return
	}
	return math.Abs(v.det(v1)) / v.len(), true
}

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

	var n int
	Fscan(in, &n)
	ps := make([]vec, n, n+2)
	for i := range ps {
		Fscan(in, &ps[i].x, &ps[i].y)
	}
	ps = append(ps, ps[0], ps[1])
	ans := math.MaxFloat64
	for i := 1; i <= n; i++ {
		if d, ok := ps[i].disToSeg(line{ps[i-1], ps[i+1]}); ok && d < ans {
			ans = d
		}
	}
	Fprintf(out, "%.10f", ans/2)
}

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

package main

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

const eps = 1e-8

type vec struct {
	x, y float64
}

func (a vec) add(b vec) vec     { return vec{a.x + b.x, a.y + b.y} }
func (a vec) sub(b vec) vec     { return vec{a.x - b.x, a.y - b.y} }
func (a vec) mul(k float64) vec { return vec{a.x * k, a.y * k} }
func (a vec) len() float64      { return math.Hypot(a.x, a.y) }
func (a vec) dot(b vec) float64 { return a.x*b.x + a.y*b.y }
func (a vec) det(b vec) float64 { return a.x*b.y - a.y*b.x }

type line struct {
	p1, p2 vec
}

func (a vec) perpendicular(l line) line {
	return line{a, a.add(vec{l.p1.y - l.p2.y, l.p2.x - l.p1.x})}
}

func (a line) intersection(b line) vec {
	va, vb := a.p2.sub(a.p1), b.p2.sub(b.p1)
	k := vb.det(b.p1.sub(a.p1)) / vb.det(a.p2.sub(a.p1))
	return a.p1.add(va.mul(k))
}

func (a vec) onSeg(l line) bool {
	p1 := l.p1.sub(a)
	p2 := l.p2.sub(a)
	return p1.dot(p2) < eps
}

func (a vec) disToSeg(l line) (d float64, ok bool) {
	p := l.intersection(a.perpendicular(l))
	if !p.onSeg(l) {
		return
	}
	return a.sub(p).len(), true
}

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

	var n int
	Fscan(in, &n)
	ps := make([]vec, n, n+2)
	for i := range ps {
		Fscan(in, &ps[i].x, &ps[i].y)
	}
	ps = append(ps, ps[0], ps[1])
	ans := math.MaxFloat64
	for i := 1; i <= n; i++ {
		if d, ok := ps[i].disToSeg(line{ps[i-1], ps[i+1]}); ok && d < ans {
			ans = d
		}
	}
	Fprintf(out, "%.10f", ans/2)
}

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

package main

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

type vec struct {
	x, y float64
}

func (a vec) sub(b vec) vec     { return vec{a.x - b.x, a.y - b.y} }
func (a vec) len() float64      { return math.Hypot(a.x, a.y) }
func (a vec) det(b vec) float64 { return a.x*b.y - a.y*b.x }

type line struct {
	p1, p2 vec
}

func (a vec) disToLine(l line) float64 {
	v, u := l.p2.sub(l.p1), a.sub(l.p1)
	return math.Abs(v.det(u)) / v.len()
}

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

	var n int
	Fscan(in, &n)
	ps := make([]vec, n, n+2)
	for i := range ps {
		Fscan(in, &ps[i].x, &ps[i].y)
	}
	ps = append(ps, ps[0], ps[1])
	ans := math.MaxFloat64
	for i := 1; i <= n; i++ {
		if d := ps[i].disToLine(line{ps[i-1], ps[i+1]}); d < ans {
			ans = d
		}
	}
	Fprintf(out, "%.10f", ans/2)
}

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

package main

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

const eps = 1e-8

type vec struct {
	x, y float64
}

func (a vec) add(b vec) vec     { return vec{a.x + b.x, a.y + b.y} }
func (a vec) sub(b vec) vec     { return vec{a.x - b.x, a.y - b.y} }
func (a vec) mul(k float64) vec { return vec{a.x * k, a.y * k} }
func (a vec) len() float64      { return math.Hypot(a.x, a.y) }
func (a vec) dot(b vec) float64 { return a.x*b.x + a.y*b.y }
func (a vec) det(b vec) float64 { return a.x*b.y - a.y*b.x }

type line struct {
	p1, p2 vec
}

func (a vec) perpendicular(l line) line {
	return line{a, a.add(vec{l.p1.y - l.p2.y, l.p2.x - l.p1.x})}
}

func (a line) intersection(b line) vec {
	va, vb := a.p2.sub(a.p1), b.p2.sub(b.p1)
	k := vb.det(b.p1.sub(a.p1)) / vb.det(a.p2.sub(a.p1))
	return a.p1.add(va.mul(k))
}

func (a vec) onSeg(l line) bool {
	p1 := l.p1.sub(a)
	p2 := l.p2.sub(a)
	return math.Abs(p1.det(p2)) < eps && p1.dot(p2) < eps
}

func (a vec) disToSeg(l line) (d float64, ok bool) {
	p := l.intersection(a.perpendicular(l))
	if !p.onSeg(l) {
		return
	}
	return a.sub(p).len(), true
}

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

	var n int
	Fscan(in, &n)
	ps := make([]vec, n, n+2)
	for i := range ps {
		Fscan(in, &ps[i].x, &ps[i].y)
	}
	ps = append(ps, ps[0], ps[1])
	ans := math.MaxFloat64
	for i := 1; i <= n; i++ {
		if d, ok := ps[i].disToSeg(line{ps[i-1], ps[i+1]}); ok && d < ans {
			ans = d
		}
	}
	Fprintf(out, "%.10f", ans/2)
}

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