package main

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

func Init() {
}

func Solve(io *FastIO) {
	S := io.NextLine()

	A := 0
	B := 0
	C := 0
	for _, c := range S {
	  if c == 'a' {
	    if B > 0 || C > 0 {
	      io.Println("NO")
	      return
	    }
      A++
	  } else if c == 'b' {
	    if A == 0 || C > 0 {
	      io.Println("NO")
	      return
	    }
	    B++
	  } else if c == 'c' {
	    if A == 0 || B == 0 {
	      io.Println("NO")
	      return
	    }
	    C++
	  }
	}
	if A > 0 && B > 0 && (C == A || C == B) {
	  io.Println("YES")
	} else {
	  io.Println("NO")
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

import (
	"fmt"
	"regexp"
)

var pattern = regexp.MustCompile("^(a+)(b+)(c+)$")

func main() {
	var s []byte
	fmt.Scan(&s)
	r := pattern.FindSubmatch(s)
	if r != nil && (len(r[1]) == len(r[3]) || len(r[2]) == len(r[3])) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

func Resolve(input string) string {
	var a, b, c int

	for _, char := range input {
		switch char {
		case 'a':
			if (b != 0) || (c != 0) {
				return "NO"
			}
			a += 1
		case 'b':
			if (a == 0) || (c != 0) {
				return "NO"
			}
			b += 1
		case 'c':
			if (a == 0) || (b == 0) {
				return "NO"
			}
			c += 1
		default:
			panic("got invalid character")
		}
	}

	if (b == 0) || (a == 0) {
		return "NO"
	}

	if (c == a) || (c == b) {
		return "YES"
	}

	return "NO"
}

func main() {
	var input string
	fmt.Scanln(&input)

	fmt.Println(Resolve(input))
}

package main

import (
    "fmt"
)

func main() {
    var s string
    fmt.Scanf("%s", &s)
    length := len(s)
    na := 0
    nb := 0
    nc := 0
    flag := true
    for i := 0; i < length; i++ {
        if s[i] == 'a' && nb == 0 && nc == 0{
            na++
        }else if s[i] == 'b' && na != 0 && nc == 0{
            nb++
        }else if s[i] == 'c' && na != 0 && nb !=0{
            nc++
        }else{
            flag = false
        }
    }
    if flag && nc != 0 && (nc == na || nc == nb){
        fmt.Println("YES")
    }else{
        fmt.Println("NO")
    }
}

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"os"
)

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s)-1; i++ {
		if s[i] > s[i+1] {
			fmt.Print("NO\n")
			os.Exit(0)
		}
	}
	var cnt [26]int
	for i := 0; i < len(s); i++ {
		cnt[s[i]-'a']++
	}
	if cnt[0] > 0 && cnt[1] > 0 && (cnt[2] == cnt[0] || cnt[2] == cnt[1]) {
		fmt.Print("YES\n")
	} else {
		fmt.Print("NO\n")
	}
}

package main

import "fmt"

func solve()  {
	var s string
	fmt.Scan(&s)
	var a, b, c = 0, 0, 0
	i, l := 0, len(s)
	for i < l && s[i] == 'a'{
		i++
		a++
	}
	for i < l && s[i] == 'b' {
		i++
		b++
	}
	for i < l && s[i] == 'c' {
		i++
		c++
	}
	if i != l || a == 0 || b == 0 || c == 0 || (a != c && b != c) {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

func main() {
	solve()
}

package main

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

func solve() {
	s := readString()
	cnt := make([]int, 26)
	for i := 0; i < len(s); i++ {
		cnt[s[i]-'a']++
	}
	s = regexp.MustCompile("a+").ReplaceAllString(s, "a")
	s = regexp.MustCompile("b+").ReplaceAllString(s, "b")
	s = regexp.MustCompile("c+").ReplaceAllString(s, "c")
	if len(s) == 3 && s[0] == 'a' && s[1] == 'b' && s[2] == 'c' && (cnt[0] == cnt[2] || cnt[1] == cnt[2]) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

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

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

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

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

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	input = strings.Trim(input, "\n\r")

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	t := map[int32]int{}

	n := 'a'
	b := true
	for k,v := range s{
		AGAIN:
			if v == n {
				t[v]++
			}else if k != 0 && v > n {
				n++
				goto AGAIN
			}else{
				fmt.Print("NO")
				b = false
				break
			}
	}
	if b {
		if (t['c'] == t['a'] || t['c'] == t['b']) && len(s) > 0 && t['c'] != 0 && t['b'] != 0 && t['c'] != 0{
			fmt.Print("YES")
		}else {
			fmt.Print("NO")
		}
	}
}

package main

import (
    "fmt"
)

func main() {
    var s string
    fmt.Scanf("%s", &s)
    length := len(s)
    na := 0
    nb := 0
    nc := 0
    flag := true
    for i := 0; i < length; i++ {
        if s[i] == 'a' && nb == 0 && nc == 0{
            na++
        }else if s[i] == 'b' && nc == 0{
            nb++
        }else if s[i] == 'c'{
            nc++
        }else{
            flag = false
        }
    }
    if flag {
        fmt.Println("YES")
    }else{
        fmt.Println("NO")
    }
}

package main

import (
    "fmt"
)

func main() {
    var s string
    fmt.Scanf("%s", &s)
    length := len(s)
    na := 0
    nb := 0
    nc := 0
    flag := true
    for i := 0; i < length; i++ {
        if s[i] == 'a' && nb == 0 && nc == 0{
            na++
        }else if s[i] == 'b' && na != 0 && nc == 0{
            nb++
        }else if s[i] == 'c' && na != 0 && nc ==0{
            nc++
        }else{
            flag = false
        }
    }
    if flag && (nc == na || nc == nb){
        fmt.Println("YES")
    }else{
        fmt.Println("NO")
    }
}

package main

import "fmt"

func main() {
	var s []byte
	fmt.Scan(&s)
	var a, b, c int
	for _, s := range s {
		switch s {
		case 'a':
			if b != 0 || c != 0 {
				fmt.Println("NO")
				return
			}
			a++
		case 'b':
			if a == 0 || c != 0 {
				fmt.Println("NO")
				return
			}
			b++
		case 'c':
			if a == 0 || b == 0 {
				fmt.Println("NO")
				return
			}
			c++
		}
	}
	if a == c || b == c {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"regexp"
)

var pattern = regexp.MustCompile("^(a+)(b+)(c+)$")

func main() {
	var s []byte
	fmt.Scan(&s)
	r := pattern.FindSubmatch(s)
	if r != nil && (len(r[1]) == len(r[2]) || len(r[1]) == len(r[3])) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

var (
	a int
	b int
	c int
)

func Resolve(input string) string {
	for _, char := range input {
		switch char {
		case 'a':
			a += 1
		case 'b':
			b += 1
		case 'c':
			c += 1
		default:
			panic("got invalid character")
		}
	}

	if (c == a) || (c == b) {
		return "YES"
	}

	return "NO"

	return "YES"
}

func main() {
	var input string
	fmt.Scanln(&input)

	fmt.Println(Resolve(input))
}

package main

import "fmt"

func Resolve(input string) string {
	var a, b, c int

	for _, char := range input {
		switch char {
		case 'a':
			if (b != 0) || (c != 0) {
				return "NO"
			}
			a += 1
		case 'b':
			if (a == 0) || (c != 0) {
				return "NO"
			}
			b += 1
		case 'c':
			if (a == 0) || (b == 0) {
				return "NO"
			}
			c += 1
		default:
			panic("got invalid character")
		}
	}

	if (c == a) || (c == b) {
		return "YES"
	}

	return "NO"

	return "YES"
}

func main() {
	var input string
	fmt.Scanln(&input)

	fmt.Println(Resolve(input))
}

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"os"
)

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s)-1; i++ {
		if s[i] > s[i+1] {
			fmt.Print("NO\n")
			os.Exit(0)
		}
	}
	var cnt [26]int
	for i := 0; i < len(s); i++ {
		cnt[s[i]-'a']++
	}
	if cnt[2] == cnt[0] || cnt[2] == cnt[1] {
		fmt.Print("YES\n")
	} else {
		fmt.Print("NO\n")
	}
}

// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"os"
)

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s)-1; i++ {
		if s[i] > s[i+1] {
			fmt.Print("NO\n")
			os.Exit(0)
		}
	}
	var cnt [26]int
	for i := 0; i < len(s); i++ {
		cnt[s[i]-'a']++
	}
	if cnt[2] == cnt[0] || cnt[2] == cnt[1] || cnt[2] == cnt[0]+cnt[1] {
		fmt.Print("YES\n")
	} else {
		fmt.Print("NO\n")
	}
}

package main

import (
	"fmt"
	"regexp"
)

func main() {
	var s string
	fmt.Scan(&s)
	part, _ := regexp.Compile("ab+c")
	ret := part.FindString(s)
	if ret != "" {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	if strings.Contains(s, "abc") {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

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

func solve() {
	s := readString()
	s = regexp.MustCompile("a+").ReplaceAllString(s, "a")
	s = regexp.MustCompile("b+").ReplaceAllString(s, "b")
	s = regexp.MustCompile("c+").ReplaceAllString(s, "c")
	if len(s) == 3 && s[0] == 'a' && s[1] == 'b' && s[2] == 'c' {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

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

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

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

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

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	fmt.Println([]byte(input))

	input = strings.Trim(input, "\n ")

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	input = strings.Trim(input, "\n")

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	input = strings.Trim(input, "\n")

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

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

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

	input, err := inputReader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	input = strings.Trim(input, "\n ")

	fmt.Print(Solve(input))
}

func Solve(input string) string {
	inputLen := len(input)
	currentIndex := 0
	countA := 0
	countB := 0
	countC := 0

	for currentIndex < inputLen && input[currentIndex] == 'a' {
		countA++
		currentIndex++
	}

	if countA == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'b' {
		countB++
		currentIndex++
	}

	if countB == 0 {
		return "NO"
	}

	for currentIndex < inputLen && input[currentIndex] == 'c' {
		countC++
		currentIndex++
	}

	if countC == 0 {
		return "NO"
	}

	if currentIndex != inputLen {
		return "NO"
	}

	if countA == countC || countB == countC {
		return "YES"
	}

	return "NO"
}

package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	t := map[int32]int{}

	n := 'a'
	b := true
	for k,v := range s{
		AGAIN:
			if v == n {
				t[v]++
			}else if k != 0 && v > n {
				n++
				goto AGAIN
			}else{
				fmt.Print("NO")
				b = false
				break
			}
	}
	if b {
		if (t['c'] == t['a'] || t['c'] == t['b']) && len(t) > 0 {
			fmt.Print("YES")
		}else {
			fmt.Print("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	t := map[int32]int{}

	n := 'a'
	b := true
	for k,v := range s{
		AGAIN:
			if v == n {
				t[v]++
			}else if k != 0 && v > n {
				n++
				goto AGAIN
			}else{
				fmt.Print("NO")
				b = false
				break
			}
	}
	if b {
		if t['c'] == t['a'] || t['c'] == t['b'] {
			fmt.Print("YES")
		}else {
			fmt.Print("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	t := map[int32]int{}

	n := 'a'
	b := true
	for k,v := range s{
		AGAIN:
			if v == n {
				t[v]++
			}else if k != 0 && v > n {
				n++
				goto AGAIN
			}else{
				fmt.Print("NO")
				b = false
				break
			}
	}
	if b {
		if (t['c'] == t['a'] || t['c'] == t['b']) && len(s) > 0 && t['c'] != 0{
			fmt.Print("YES")
		}else {
			fmt.Print("NO")
		}
	}
}

package main

import (
    "fmt"
)

func main() {
    var s string
    fmt.Scanf("%s", &s)
    length := len(s)
    na := 0
    nb := 0
    nc := 0
    flag := true
    for i := 0; i < length; i++ {
        if s[i] == 'a' && nb == 0 && nc == 0{
            na++
        }else if s[i] == 'b' && na != 0 && nc == 0{
            nb++
        }else if s[i] == 'c' && na != 0 && nb !=0{
            nc++
        }else{
            flag = false
        }
    }
    if flag && (nc == na || nc == nb){
        fmt.Println("YES")
    }else{
        fmt.Println("NO")
    }
}


// https://codeforces.com/contest/1345/problem/C
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)
	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func solver() string {
	var n int
	fmt.Fscan(input, &n)
	a := make([]int, n)
	busy := make([]bool, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &a[i])
	}

	for i := 0; i < n; i++ {
		pos := mod(i + a[i], n)
		if busy[pos] {
			return "NO"
		}
		busy[pos] = true
	}

	return "YES"
}

func mod(a, n int) int {
	m := a % n
	if m >= 0 {
		return m
	}

	return n + m
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}
func NextInt64() int64 {
	bytes := NextBytes()
	i, err := Atoi64(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func Atoi64(b []byte) (int64, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	var n int64
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int64(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func reverseInts(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

func unique(a []int) int {
	newLen := 0
	n := len(a)
	for i := 0; i < n; i++ {
		if newLen == 0 || a[i] != a[newLen-1] {
			a[newLen] = a[i]
			newLen++
		}
	}
	return newLen
}

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

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

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	T := NextInt()

	was := make([]bool, 200000)

	for t := 0; t < T; t++ {
		n := NextInt()
		for i := 0; i < n; i++ {
			was[i] = false
		}

		ok := true
		for i := 0; i < n; i++ {
			ai := NextInt()
			r := (i + ai) % n
			if r < 0 {
				r += n
			}
			if was[r] {
				ok = false
			}
			was[r] = true
		}
		if ok {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}

	}
}

/*
URL:
https://codeforces.com/contest/1345/problem/C
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	t int
)

func main() {
	// PrintfDebug("%v\n", NegativeMod(-1337, 3))
	// PrintfDebug("%v\n", NegativeMod(-1, 3))
	// for i := -3; i < 10; i++ {
	// 	PrintfDebug("%d -> %d\n", i, NegativeMod(i, 3))
	// }

	t = ReadInt()
	for i := 0; i < t; i++ {
		n := ReadInt()
		A := ReadIntSlice(n)
		solve(n, A)
	}
}

func solve(n int, A []int) {
	memo := make(map[int]int)
	for i := 0; i < n; i++ {
		tmp := NegativeMod(A[i]+i, n)
		memo[tmp] = 1
	}

	if len(memo) < n {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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

package main

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

func solve() {
	n := readInt()

	arr := make([]bool, n)
	for i := range arr {
		a := readInt()
		to := (i + (a%n+n)%n) % n
		arr[to] = true
	}

	for i := range arr {
		if !arr[i] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

func main() {
	k := readInt()
	for i := 0; i < k; i++ {
		solve()
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

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

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

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

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

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

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

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

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

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

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		writer.Printf("%s\n", sol(aa))
	}
}

func sol(aa []int64) string {
	for i := range aa {
		aa[i] = ((aa[i] + int64(i)) % int64(len(aa)) + int64(len(aa))) % int64(len(aa))
	}
	sort.Slice(aa, func(a, b int) bool {
		return aa[a] < aa[b]
	})
	//writer.Printf("%v\n", aa)
	for i := 1; i < len(aa); i++ {
		if aa[i] != aa[i-1]+1 {
			return "NO"
		}
	}
	return "YES"
}

package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

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

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n := readNum(reader)

		A := readNNums(reader, n)

		if solve(n, A) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func solve(n int, A []int) bool {
	vis := make([]bool, n)

	for i := 0; i < n; i++ {
		x := A[i] % n
		x += i
		x %= n
		if x < 0 {
			x += n
		}
		if vis[x] {
			return false
		}
		vis[x] = true
	}

	return true
}

package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	buf := make([]byte, 15 * 1024 * 1024)

	scanner.Buffer(buf, 13 * 1024 * 1024)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {

		scanner.Scan()

		a := scanner.Text()

		arrLen , err := strconv.Atoi(a)

		if err != nil {
			panic(err)
		}

		scanner.Scan()

		line := scanner.Text()

		parts := strings.Fields(line)

		var arr []int

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

			p , err := strconv.Atoi(parts[i])

			if err != nil {
				panic(err)
			}

			arr = append(arr, p)
		}

		res := gilbert(arr)

		fmt.Println(res)
	}
}

func gilbert(arr []int) string {

	n := len(arr)

	m := make([]int, n)

	for i := 0 ; i < n; i ++ {
		res := i + arr[i]

		if res >= 0 {
			m[res % n] ++

		} else {
			rem := (-res) % n

			if rem == 0 {
				m[0]++
			} else {
				m[n - rem]++
			}
		}
	}

	for i := range m {
		if m[i] > 1 {
			return "NO"
		}
	}
	return "YES"
}

// https://codeforces.com/contest/1345/problem/C
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)
	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n int
	fmt.Fscan(input, &n)
	a := make([]int, n)
	busy := make(map[int]bool)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &a[i])
	}

	for i := 0; i < n; i++ {
		pos := mod((i + a[mod(i, n)]), n)
		if busy[pos] {
			fmt.Println("NO")
			return
		}
		busy[pos] = true
	}

	fmt.Println("YES")
}

func mod(a, n int) int {
	if a >= 0 {
		return a % n
	}

	return n + (a % n)
}

// https://codeforces.com/contest/1345/problem/C
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)
	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n int
	fmt.Fscan(input, &n)
	a := make([]int, n)
	busy := make(map[int]bool)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &a[i])
	}

	for i := 0; i < n; i++ {
		pos := mod(i + a[i], n)
		if busy[pos] {
			fmt.Println("NO")
			return
		}
		busy[pos] = true
	}

	fmt.Println("YES")
}

func mod(a, n int) int {
	if a >= 0 {
		return a % n
	}

	return n + (a % n)
}

// https://codeforces.com/contest/1345/problem/C
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)
	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		solver()
	}
}

func solver() {
	var n int64
	fmt.Fscan(input, &n)
	a := make([]int64, n)
	busy := make(map[int64]bool)
	for i := 0; i < int(n); i++ {
		fmt.Fscan(input, &a[i])
	}

	for i := int64(0); i < n; i++ {
		pos := mod(i + a[i], n)
		if busy[pos] {
			fmt.Println("NO")
			return
		}
		busy[pos] = true
	}

	fmt.Println("YES")
}

func mod(a, n int64) int64 {
	if a >= 0 {
		return a % n
	}

	return n + (a % n)
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

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

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

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		writer.Printf("%s\n", sol(aa))
	}
}

func sol(aa []int64) string {
	for i := range aa {
		aa[i] = (aa[i] + int64(i)) % int64(len(aa))
	}
	sort.Slice(aa, func(a, b int) bool {
		return aa[a] < aa[b]
	})
	if len(aa) == 1 {
		return "YES"
	}
	diff := aa[1] - aa[0]
	if diff == 0 {
		return "NO"
	}
	for i := 1; i < len(aa); i++ {
		if aa[i] != aa[i-1]+diff {
			return "NO"
		}
	}
	return "YES"
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

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

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

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		writer.Printf("%s\n", sol(aa))
	}
}

func sol(aa []int64) string {
	for i := range aa {
		aa[i] = ((aa[i] + int64(i)) % int64(len(aa)) + int64(len(aa))) % int64(len(aa))
	}
	sort.Slice(aa, func(a, b int) bool {
		return aa[a] < aa[b]
	})
	writer.Printf("%v\n", aa)
	for i := 1; i < len(aa); i++ {
		if aa[i] != aa[i-1]+1 {
			return "NO"
		}
	}
	return "YES"
}

package main

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

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

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

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

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

type WordScanner interface {
	NextInt64() int64
	NextUInt64() uint64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n := reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		writer.Printf("%s\n", sol(aa))
	}
}

func sol(aa []int64) string {
	for i := range aa {
		aa[i] = (aa[i] + int64(i)) % int64(len(aa))
	}
	sort.Slice(aa, func(a, b int) bool {
		return aa[a] < aa[b]
	})
	for i := 1; i < len(aa); i++ {
		if aa[i] != aa[i-1]+1 {
			return "NO"
		}
	}
	return "YES"
}

package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {

		scanner.Scan()

		a := scanner.Text()

		arrLen , _ := strconv.Atoi(a)

		scanner.Scan()

		line := scanner.Text()

		parts := strings.Fields(line)

		var arr []int

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

			p , _ := strconv.Atoi(parts[i])

			arr = append(arr, p)
		}

		res := gilbert(arr)

		fmt.Println(res)
	}

}

func gilbert(arr []int) string {

	m := make(map[int]int)

	n := len(arr)

	for i := 0 ; i < n; i ++ {
		res := i + arr[i]

		if res >= 0 {
			m[res % n] ++

		} else {
			m[n - (res % n)]++
		}

	}

	for i := range m {
		if m[i] > 1 {
			return "NO"
		}
	}
	return "YES"
}


package main

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

func main() {
	io := newIO()
	defer io.out.Flush()

	n := io.nextInt()
	a := io.nextArr(n)
	var s stack
	mx := 0
	for i := 0; i < n; i++ {
		mx = max(mx, a[i])
		s = s.clr()
		s = s.Push(a[i])
		if s.bad() {
			fmt.Println("NO")
			return
		}
	}
	s = s.clr()
	if len(s) == 0 || len(s) == 1 && s[0] == mx {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func (s stack) bad() bool {
	if len(s) >= 2 {
		s, first := s.Pop()
		_, second := s.Pop()
		if first > second {return true}
	}
	return false
}
func (s stack) clr() stack {
	var first, second int
	for len(s) >= 2 {
		s, first = s.Pop()
		s, second = s.Pop()
		s = s.Push(second)
		s = s.Push(first)
		if first != second {
			return s
		} else {
			if len(s) == 2 {
				s = s[0:0]
			} else if len(s) == 3 {
				s = s[0:1]
			} else {
				s = s[0:len(s) - 2]
			}
		}
	}
	return s
}

type stack []int

func (s stack) Push(v int) stack {
	return append(s, v)
}

func (s stack) Pop() (stack, int) {
	l := len(s)
	return s[:l-1], s[l-1]
}

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

type io struct {
	inp *bufio.Scanner
	out *bufio.Writer
}

func newIO() io {
	sc := io{
		inp: bufio.NewScanner(os.Stdin),
		out: bufio.NewWriter(os.Stdout),
	}
	sc.inp.Split(bufio.ScanWords)
	return sc
}
func (sc io) nextArr(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = sc.nextInt()
	}
	return a
}
func (sc io) nextString() string {
	sc.inp.Scan()
	return sc.inp.Text();
}

func (sc io) nextInt64() int64 {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int64(v)
}
func (sc io) nextInt() int {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int(v)
}

package main

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

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

	var front int = 0

	var max int = 0
	mat := make([]int, n+2)
	var ans bool = true
	for i := 1; i <= n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
		if mat[i] > max {
			max = mat[i]
		}
	}
	mat[0] = max + 1
	mat[n+1] = max + 1
	stack := make([]int, n+5)
	stack[front] = 0
	front++
	for i := 1; ans&&i <= n+1; i++ {
	//	fmt.Println(stack[:front])
		for mat[stack[front-1]] < mat[i] {
			if i ==n+1&&front-1 <= 1{
				break
			}
			if front-2 >=0 {
		//		fmt.Printf("[%d,%d]\n",  stack[front-2],i)
				if 0 == ((i - stack[front-2]) & 1) {
					ans = false
					break
				}
			}
			front--
		}
		if mat[stack[front-1]] == mat[i] {
			stack[front-1] = i
		}else {
			stack[front] = i
			front++
		}
	}

	if ans {
		fmt.Printf("YES\n")
	} else {
		fmt.Printf("NO\n")
	}

}

/*
9
10 1 1 10 1 1 10 1 1

11
10 1 1 10 1 1 10 1 1 10 11

5 4
1 2
3 4
4 5
5 3
5 1
1 2
*/

package main

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

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

    stdin := bufio.NewReader(os.Stdin)

    var n, x int
    var stack []int

    fmt.Fscan(stdin, &n)
    stack = []int { 0 }
    fmt.Fscan(stdin, &stack[0])

    Max := func (i, j int) int {
        if i > j {
            return i
        }
        return j
    }

    var m = stack[0]
    for i := 1; i < n; i++ {
        fmt.Fscan(stdin, &x)
        stack = append(stack, x)
        m = Max(m, x)
        var l = len(stack)
        if l > 1 && stack[l-1] == stack[l-2] {
            if l == 2 || stack[l-3] >= stack[l-1] {
                stack = stack[:l-2]
            }
        }
    }

    if len(stack) == 0 || (len(stack) == 1 && stack[0] == m) {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
    // fmt.Println(stack)
}

package main

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

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

    stdin := bufio.NewReader(os.Stdin)

    var n, x int
    var stack []int

    fmt.Fscan(stdin, &n)
    stack = []int { 0 }
    fmt.Fscan(stdin, &stack[0])

    Max := func (i, j int) int {
        if i > j {
            return i
        }
        return j
    }

    var m = stack[0]
    for i := 1; i < n; i++ {
        fmt.Fscan(stdin, &x)
        stack = append(stack, x)
        m = Max(m, x)
        var l = len(stack)
        if l > 1 && stack[0] >= stack[l-1] && stack[l-1] == stack[l-2] {
            stack = stack[:l - 2]
        }
    }

    if len(stack) == 0 || (len(stack) == 1 && stack[0] == m) {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
    // fmt.Println(stack)
}

package main

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

func main() {
	io := newIO()
	defer io.out.Flush()

	n := io.nextInt()
	a := io.nextArr(n)
	var s stack
	for i := 0; i < n; i++ {
		s = s.clr()
		s = s.Push(a[i])
	}
	s = s.clr()
	if len(s) <= 1 {
		fmt.Println("YES")

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

func (s stack) clr() stack {
	var first, second int
	for len(s) >= 2 {
		s, first = s.Pop()
		s, second = s.Pop()
		s = s.Push(second)
		s = s.Push(first)
		if first != second {
			return s
		} else {
			if len(s) == 2 {
				s = s[0:0]
			} else if len(s) == 3 {
				s = s[0:1]
			} else {
				s = s[0:len(s) - 2]
			}
		}
	}
	return s
}

type stack []int

func (s stack) Push(v int) stack {
	return append(s, v)
}

func (s stack) Pop() (stack, int) {
	l := len(s)
	return s[:l-1], s[l-1]
}

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

type io struct {
	inp *bufio.Scanner
	out *bufio.Writer
}

func newIO() io {
	sc := io{
		inp: bufio.NewScanner(os.Stdin),
		out: bufio.NewWriter(os.Stdout),
	}
	sc.inp.Split(bufio.ScanWords)
	return sc
}
func (sc io) nextArr(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = sc.nextInt()
	}
	return a
}
func (sc io) nextString() string {
	sc.inp.Scan()
	return sc.inp.Text();
}

func (sc io) nextInt64() int64 {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int64(v)
}
func (sc io) nextInt() int {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int(v)
}

package main

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

func main() {
	io := newIO()
	defer io.out.Flush()

	n := io.nextInt()
	a := io.nextArr(n)
	var s stack
	for i := 0; i < n; i++ {
		s = s.clr()
		s = s.Push(a[i])
		if s.bad() {
			fmt.Println("NO")
			return
		}
	}
	s = s.clr()
	if len(s) <= 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func (s stack) bad() bool {
	if len(s) >= 2 {
		s, first := s.Pop()
		_, second := s.Pop()
		if first > second {return true}
	}
	return false
}
func (s stack) clr() stack {
	var first, second int
	for len(s) >= 2 {
		s, first = s.Pop()
		s, second = s.Pop()
		s = s.Push(second)
		s = s.Push(first)
		if first != second {
			return s
		} else {
			if len(s) == 2 {
				s = s[0:0]
			} else if len(s) == 3 {
				s = s[0:1]
			} else {
				s = s[0:len(s) - 2]
			}
		}
	}
	return s
}

type stack []int

func (s stack) Push(v int) stack {
	return append(s, v)
}

func (s stack) Pop() (stack, int) {
	l := len(s)
	return s[:l-1], s[l-1]
}

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

type io struct {
	inp *bufio.Scanner
	out *bufio.Writer
}

func newIO() io {
	sc := io{
		inp: bufio.NewScanner(os.Stdin),
		out: bufio.NewWriter(os.Stdout),
	}
	sc.inp.Split(bufio.ScanWords)
	return sc
}
func (sc io) nextArr(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = sc.nextInt()
	}
	return a
}
func (sc io) nextString() string {
	sc.inp.Scan()
	return sc.inp.Text();
}

func (sc io) nextInt64() int64 {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int64(v)
}
func (sc io) nextInt() int {
	v, _ := strconv.ParseInt(sc.nextString(), 10, 64)
	return int(v)
}


package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

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

	n := readNum(reader)

	ask := func(i, j int) int {
		fmt.Printf("? %d %d\n", i, j)
		return readNum(reader)
	}

	res := solve(n, ask)

	var buf bytes.Buffer
	buf.WriteByte('!')
	for i := 0; i < n; i++ {
		buf.WriteString(fmt.Sprintf(" %d", res[i]))
	}
	fmt.Println(buf.String())
}

func solve(n int, ask func(int, int) int) []int {
	r := rand.Perm(n)
	p := make([]int, n)

	for i, j := range r {
		p[j] = i + 1
	}

	a, b := p[0], p[1]
	val := ask(a, b)

	for i := 2; i < n; i++ {
		c := p[i]
		tmp := ask(b, c)
		if tmp < val {
			a = c
			val = tmp
		} else if tmp == val {
			b = c
			val = ask(a, b)
		}
	}
	idx := -1
	//a, b are candidates for 0
	for idx < 0 {
		i := rand.Intn(n) + 1
		if i == a || i == b {
			continue
		}
		x := ask(i, a)
		y := ask(i, b)
		if x == y {
			continue
		}
		if x < y {
			idx = a
		} else {
			idx = b
		}
	}

	p[idx-1] = 0

	for i := 1; i <= n; i++ {
		if i == idx {
			continue
		}
		p[i-1] = ask(i, idx)
	}

	return p
}

package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

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

	n := readNum(reader)

	ask := func(i, j int) int {
		fmt.Printf("? %d %d\n", i, j)
		return readNum(reader)
	}

	res := solve(n, ask)

	var buf bytes.Buffer
	buf.WriteByte('!')
	for i := 0; i < n; i++ {
		buf.WriteString(fmt.Sprintf(" %d", res[i]))
	}
	fmt.Println(buf.String())
}

func solve(n int, ask func(int, int) int) []int {
	r := rand.Perm(n)
	p := make([]int, n)

	for i, j := range r {
		p[j] = i + 1
	}

	z := make([]int, 11)

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

	for !allSet(z) {
		i := rand.Intn(n) + 1
		j := rand.Intn(n) + 1
		if i == j {
			continue
		}
		tmp := ask(i, j)
		for b := 0; b < 11; b++ {
			if tmp&(1<<b) == 0 {
				z[b] = i
			}
		}
	}

	get := func(i int, sup int) int {
		ans := sup

		for b := 0; b < 11; b++ {
			if ans&(1<<b) > 0 {
				if z[b] != i {
					ans &= ask(i, z[b])
				} else {
					ans ^= 1 << b
				}
			}
		}
		return ans
	}

	idx := -1
	val := 1<<11 - 1

	for _, i := range p {
		if idx < 0 || ask(i, idx) == val {
			idx = i
			val = get(i, val)
		}
	}
	// val == 0
	for i := 1; i <= n; i++ {
		if i == idx {
			p[i-1] = 0
		} else {
			p[i-1] = ask(i, idx)
		}
	}

	return p
}

func allSet(arr []int) bool {
	var res int
	for i := 0; i < len(arr); i++ {
		if arr[i] > 0 {
			res++
		}
	}
	return res == len(arr)
}

func solve1(n int, ask func(int, int) int) []int {
	r := rand.Perm(n)
	p := make([]int, n)

	for i, j := range r {
		p[j] = i + 1
	}

	a, b := p[0], p[1]
	val := ask(a, b)

	for i := 2; i < n; i++ {
		c := p[i]
		tmp := ask(b, c)
		if tmp < val {
			a = c
			val = tmp
		} else if tmp == val {
			b = c
			val = ask(a, b)
		}
	}
	idx := -1
	//a, b are candidates for 0
	for idx < 0 {
		i := rand.Intn(n) + 1
		if i == a || i == b {
			continue
		}
		x := ask(i, a)
		y := ask(i, b)
		if x == y {
			continue
		}
		if x < y {
			idx = a
		} else {
			idx = b
		}
	}

	p[idx-1] = 0

	for i := 1; i <= n; i++ {
		if i == idx {
			continue
		}
		p[i-1] = ask(i, idx)
	}

	return p
}

package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

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

	n := readNum(reader)

	ask := func(i, j int) int {
		fmt.Printf("? %d %d\n", i, j)
		return readNum(reader)
	}

	res := solve(n, ask)

	var buf bytes.Buffer
	buf.WriteByte('!')
	for i := 0; i < n; i++ {
		buf.WriteString(fmt.Sprintf(" %d", res[i]))
	}
	fmt.Println(buf.String())
}

func solve(n int, ask func(int, int) int) []int {
	r := rand.Perm(n)
	p := make([]int, n)

	for i, j := range r {
		p[j] = i + 1
	}

	a, b := p[0], p[1]
	val := ask(a, b)

	for i := 2; i < n; i++ {
		c := p[i]
		tmp := ask(b, c)
		if tmp < val {
			a = c
		} else if tmp == val {
			b = c
			val = ask(a, b)
		}
	}
	idx := -1
	//a, b are candidates for 0
	for idx < 0 {
		i := rand.Intn(n) + 1
		if i == a || i == b {
			continue
		}
		x := ask(i, a)
		y := ask(i, b)
		if x < y {
			idx = a
		} else if x > y {
			idx = b
		}
	}

	p[idx-1] = 0

	for i := 1; i <= n; i++ {
		if i == idx {
			continue
		}
		p[i-1] = ask(i, idx)
	}

	return p
}

package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

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

	n := readNum(reader)

	ask := func(i, j int) int {
		fmt.Printf("? %d %d\n", i, j)
		return readNum(reader)
	}

	res := solve(n, ask)

	var buf bytes.Buffer
	buf.WriteByte('!')
	for i := 0; i < n; i++ {
		buf.WriteString(fmt.Sprintf(" %d", res[i]))
	}
	fmt.Println(buf.String())
}

func solve(n int, ask func(int, int) int) []int {
	r := rand.Perm(n)
	p := make([]int, n)

	for i, j := range r {
		p[j] = i + 1
	}

	a, b := p[0], p[1]
	val := ask(a, b)

	for i := 2; i < n; i++ {
		c := p[i]
		tmp := ask(b, c)
		if tmp < val {
			a = c
		} else if tmp == val {
			b = c
			val = ask(a, b)
		}
	}
	idx := -1
	//a, b are candidates for 0
	for idx < 0 {
		i := rand.Intn(n) + 1
		if i == a || i == b {
			continue
		}
		x := ask(i, a)
		y := ask(i, b)
		if x < y {
			idx = a
		} else {
			idx = b
		}
	}

	p[idx-1] = 0

	for i := 1; i <= n; i++ {
		if i == idx {
			continue
		}
		p[i-1] = ask(i, idx)
	}

	return p
}


package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	n := NextInt()
	m := NextInt()
	res := make([]int, 0)
	i := 0
	for i = 1; m > 0 && i <= n; i++ {
		t := (i - 1) / 2
		if m >= t {
			m -= t
			res = append(res, i)
		} else {
			res = append(res, i-1+i-2-2*(m-1))
			m = 0
		}
	}
	if m > 0 {
		fmt.Fprintln(out, -1)
		return
	}

	for ; i <= n; i++ {
		res = append(res, 100000000+i*5001)
	}

	for i := 0; i < n; i++ {
		fmt.Fprint(out, res[i], " ")
	}
	fmt.Fprintln(out)
}

package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	if n < 3 && m > 0 {
		Fprint(out, -1)
		return
	}
	maxM := 0
	for i := 3; i <= n; i++ {
		maxM += (i - 1) / 2
	}
	if m > maxM {
		Fprint(out, -1)
		return
	}
	if m == 0 {
		for i := 1e9 - n + 1; i <= 1e9; i++ {
			Fprint(out, i, " ")
		}
		return
	}
	maxM = 0
	for i := 3; i <= n; i++ {
		tmp := maxM
		maxM += (i - 1) / 2
		if maxM < m {
			continue
		}
		for j := 1; j < i; j++ {
			Fprint(out, j, " ")
		}
		last := i
		if maxM > m {
			last = i - 1 + i - 2*(m-tmp)
		}
		Fprint(out, last, " ")
		for j := i + 1; j <= n; j++ {
			Fprint(out, 1e9-(last+1)*(n-j), " ")
		}
		break
	}
}

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

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	n := NextInt()
	m := NextInt()
	res := make([]int, 0)
	i := 0
	for i = 1; m > 0 && i <= n; i++ {
		t := (i - 1) / 2
		if m >= t {
			m -= t
			res = append(res, i)
		} else {
			m = 0
			res = append(res, i-1+i-2-2*m)
		}
	}
	if m > 0 {
		fmt.Fprintln(out, -1)
		return
	}

	for ; i <= n; i++ {
		res = append(res, 10000000+i)
	}

	for i := 0; i < n; i++ {
		fmt.Fprint(out, res[i], " ")
	}
	fmt.Fprintln(out)
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	n := NextInt()
	m := NextInt()
	res := make([]int, 0)
	i := 0
	for i = 1; m > 0 && i <= n; i++ {
		t := (i - 1) / 2
		if m >= t {
			m -= t
			res = append(res, i)
		} else {
			res = append(res, i-1+i-2-2*(m-1))
			m = 0
		}
	}
	if m > 0 {
		fmt.Fprintln(out, -1)
		return
	}

	for ; i <= n; i++ {
		res = append(res, 10000000+i*100000)
	}

	for i := 0; i < n; i++ {
		fmt.Fprint(out, res[i], " ")
	}
	fmt.Fprintln(out)
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	n := NextInt()
	m := NextInt()
	res := make([]int, 0)
	i := 0
	for i = 1; m > 0 && i <= n; i++ {
		t := (i - 1) / 2
		if m >= t {
			m -= t
			res = append(res, i)
		} else {
			res = append(res, i-1+i-2-2*(m-1))
			m = 0
		}
	}
	if m > 0 {
		fmt.Fprintln(out, -1)
		return
	}

	for ; i <= n; i++ {
		res = append(res, 10000000+i)
	}

	for i := 0; i < n; i++ {
		fmt.Fprint(out, res[i], " ")
	}
	fmt.Fprintln(out)
}

package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	if n < 3 {
		Fprint(out, -1)
		return
	}
	maxM := 0
	for i := 3; i <= n; i++ {
		maxM += (i - 1) / 2
	}
	if m > maxM {
		Fprint(out, -1)
		return
	}
	if m == 0 {
		for i := 1e9 - n + 1; i <= 1e9; i++ {
			Fprint(out, i, " ")
		}
		return
	}
	maxM = 0
	for i := 3; i <= n; i++ {
		tmp := maxM
		maxM += (i - 1) / 2
		if maxM < m {
			continue
		}
		for j := 1; j < i; j++ {
			Fprint(out, j, " ")
		}
		if maxM == m {
			Fprint(out, i, " ")
		} else {
			Fprint(out, i-1+i-2*(m-tmp), " ")
		}
		for j := i + 1; j <= n; j++ {
			Fprint(out, 1e9-n+j, " ")
		}
		break
	}
}

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

package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	if n < 3 {
		Fprint(out, -1)
		return
	}
	maxM := 0
	for i := 3; i <= n; i++ {
		maxM += (i - 1) / 2
	}
	if m > maxM {
		Fprint(out, -1)
		return
	}
	if m == 0 {
		for i := 1e9 - n - 1; i <= 1e9; i++ {
			Fprint(out, i, " ")
		}
		return
	}
	maxM = 0
	for i := 3; i <= n; i++ {
		tmp := maxM
		maxM += (i - 1) / 2
		if maxM < m {
			continue
		}
		for j := 1; j < i; j++ {
			Fprint(out, j, " ")
		}
		if maxM == m {
			Fprint(out, i, " ")
		} else {
			Fprint(out, i-1+i-2*(m-tmp), " ")
		}
		for j := i + 1; j <= n; j++ {
			Fprint(out, 1e9-n+j, " ")
		}
		break
	}
}

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

package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	if n < 3 && m > 0 {
		Fprint(out, -1)
		return
	}
	maxM := 0
	for i := 3; i <= n; i++ {
		maxM += (i - 1) / 2
	}
	if m > maxM {
		Fprint(out, -1)
		return
	}
	if m == 0 {
		for i := 1e9 - n + 1; i <= 1e9; i++ {
			Fprint(out, i, " ")
		}
		return
	}
	maxM = 0
	for i := 3; i <= n; i++ {
		tmp := maxM
		maxM += (i - 1) / 2
		if maxM < m {
			continue
		}
		for j := 1; j < i; j++ {
			Fprint(out, j, " ")
		}
		if maxM == m {
			Fprint(out, i, " ")
		} else {
			Fprint(out, i-1+i-2*(m-tmp), " ")
		}
		for j := i + 1; j <= n; j++ {
			Fprint(out, 1e9-n+j, " ")
		}
		break
	}
}

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