package main

/*
	Basically we just need to determine whether given word is Belanese.
	A word is belanese if it follows following rule:
	- vowel after consonant except for "n"
	- anything after vowel or "n" -> including empty char

	So we could just iterate each char in word. If we found a char which:
	- consonant but not n
	- not having vowel afterwards or last char
	we could infer that the word is not Belanese. Otherwise if we don't found
	anything like that, it must be Belanese.
*/

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

func main() {
	vocal := map[string]bool{
		"a": true,
		"i": true,
		"u": true,
		"e": true,
		"o": true,
	}
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	word := sc.Text()
	for i := 0; i < len(word); i++ {
		// get status
		ch := string(word[i])
		isLast := (i == len(word)-1)
		isVocal := vocal[ch]
		isN := (ch == "n")
		// get next char
		nextCh := ""
		if !isLast {
			nextCh = string(word[i+1])
		}
		// infer if word is belanese
		if !isN && (!isVocal && !vocal[nextCh] || !isVocal && isLast) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

package main

import "fmt"

func isAeiou(t string) bool {
	if t=="a" || t == "e" || t=="i" || t == "o" || t == "u" {
		return true
	}
	return false
}

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s)-1; i++ {
		if isAeiou(string(s[i])) || string(s[i])=="n" {
			continue
		}
		if !isAeiou(string(s[i+1])) {
			fmt.Println("NO")
			return
		}
	}
	if isAeiou(string(s[len(s)-1])) || string(s[len(s)-1])=="n" {
		fmt.Println("YES")
	}else {
		fmt.Println("NO")
	}
}

package main

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

func main() {
	vocal := map[string]bool{
		"a": true,
		"i": true,
		"u": true,
		"e": true,
		"o": true,
	}
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	word := sc.Text()
	for i := 0; i < len(word); i++ {
		// get status
		ch := string(word[i])
		isLast := (i == len(word)-1)
		isVocal := vocal[ch]
		isN := (ch == "n")
		// get next char
		nextCh := ""
		if !isLast {
			nextCh = string(word[i+1])
		}
		// infer if word is belanese
		if !isN && (!isVocal && !vocal[nextCh] || !isVocal && isLast) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

package main

import "fmt"

func isVowel(c byte) bool {
    if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
        return true
    } else {
        return false
    }
}

func main() {
    var s string
    fmt.Scanf("%s", &s)
    succ := true
    for i, c := range []byte(s) {
        cur := true
        if !isVowel(c) && c != 'n' {
            cur = (i < len(s) - 1) && isVowel(s[i+1])
        }
        if !cur {
            succ = false
        }
    }
    if succ {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

package main

import "fmt"

func isVowel(c byte) bool {
    if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
        return true
    } else {
        return false
    }
}

func main() {
    var s string
    fmt.Scanf("%s", &s)
    succ := true
    for i, c := range []byte(s) {
        cur := true
        if !isVowel(c) {
            if c == 'n' {
            } else {
                cur = (i < len(s) - 1) && isVowel(s[i+1])
            }
        }
        if !cur {
            succ = false
        }
        // fmt.Println(i, c, cur)
    }
    if succ {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

package main

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

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

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

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

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

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

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

type state func() state

func main() {
	defer Flush()

	s := readb()
	var i int
	ok := true

	var vowel, consonant state
	vowel = func() state {
		//eprintln(i, "vowel", ok)
		if i == len(s) {
			return nil
		}
		switch s[i] {
		case 'a', 'o', 'u', 'i', 'e', 'n':
			i++
			return vowel
		default:
			i++
			return consonant
		}
	}
	consonant = func() state {
		//eprintln(i, "consonant", ok)
		if i == len(s) {
			ok = false
			return nil
		}
		switch s[i] {
		case 'a', 'o', 'u', 'i', 'e':
			i++
			return vowel
		default:
			ok = false
			return nil
		}
	}
	for st := vowel; st != nil; st = st() {
	}
	if ok {
		println("YES")
	} else {
		println("NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	if len(word) > 1 {
		for i := 0; i < len(word)-1; i++ {
			if isBerlanese == false {
				break
			}
			letter := rune(word[i])
			nextLetter := rune(word[i+1])
			if letter == 'n' {
				continue
			}

			_, isVowel := vowels[letter]
			if isVowel == true {
				continue
			} else {
				_, nextIsVowel := vowels[nextLetter]
				if nextIsVowel == false {
					isBerlanese = false
					break
				}
			}
		}
	} else {
		letter := rune(word[0])
		if letter == 'n' {
			isBerlanese = true
		} else if _, V := vowels[letter]; V == true {
			isBerlanese = true
		} else {
			isBerlanese = false
		}
	}

	letter := rune(word[len(word)-1])
	if _, okay := vowels[letter]; !(okay == true || letter == 'n') {
		isBerlanese = false
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

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

func main() {
	sc := NewScanner()

	S := sc.NextLine()

	flag := false
	for i := 0; i < len(S); i++ {
		switch S[i] {
		case 'a', 'i', 'u', 'e', 'o':
			flag = false
		default:
			if flag {
				fmt.Println("NO")
				return
			}
			if S[i] != 'n' {
				flag = true
			}
		}
	}
	if flag {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}

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

package main

import "fmt"

func main() {
	for {
		var word string
		_, err := fmt.Scanln(&word)
		if err != nil {
			break
		}

		need_vowel, need_rune := false, false
		res := "YES"

		for _, c := range word {
			switch c {
			case 'a', 'o', 'u', 'i', 'e':
			default:
				if need_vowel {
					res = "NO"
				}
			}

			if res == "NO" {
				break
			}
			switch c {
			case 'a', 'o', 'u', 'i', 'e', 'n':
				need_vowel, need_rune = false, false
			default:
				need_vowel, need_rune = true, true
			}
		}

		if need_rune {
			res = "NO"
		}

		fmt.Println(res)
	}
}

package main

import "fmt"

func main() {
    var s string
	fmt.Scan(&s)
	t := true
	flag := false
	for  i,a := range(s){
	    f := true
	    for _,b := range([]rune{'a','o','u','i','e'}) {
    	        if a == b { f = false }
    	}
	    if  flag &&  f {
	        t = false
	        break
	    } else if flag && !f {
	        flag = false
	    } else if !flag && f && a != 'n'{
	        flag  = true
	    } else if  f && i == len(s)-1 && a != 'n'  {
	        t = false
	        break
	    }

	}
	if t && !flag {
	    fmt.Println("YES")
	} else {
	    fmt.Println("NO")
	}
}

package main

import "fmt"

func isVowel(c byte) bool {
    if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
        return true
    } else {
        return false
    }
}

func main() {
    var s string
    fmt.Scanf("%s", &s)
    succ := true
    for i, c := range []byte(s) {
        cur := true
        if !isVowel(c) {
            if c == 'n' {
                cur = (i == len(s) - 1) || isVowel(s[i+1])
            } else {
                cur = (i < len(s) - 1) && isVowel(s[i+1])
            }
        }
        if !cur {
            succ = false
        }
    }
    if succ {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

package main

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

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

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

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

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

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

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

type state func() state

func main() {
	defer Flush()

	s := readb()
	var i int
	ok := true

	var vowel, consonant state
	vowel = func() state {
		//eprintln(i, "vowel", ok)
		if i == len(s) {
			return nil
		}
		switch s[i] {
		case 'a', 'o', 'u', 'i', 'e', 'n':
			i++
			return vowel
		default:
			i++
			return consonant
		}
	}
	consonant = func() state {
		//eprintln(i, "consonant", ok)
		if i == len(s) {
			ok = false
			return nil
		}
		switch s[i] {
		case 'a', 'o', 'u', 'i', 'e', 'n':
			i++
			return vowel
		default:
			ok = false
			return nil
		}
	}
	for st := vowel; st != nil; st = st() {
	}
	if ok {
		println("YES")
	} else {
		println("NO")
	}
}

package main

import (
	"bufio"
	"io"
	"os"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	word := readLine(reader)

	for i := 0; i < len(word)-1; i++ {
		if isBerlanese == false {
			break
		}
		letter := rune(word[i])
		nextLetter := rune(word[i+1])
		if letter == 'n' {
			continue
		}

		_, isVowel := vowels[letter]
		if isVowel == true {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == true {
				isBerlanese = false
				break
			}
		} else {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == false {
				isBerlanese = false
				break
			}
		}
	}

	if isBerlanese == true {
		println("YES")
	} else {
		println("NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	if len(word) > 1 {
		for i := 0; i < len(word)-1; i++ {
			if isBerlanese == false {
				break
			}
			letter := rune(word[i])
			nextLetter := rune(word[i+1])
			if letter == 'n' {
				continue
			}

			_, isVowel := vowels[letter]
			if isVowel == true {
				continue
			} else {
				_, nextIsVowel := vowels[nextLetter]
				if nextIsVowel == false {
					isBerlanese = false
					break
				}
			}
		}
	} else {
		letter := rune(word[0])
		if letter == 'n' {
			isBerlanese = true
		}
		if _, V := vowels[letter]; V == true {
			isBerlanese = true
		}
		isBerlanese = false
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	for i := 0; i < len(word)-1; i++ {
		if isBerlanese == false {
			break
		}
		letter := rune(word[i])
		nextLetter := rune(word[i+1])
		if letter == 'n' {
			continue
		}

		_, isVowel := vowels[letter]
		if isVowel == true {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == true {
				isBerlanese = false
				break
			}
		} else {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == false {
				isBerlanese = false
				break
			}
		}
	}

	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	for i := 0; i < len(word)-1; i++ {
		if isBerlanese == false {
			break
		}
		letter := rune(word[i])
		nextLetter := rune(word[i+1])
		if letter == 'n' {
			continue
		}

		_, isVowel := vowels[letter]
		if isVowel == true {
			continue
		} else {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == false {
				isBerlanese = false
				break
			}
		}
	}

	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	if !(len(word) == 1) {

		for i := 0; i < len(word)-1; i++ {
			if isBerlanese == false {
				break
			}
			letter := rune(word[i])
			nextLetter := rune(word[i+1])
			if letter == 'n' {
				continue
			}

			_, isVowel := vowels[letter]
			if isVowel == true {
				continue
			} else {
				_, nextIsVowel := vowels[nextLetter]
				if nextIsVowel == false {
					isBerlanese = false
					break
				}
			}
		}
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	for i := 0; i < len(word)-1; i++ {
		if isBerlanese == false {
			break
		}
		letter := rune(word[i])
		nextLetter := rune(word[i+1])
		if len(word) == 1 && letter == 'n' {
			continue
		}
		if _, V := vowels[letter]; len(word) == 1 && V == true {
			continue
		}
		if len(word) == 1 {
			isBerlanese = false
			break
		}
		if letter == 'n' {
			continue
		}

		_, isVowel := vowels[letter]
		if isVowel == true {
			continue
		} else {
			_, nextIsVowel := vowels[nextLetter]
			if nextIsVowel == false {
				isBerlanese = false
				break
			}
		}
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strings"
)

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	if len(word) > 1 {
		for i := 0; i < len(word)-1; i++ {
			if isBerlanese == false {
				break
			}
			letter := rune(word[i])
			nextLetter := rune(word[i+1])
			if letter == 'n' {
				continue
			}

			_, isVowel := vowels[letter]
			if isVowel == true {
				continue
			} else {
				_, nextIsVowel := vowels[nextLetter]
				if nextIsVowel == false {
					isBerlanese = false
					break
				}
			}
		}
	} else {
		letter := rune(word[0])
		if letter == 'n' {
			isBerlanese = true
		} else if _, V := vowels[letter]; V == true {
			isBerlanese = true
		} else {
			isBerlanese = false
		}
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}

package main

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

func main() {
	sc := NewScanner()

	S := sc.NextLine()

	flag := false
	for i := 0; i < len(S); i++ {
		switch S[i] {
		case 'a', 'i', 'u', 'e', 'o', 'n':
			flag = false
		default:
			if flag {
				fmt.Println("NO")
				return
			}
			flag = true
		}
	}
	if flag {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}

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

package main

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

func main() {
	sc := NewScanner()

	S := sc.NextLine()

	flag := false
	for i := 0; i < len(S); i++ {
		switch S[i] {
		case 'a', 'i', 'u', 'e', 'o':
			flag = false
		case 'n':
		default:
			if flag {
				fmt.Println("NO")
				return
			}
			flag = true
		}
	}
	if flag {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}

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

package main

import "fmt"

func main() {
    var s string
	fmt.Scan(&s)
	t := true
	flag := false
	for  i,a := range(s){
	    f := true
	    if a != 'n' {
    	    for _,b := range([]rune{'a','o','u','i','e'}) {
    	        if a == b { f = false }
    	    }

	    if  flag && f {
	        t = false
	        break
	    }
	    if flag && !f {
	        flag = false
	    }
	    if !flag && f {
	        flag  = true
	    }
	    if  f && i == len(s)-1   {
	        t = false
	        break
	    }
	    }
	}
	if t {
	    fmt.Println("YES")
	} else {
	    fmt.Println("NO")
	}
}

package main

import "fmt"

func main() {
    var s string
	fmt.Scan(&s)
	t := true
	flag := false
	for  i,a := range(s){
	    f := true
	    for _,b := range([]rune{'a','o','u','i','e'}) {
    	        if a == b { f = false }
    	}
	    if  flag &&  f {
	        t = false
	        break
	    } else if flag && !f {
	        flag = false
	    } else if !flag && f && a != 'n'{
	        flag  = true
	    } else if  f && i == len(s)-1 && a != 'n'  {
	        t = false
	        break
	    }

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

package main

import "fmt"

func main() {
    var s string
	fmt.Scan(&s)
	t := true
	flag := false
	for  i,a := range(s){
	    f := true
	    for _,b := range([]rune{'a','o','u','i','e'}) {
    	        if a == b { f = false }
    	}
	    if  flag &&  f && a!='n' {
	        t = false
	        break
	    } else if flag && !f {
	        flag = false
	    } else if !flag && f && a != 'n'{
	        flag  = true
	    } else if  f && i == len(s)-1 && a != 'n'  {
	        t = false
	        break
	    }

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


package main
import "fmt"
func main(){
	var(
		n int
		s string
	)
	fmt.Scan(&n,&s)
	for i:=0;i<n-1;i++{
		if s[i]!='?'&&s[i]==s[i+1]{
			fmt.Println("No")
			return
		}
	}
	for i:=0;i<n;i++{
		if s[i]=='?'&&(i==0||i==n-1||s[i+1]=='?'||s[i-1]=='?'||s[i-1]==s[i+1]){
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

package main

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

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	n := io.NextInt()
	s := io.NextString()
	if n == 1 {
		if s[0] == '?' {
			io.Println("Yes")
		} else {
			io.Println("No")
		}
		return
	}
	s += string(s[n-2])
	l := s[1]
	o := false
	var j byte
	for i := 0; i < n; i++ {
		j = s[i]
		if j != '?' {
			if l == j {
				o = false
				break
			}
		} else {
			if s[i+1] == '?' || s[i+1] == l {
				o = true
			}
		}
		l = j
	}
	if o {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}

type FastIO struct {
	//by megaspazz
	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 res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
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() + 1
	}
	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 (
	"bufio"
	"fmt"
	"os"
)

func solve() bool {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	maj := scanner.Text()
	for i := 0; i < len(maj)-1; i++ {
		if maj[i] == maj[i+1] && maj[i] != '?' {
			return false
		}
	}
	// A?A -> Yes
	// A?B -> No
	for i := range maj {
		if maj[i] == '?' {
			if i == 0 || i == len(maj)-1 {
				return true
			}
			if maj[i-1] == '?' || maj[i+1] == '?' {
				return true
			}
			if maj[i-1] == maj[i+1] {
				return true
			}
		}
	}
	return false
}

func main() {
	if solve() {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &s)
	for i:=1;i<n;i++{
		if s[i]==s[i-1] && !(s[i]=='?' || s[i-1]=='?'){
			fmt.Println("No")
			os.Exit(0)
		}
	}
	if s[0] == '?' || s[n-1] == '?'{
		fmt.Println("Yes")
		os.Exit(0)
	}
	for i:=1;i<n-1;i++{
		if s[i] == '?'{
			if s[i-1] == '?' || s[i-1]==s[i+1]{
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
	fmt.Println("No")
}

package main
import (
	"fmt"
	"strings"
)
func main(){
	var(
		n int
		s string
	)
	fmt.Scan(&n,&s)
	if strings.Count(s,"MM")>0||strings.Count(s,"CC")>0||strings.Count(s,"YY")>0{
		fmt.Println("No")
		return
	}
	if s[0]=='?'||s[n-1]=='?'||strings.Count(s,"??")>0||strings.Count(s,"M?M")>0||strings.Count(s,"C?C")>0||strings.Count(s,"Y?Y")>0{
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	for i := 1; i < n; i++ {
		if s[i - 1] == s[i] && s[i] != '?' {
			fmt.Print("No")
			return
		}
	}
	if s[0] == '?' || s[n - 1] == '?' {
		fmt.Print("Yes")
		return
	}
	for i := 1; i < n; i++ {
		if s[i - 1] == '?' && s[i] == '?' {
			fmt.Print("Yes")
			return
		}
	}
	for i := 1; i < n - 1; i++ {
		if s[i] == '?' && s[i - 1] == s[i + 1] {
			fmt.Print("Yes")
			return
		}
	}
	fmt.Print("No")
	return
}

package main

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

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	_ = io.NextInt()
	s := io.NextString()
	if check(0, rune('K'), s) > 1 {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}
func check(sti int, l rune, s string) int {
	c := 0
	chs := "CMY"
	s = s[sti:]
	//fmt.Println(l, s)
	for i, j := range s {
		if j != '?' {
			if j == l {
				return 0
			} else {
				l = j
			}
		} else if i+1 < len(s) {
			for _, k := range chs {
				if k != l {
					c += check(i+1, k, s)
				}
				if c > 1 {
					return c
				}
			}
		}
	}
	return 1
}

type FastIO struct {
	//by megaspazz
	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 res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
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() + 1
	}
	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 (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	n := io.NextInt()
	s := io.NextString()
	if n == 1 {
		io.Println("Yes")
		return
	}
	s += string(s[n-2])
	l := s[1]
	o := false
	var j byte
	for i := 0; i < n; i++ {
		j = s[i]
		if j != '?' {
			if l == j {
				o = false
				break
			}
		} else {
			if s[i+1] == '?' || s[i+1] == l {
				o = true
			}
		}
		l = j
	}
	if o {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}

type FastIO struct {
	//by megaspazz
	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 res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
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() + 1
	}
	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 (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	n := io.NextInt()
	s := io.NextString() + "K"
	l := byte('K')
	o := false
	var j byte
	for i := 0; i < n; i++ {
		j = s[i]
		if j != '?' {
			if l == j {
				o = false
				break
			}
		} else {
			if s[i+1] == '?' || s[i+1] == l {
				o = true
			}
		}
		l = j
	}
	if o {
		io.Println("Yes")
	} else {
		io.Println("No")
	}
}

type FastIO struct {
	//by megaspazz
	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 res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
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() + 1
	}
	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 (
	"bufio"
	"fmt"
	"os"
)

func solve() bool {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	maj := scanner.Text()
	for i := 0; i < len(maj)-1; i++ {
		if maj[i] == maj[i+1] && maj[i] != '?' {
			fmt.Println("FIRST")
			return false
		}
	}
	// A?A -> Yes
	// A?B -> No
	for i := range maj {
		if maj[i] == '?' {
			if i == 0 || i == len(maj)-1 {
				return true
			}
			if maj[i-1] == '?' || maj[i+1] == '?' {
				return true
			}
			if maj[i-1] == maj[i+1] {
				return true
			}
		}
	}
	return false
}

func main() {
	if solve() {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &s)
	for i:=1;i<n;i++{
		if s[i]==s[i-1]{
			fmt.Println("No")
			os.Exit(0)
		}
	}
	if s[0] == '?' || s[n-1] == '?'{
		fmt.Println("Yes")
		os.Exit(0)
	}
	for i:=1;i<n-1;i++{
		if s[i] == '?'{
			if s[i-1] == '?' || s[i-1]==s[i+1]{
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &s)
	for i:=1;i<n;i++{
		if s[i]==s[i-1] && !(s[i]=='?' || s[i-1]=='?'){
			fmt.Println("No")
			os.Exit(0)
		}
	}
	if s[0] == '?' || s[n-1] == '?'{
		fmt.Println("Yes")
		os.Exit(0)
	}
	for i:=1;i<n-1;i++{
		if s[i] == '?'{
			if s[i-1] == '?' || s[i-1]==s[i+1]{
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	var s string
	var flag bool
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%s\n", &s)
	if s[0] == '?' || s[n-1] == '?'{
		fmt.Println("Yes")
		os.Exit(0)
	}
	for i:=1;i<n-1;i++{
		if s[i] == '?'{
			flag = true
			if s[i-1] == '?' || s[i-1]==s[i+1]{
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
	for i:=1;i<n;i++{
		if s[i]==s[i-1] && flag == false{
			fmt.Println("No")
			os.Exit(0)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	for i := 1; i < n; i++ {
		if s[i - 1] == s[i] && s[i] != '?' {
			fmt.Print("No")
			return
		}
	}
	if s[0] == '?' || s[n - 1] == '?' {
		fmt.Print("Yes")
		return
	}
	for i := 1; i < n; i++ {
		if s[i - 1] == '?' && s[i] == '?' {
			fmt.Print("Yes")
			return
		}
	}
	fmt.Print("No")
}


package main;

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

func mysplit(line string) []string {
    from := 0
    output := make([]string, 0, 10)
    for i, c := range line {
        if c=='(' || c==')' {
            output = append(output, line[from:i])
            from = i+1
        }
    }
    if from<len(line) {
        output = append(output, line[from:len(line)])
    }

    return output
}

func groups(line string) ([]string, []string) {
    outside, inside := make([]string, 0, 10), make([]string, 0, 10)
    parts := mysplit(line)
    out := true //line[0]!='('
    for _, p := range parts {
        if out {
            outside = append(outside, strings.Split(p, "_") ...)
        } else {
            inside = append(inside, strings.Split(p, "_") ...)
        }
        out = !out
    }

    return outside, inside

}

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

    scanner.Scan() // number
    scanner.Scan()
    outside, inside := groups(scanner.Text())

    fmt.Fprintf(os.Stderr, "%v - %v \n", outside, inside)

    longestOutside := 0
    for _, w := range outside {
        if len(w) > longestOutside {
            longestOutside = len(w)
        }
    }

    inParenthesis := 0
    for _, w := range inside {
        if len(w) > 0 {
            inParenthesis++
        }
    }

    fmt.Println(longestOutside, inParenthesis)
}

package main

import (
        "fmt"
        "regexp"
        "strconv"
        "strings"
)

func O(o interface{}, n bool) {
        if n {
                fmt.Println(o)
        } else {
                fmt.Printf("%v ", o)
        }
}

func Int(s string) int64 {
        t, _ := strconv.ParseInt(s, 10, 64)
        return t
}

func I(n bool) string {
        var t string
        if n {
                fmt.Scanln(&t)
        } else {
                fmt.Scan(&t)
        }
        return t
}

func main() {
        n := Int(I(true))
        s := I(true)
        n = n

        re := regexp.MustCompile(`\([^\(\)]*\)`)
        ss := re.FindAllString(s, -1)

        ooo := re.ReplaceAllString(s, "_")

        rrr := regexp.MustCompile(`([_])*`)
        ooo = rrr.ReplaceAllString(ooo, "$1")
        qqq := strings.Split(ooo, "_")
        mmm := 0
        for _, q := range qqq {
                if len(q) > mmm {
                        mmm = len(q)
                }
        }

        O(mmm, false)

        num := 0
        for i := range ss {
                sss := strings.Split(ss[i], "_")
                for j := range sss {
                        r := regexp.MustCompile(`[_\(\)]`)
                        sss[j] = r.ReplaceAllString(sss[j], "")
                        if len(sss[j]) > 0 {
                                num++
                        }
                }
        }
        O(num, true)
}

package main

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

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

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

	var n int
	var s string
	fmt.Fscanf(bufin, "%d\n", &n)
	fmt.Fscanf(bufin, "%s\n", &s)

	inside := false
	l := 0

	longestOutside := 0
	countInside := 0

	s = "_" + s + "_"
	n = len(s)

	for i := 0; i < n; i++ {
		c := s[i]
		if (c == '_') || (c == '(') || (c == ')') {
			if l > 0 {
				if inside {
					countInside++
				} else {
					if longestOutside < l {
						longestOutside = l
					}
				}
				l = 0
			}
		} else {
			l++
		}
		if c == '(' {
			inside = true
		} else if c == ')' {
			inside = false
		}
	}

	fmt.Fprintf(bufout, "%d %d\n", longestOutside, countInside)
}

package main

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

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

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

	_ = nextInt()
	s := next()
	var outsideWords []string

	for i := strings.Index(s, "("); i >= 0; i = strings.Index(s, "(") {
		j := strings.Index(s, ")")
		outsideWords = append(outsideWords, splitWords(s[i+1:j], '_')...)
		s = s[:i] + "_" + s[j+1:]
	}

	println(maxLength(splitWords(s, '_')), len(outsideWords))

}

func splitWords(s string, c rune) []string {
	return strings.FieldsFunc(s, func(c rune) bool { return c == '_' })
}

func maxLength(s []string) int {
	l := 0

	for i := range s {
		if len(s[i]) > l {
			l = len(s[i])
		}
	}

	return l
}

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

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

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

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

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

package main

import (
	"fmt"
)

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

func main() {
	var  (
		n int
		str string
	)

	fmt.Scanln(&n)
	fmt.Scanln(&str)

	i := 0;
	s_words := 0
	s_len := 0
	w_len := 0
	w_max := 0
	for i < n {
		if str[i] == '(' {
			i++

			for  i < n && str[i] != ')' {
				if str[i] != '_' {
					s_len++
				} else {
					if s_len > 0 {
						s_words++
					}
					s_len = 0
				}
				i++

			}
			i++
			if s_len > 0 {
				s_words++
			}
			s_len = 0
			continue
		}

		for i < n && str[i] != '(' {
				if str[i] != '_' {
					w_len++
				} else {
					if w_len > 0 {
						w_max = max(w_max, w_len)
					}
					w_len = 0
				}
				i++
			}

		if w_len > 0 {
			w_max = max(w_max, w_len)
		}
		w_len = 0
	}

	fmt.Println(w_max, s_words)
}

package main

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

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	var longest int = 0
	var words_inside int = 0

	reader := bufio.NewReader(os.Stdin)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		inside := false
		word_length := 0
		for i := 0; i < n; i++ {
			if (s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z') {
				word_length++
			} else {
				if !inside && word_length > longest {
					longest = word_length
				}
				if inside && word_length > 0 {
					words_inside++
				}
				if s[i] == '(' {
					inside = true
				} else if s[i] == ')' {
					inside = false
				}
				word_length = 0
			}
		}
		if word_length > longest {
			longest = word_length
		}
	}

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

package main

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

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

type res struct {
	ind int
	wrd string
}

func inside_parthesis(S string, x *res) bool {
	l, r := false, false
	for i := x.ind; i >= 0; i-- {
		if S[i] == '(' {
			l = true
			break
		} else if S[i] == ')' {
			break
		}
	}
	for i := x.ind; i < len(S); i++ {
		if S[i] == ')' {
			r = true
			break
		} else if S[i] == '(' {
			break
		}
	}
	return l && r
}
func mysplit(S string) []res {
	var cur string
	var start int
	var ret []res

	for i, c := range S {
		if c != '_' && c != '(' && c != ')' {
			if cur == "" {
				start = i
			}
			cur += string(c)
		} else if cur != "" {
			ret = append(ret, res{start, cur})
			cur = ""
		}
	}
	if cur != "" {
		ret = append(ret, res{start, cur})
	}
	return ret
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()
	var N int
	fmt.Fscanf(bufin, "%d\n", &N)
	var S string
	fmt.Fscanf(bufin, "%s\n", &S)
	words := mysplit(S)
	cnt := 0
	maxlen := 0
	for _, x := range words {
		if inside_parthesis(S, &x) {
			cnt += 1
		} else {
			if maxlen < len(x.wrd) {
				maxlen = len(x.wrd)
			}
		}
	}
	fmt.Fprintf(bufout, "%d %d\n", maxlen, cnt)

}

package main

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

func main() {
	fsc := NewFastScanner()
	n := fsc.NextInt()
	text := fsc.Next()
	var flag, maxLength, inLength, outLength, count int
	for i := 0; i <= n; i++ {
		if i == n {
			if maxLength < outLength {
				maxLength = outLength
			}
			break
		}
		if text[i] == '(' {
			if maxLength < outLength {
				maxLength = outLength
			}
			outLength = 0
			flag = 1
		} else if text[i] == ')' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			flag = 0
		} else if text[i] == '_' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			if outLength != 0 {
				if maxLength < outLength {
					maxLength = outLength
				}
			}
			outLength = 0
		} else if flag == 0 {
			outLength++
		} else if flag == 1 {
			inLength++
		}
	}

	fmt.Println(maxLength, count)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) 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 *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

type TupleInt struct {
	first  int
	second int
	third  int
}

func main() {
	in := NewScanner()
	_ = in.NextInt()
	S := in.NextLine()
	inside := false
	mx := 0
	count := 0
	comma := false
	ln := 0
	for _, s := range S {
		if s == '(' {
			inside = true
			comma = true
		} else if s == ')' {
			inside = false
			comma = true

		} else if s == '_' {
			comma = true
		} else {
			if !inside {
				ln++
				mx = max(mx, ln)
			}

			if comma {
				if inside {
					count++
				}
				comma = false
			}
		}
		if comma {
			ln = 0
		}

	}
	fmt.Println(mx, count)
}
func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

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); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

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

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

package main

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

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

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

	_ = nextInt()
	s := next()
	var outsideWords []string

	for i := strings.Index(s, "("); i >= 0; i = strings.Index(s, "(") {
		j := strings.Index(s, ")")
		outsideWords = append(outsideWords, splitWords(s[i+1:j], '_')...)
		s = s[:i] + s[j+1:]
	}

	println(maxLength(splitWords(s, '_')), len(outsideWords))

}

func splitWords(s string, c rune) []string {
	return strings.FieldsFunc(s, func(c rune) bool { return c == '_' })
}

func maxLength(s []string) int {
	l := 0

	for i := range s {
		if len(s[i]) > l {
			l = len(s[i])
		}
	}

	return l
}

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

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

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

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

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

package main;

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

func groups(line string) ([]string, []string) {
    outside, inside := make([]string, 0, 10), make([]string, 0, 10)
    parts := strings.FieldsFunc(line, func(c rune) bool {
        return c=='(' || c==')'
    })
    out := line[0]!='('
    for _, p := range parts {
        if out {
            outside = append(outside, strings.Split(p, "_") ...)
        } else {
            inside = append(inside, strings.Split(p, "_") ...)
        }
        out = !out
    }

    return outside, inside

}

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

    scanner.Scan() // number
    scanner.Scan()
    outside, inside := groups(scanner.Text())

    fmt.Fprintf(os.Stderr, "%v - %v \n", outside, inside)

    longestOutside := 0
    for _, w := range outside {
        if len(w) > longestOutside {
            longestOutside = len(w)
        }
    }

    inParenthesis := 0
    for _, w := range inside {
        if len(w) > 0 {
            inParenthesis++
        }
    }

    fmt.Println(longestOutside, inParenthesis)
}

package main

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

func main() {
	fsc := NewFastScanner()
	n := fsc.NextInt()
	text := fsc.Next()
	var flag, maxLength, inLength, outLength, count int
	for i := 0; i < n; i++ {
		if text[i] == '(' {
			if maxLength < outLength {
				maxLength = outLength
			}
			outLength = 0
			flag = 1
		} else if text[i] == ')' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			flag = 0
		} else if text[i] == '_' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			if outLength != 0 {
				if maxLength < outLength {
					maxLength = outLength
				}
			}
			outLength = 0
		} else if flag == 0 {
			outLength++
		} else if flag == 1 {
			inLength++
		}
	}

	fmt.Println(maxLength, count)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) 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 *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

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

type TupleInt struct {
	first  int
	second int
	third  int
}

func main() {
	in := NewScanner()
	_ = in.NextInt()
	S := in.NextLine()
	inside := false
	last := 0
	mx := 0
	count := 0
	comma := false

	for i, s := range S {
		if s == '(' {
			inside = true
			comma = true
		} else if s == ')' {
			inside = false
			comma = true
			last = i + 1

		} else if s == '_' {
			comma = true
		} else {
			if comma {
				if inside {
					count++
				}
				comma = false
			}
		}
		if comma {
			if !inside {
				mx = max(mx, i - last)
			}
			last = i + 1
		}

	}
	fmt.Println(mx, count)
}
func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

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); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

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

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


package main

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

func solve() {
	n := readInt64()
	k := readString()
	values := make([]int, 0)
	for len(k) > 0 {
		var maxValue int
		var maxIndex int
		for i := len(k) - 1; i >= 0; i-- {
			value, err := strconv.ParseInt(k[i:], 10, 64)
			if err == nil {
				if value < n {
					maxValue = int(value)
					maxIndex = i
				} else {
					break
				}
			} else {
				break
			}
		}
		if maxIndex+1 < len(k) {
			if maxValue != 0 {
				for maxIndex < len(k) && k[maxIndex] == '0' {
					maxIndex++
				}
			} else if maxValue == 0 {
				maxIndex = len(k) - 1
			}
		}
		k = k[:maxIndex]
		values = append(values, maxValue)
	}
	var res int64
	for i := len(values) - 1; i >= 0; i-- {
		res *= n
		res += int64(values[i])
	}
	fmt.Println(res)
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

package main

import (
	"fmt"
	"log"
	"sort"
)

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func find_last_le_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] <= target{
			s = mid + 1
		}else {
			e = mid
		}
	}
	return s - 1
}

func find_first_ge_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] < target{
			s = mid + 1
		}else {
			e = mid
		}
	}

	return s
}

func maxSumSubmatrix(a [][]int, target int) int {
	row := len(a)
	if row == 0{
		return 0
	}
	col := len(a[0])

	pre_sum := make([][]int, row)
	for i := range pre_sum{
		pre_sum[i] = make([]int ,col)
	}

	for i := 0;i < row; i ++{
		for j :=0;j < col; j ++{
			if j == 0 {
				pre_sum[i][j] = a[i][j]
			}else {
				pre_sum[i][j] = pre_sum[i][j-1] + a[i][j]
			}
		}
	}

	near := -100000000
	for i := 0; i < col ; i ++{
		for j :=i ;j <col; j ++{
			tmp := []int {0}
			cur := 0
			for k := 0;k < row; k++{

				if i == j {
					cur += a[k][i]
				}else if i == 0{
					cur += pre_sum[k][j]
				}else {
					cur += pre_sum[k][j] - pre_sum[k][i-1]
				}
				idx := find_first_ge_idx(tmp, cur  - target)
				if idx != len(tmp){
					near = max(near, cur -tmp[idx] )
				}
				iid := find_first_ge_idx(tmp, cur )
				q := tmp[iid:]
				tmp = append(tmp[:iid], cur)
				tmp = append(tmp ,q...)

				//if k == 0{
				//	if cur ==target || (cur < target&& cur > near) {
				//		near = cur
				//	}
				//	tmp = append(tmp, cur)
				//}
			}

		}
	}
	return near
}

func q(matrix [][]int, k int) int {
	row := len(matrix)
	col := len(matrix[0])
	near := -1000000
	for left := 0; left < col ; left ++{
	// 以left为左边界，每行的总和
		_sum :=make([]int, row)
	//for right in range(left, col):
		for right :=left ;right <col; right ++ {

			for j := 0; j < row; j++ {
				_sum[j] += matrix[j][right]
			}
			// 在left，right为边界下的矩阵，求不超过K的最大数值和
			tmp := []int{0}
			cur := 0
			for _, tmpp := range _sum {
				cur += tmpp

				//# 二分法
				idx := find_first_ge_idx(tmp, cur-k)
				if idx != len(tmp) {
					near = max(near, cur-tmp[idx])
				}
				iid := find_first_ge_idx(tmp, cur)
				q := []int{}

				q= append(q, tmp[iid:]...)
				ee := []int{}
				ee = append(ee,tmp[:iid]...)
				ee = append(ee, cur)
				tmp = append(ee, q...)
			}
		}
		}

	return near
}

func qeqw(a int, aa int) int{

	caa := "asas"
	log.Println(caa)
	return 23
}

func m(a []int, b[]int){
	 //q := map[[2]int]bool{}

}
var ori [1000001]int
var record [1000001]int

var energy [1000001]int
var counter [1000001]int

//}
func p(){
	var n int
	var k int
	var target int
	//var n,k int
	fmt.Scan(&n)
	fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&record[i])
	}
	idx := -1
	left := 0
	min_l := 1000000000
	m_l := 0
	m_r := 0
	for ;left < n &&idx < n;{
		if target == k {
			//if counter[record[left]] > 1 {
			if idx - left +1 < min_l{
				min_l = idx - left + 1
				m_l = left
				m_r = idx
			}
			counter[record[left]] --

			//}else {
			//
			//}
			if counter[record[left]] == 0 {
				target --
			}
			left ++
		}else{
				idx ++
			counter[record[idx]] ++
			if counter[record[idx]] == 1{
				target ++
			}
			//idx++
		}
	}
	fmt.Println(m_l + 1, m_r + 1)
}

func ini(){
	var n int
	//var k int
	fmt.Scan(&n)
	//fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&ori[i])
		fmt.Scan(&energy[i])
	}
	R := -1
	L := 0
	for i :=0; i < n; i ++{
		//if record[L] == i - k{
		//	L ++
		//}
		for ;R >= L &&ori[i] >ori[record[R]];R--{
			counter[i]	+= energy[record[R]]
		}
		tmp := energy[i]
		for ;R >= L &&ori[i] ==ori[record[R]];R--{
			tmp += energy[i]
		}
		R ++
		record[R] = i
		if R != 0  {
			counter[record[R - 1]] += tmp
		}
	}
	m := -1
	for i :=0; i <n;i ++{
		if counter[i] > m{
			m = counter[i]
		}
	}
	fmt.Println(m)
}
type S struct {
	Idx int
	Time int

}
type intSlice []S

func (p intSlice) Len() int           { return len(p) }
func (p intSlice) Less(i, j int) bool { return p[i].Time > p[j].Time }
func (p intSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

var roww [1000]int
var coll [1000]int
func inii(){
	var m,n,k,l,d int
	//var k int
	row := make(intSlice, 10000)
	col := make(intSlice, 10000)
	fmt.Scan(&m, &n, &k, &l,&d)
	//fmt.Scan(&k)
	for i := 0;i < d; i ++{
		var x1,y1,x2,y2 int
		fmt.Scan(&x1,&y1,&x2,&y2)
		if x1 == x2 {
			if y1 > y2 {
				y1,y2 = y2,y1
			}
			col[y1].Idx = y1
			col[y1].Time ++
		}else{
				if x1 > x2{
					x1,x2 = x2,x1
				}
				row[x1].Idx = x1
			row[x1].Time ++
		}
		//fmt.Scan(&energy[i])
	}
	//row = row[:m+1]
	//col = col[:n + 1]
	sort.Sort(row)
	sort.Sort(col)
	row = row[:k+1]
	col = col[:l + 1]
	sort.Sort(row)
	sort.Sort(col)
	for i := 0;i < k-1;i ++ {
		fmt.Print(row[i].Idx," ")
	}
	fmt.Print(row[k -1 ].Idx,"\n")
	for i := 0;i < l-1;i ++ {
		fmt.Print(col[i].Idx," ")
	}
	fmt.Print(col[l -1 ].Idx,"\n")

}

func next_per(){
	var n int
	var m int
	fmt.Scan(&n,&m)
	a :=make([]int, n)
	for i:=0;i <n;i++{
		fmt.Scan(&a[i])
	}
	for ;m > 0;m--{
		i := 0
		for i = n-2;i >=0;i --{
			if a[i] < a[i + 1]{
				break
			}

		}
		//t := a[i+1]
		j := 0
		for j = i + 1;j < n;j ++{
			if a[j] <= a[i]{
					break
			}
		}
		a[i],a[j-1] = a[j-1],a[i]
		sort.Ints(a[i + 1:])

	}
	fmt.Println(a)

}
var s string
var n,ans,length,carry int64
//var ans int
//var length int
//var carry int
//func max(x,y int)int{
//	if x > y{
//		return x
//	}
//	return y
//}
func maxf(x, y int64)int64{
	if x > y {
		return x
	}
	return y
}
func get(k int)int{
	var x int64
	var t int64 = 1
	i := k
	for ;i  >= 0; i -- {
		if x + maxf(int64(1), (int64)(s[i]-'0')) * int64(t) >=n{
			break
		}
		x += int64(s[i]-'0') * t
		t *= 10
	}
	for ;s[i+ 1] == '0'&& i < k-1;i ++{

	}
	ans += x * carry
	return i
}
func qq(){

	carry = 1
	fmt.Scan(&n, &s)
	i := len(s) - 1
	for ;i >=0;{
		i = get(i)
		carry *=n
	}
	fmt.Println( ans)

}

func main(){
	//a := [][]int{{28,4,-19,18,-7,-10,27,19,1,16,0,10,-17,11,11,27,-1,10,12,-1},
	//	{-2,-19,17,4,25,-20,4,3,4,28,-10,7,16,-14,-3,-19,6,17,-4,-7},
	//	{2,8,18,-17,-2,10,-6,-5,11,10,22,-6,19,-16,6,-4,18,5,22,-17},
	//	{-14,-7,-20,13,-19,-20,-15,21,-11,-10,-8,-9,10,13,6,-10,15,9,-15,-2},
	//	{-18,26,12,8,2,16,-17,12,0,-5,9,-3,-12,-11,3,-6,-18,16,-7,-14},
	//	{5,29,25,22,11,-3,-2,-15,4,13,-17,-2,0,-2,20,10,-18,6,25,-20},
	//	{5,-7,8,5,15,22,8,-5,22,-18,-5,-14,23,2,-8,12,-16,-18,12,-12},
	//	{27,18,4,11,-3,12,-4,-8,-3,25,-9,24,-14,5,11,-9,-17,0,25,-15},
	//	{26,-7,18,4,4,18,-17,9,-19,-9,-19,-8,-4,-13,10,-11,6,-16,-12,12},
	//	{28,22,7,11,-6,13,8,22,7,-14,17,14,10,29,16,9,-3,18,-9,10},
	//	{27,19,-10,-9,1,3,14,1,7,3,-3,16,-2,9,14,-7,-19,-5,23,19},
	//	{-17,7,-20,8,-5,-6,-2,25,29,16,23,4,4,27,16,17,9,20,-6,22},
	//	{2,9,-13,1,-18,25,4,7,25,26,-4,8,-19,18,6,-7,-5,7,21,-8},
	//	{-2,11,1,29,6,-16,-8,3,7,11,10,-2,-1,-20,20,4,19,5,29,-7},
	//	{29,-12,-3,17,6,19,23,12,-19,13,19,5,27,22,-17,27,10,-12,12,23},
	//	{24,16,4,25,15,13,24,-19,1,-7,-19,13,-13,14,13,26,9,18,-9,-18},
	//	{-17,4,-18,-18,-19,3,-13,12,23,-17,-10,-20,14,2,18,21,-12,27,-3,4},
	//	{27,13,12,14,16,-9,-2,-15,-20,8,-2,24,18,15,26,21,27,17,-15,-3},
	//	{25,-8,17,-10,-16,13,26,-11,-15,6,-5,-13,23,2,24,-4,5,8,-15,-1},
	//	{15,-12,18,5,-3,7,5,11,-4,-13,28,20,0,-4,-13,-5,-13,-8,-16,3}}

	//log.Println(find_last_le_idx(a, 3))
	//log.Println(q(a, -123))

	//aa := []int{2,3,1,3,4,6,1,2}
	//mm(aa, 1)
	//ini()
//inii()
	//next_per()
	qq()
}

package main

import (
	"fmt"
	"log"
	"sort"
)

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func find_last_le_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] <= target{
			s = mid + 1
		}else {
			e = mid
		}
	}
	return s - 1
}

func find_first_ge_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] < target{
			s = mid + 1
		}else {
			e = mid
		}
	}

	return s
}

func maxSumSubmatrix(a [][]int, target int) int {
	row := len(a)
	if row == 0{
		return 0
	}
	col := len(a[0])

	pre_sum := make([][]int, row)
	for i := range pre_sum{
		pre_sum[i] = make([]int ,col)
	}

	for i := 0;i < row; i ++{
		for j :=0;j < col; j ++{
			if j == 0 {
				pre_sum[i][j] = a[i][j]
			}else {
				pre_sum[i][j] = pre_sum[i][j-1] + a[i][j]
			}
		}
	}

	near := -100000000
	for i := 0; i < col ; i ++{
		for j :=i ;j <col; j ++{
			tmp := []int {0}
			cur := 0
			for k := 0;k < row; k++{

				if i == j {
					cur += a[k][i]
				}else if i == 0{
					cur += pre_sum[k][j]
				}else {
					cur += pre_sum[k][j] - pre_sum[k][i-1]
				}
				idx := find_first_ge_idx(tmp, cur  - target)
				if idx != len(tmp){
					near = max(near, cur -tmp[idx] )
				}
				iid := find_first_ge_idx(tmp, cur )
				q := tmp[iid:]
				tmp = append(tmp[:iid], cur)
				tmp = append(tmp ,q...)

				//if k == 0{
				//	if cur ==target || (cur < target&& cur > near) {
				//		near = cur
				//	}
				//	tmp = append(tmp, cur)
				//}
			}

		}
	}
	return near
}

func q(matrix [][]int, k int) int {
	row := len(matrix)
	col := len(matrix[0])
	near := -1000000
	for left := 0; left < col ; left ++{
	// 以left为左边界，每行的总和
		_sum :=make([]int, row)
	//for right in range(left, col):
		for right :=left ;right <col; right ++ {

			for j := 0; j < row; j++ {
				_sum[j] += matrix[j][right]
			}
			// 在left，right为边界下的矩阵，求不超过K的最大数值和
			tmp := []int{0}
			cur := 0
			for _, tmpp := range _sum {
				cur += tmpp

				//# 二分法
				idx := find_first_ge_idx(tmp, cur-k)
				if idx != len(tmp) {
					near = max(near, cur-tmp[idx])
				}
				iid := find_first_ge_idx(tmp, cur)
				q := []int{}

				q= append(q, tmp[iid:]...)
				ee := []int{}
				ee = append(ee,tmp[:iid]...)
				ee = append(ee, cur)
				tmp = append(ee, q...)
			}
		}
		}

	return near
}

func qeqw(a int, aa int) int{

	caa := "asas"
	log.Println(caa)
	return 23
}

func m(a []int, b[]int){
	 //q := map[[2]int]bool{}

}
var ori [1000001]int
var record [1000001]int

var energy [1000001]int
var counter [1000001]int

//}
func p(){
	var n int
	var k int
	var target int
	//var n,k int
	fmt.Scan(&n)
	fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&record[i])
	}
	idx := -1
	left := 0
	min_l := 1000000000
	m_l := 0
	m_r := 0
	for ;left < n &&idx < n;{
		if target == k {
			//if counter[record[left]] > 1 {
			if idx - left +1 < min_l{
				min_l = idx - left + 1
				m_l = left
				m_r = idx
			}
			counter[record[left]] --

			//}else {
			//
			//}
			if counter[record[left]] == 0 {
				target --
			}
			left ++
		}else{
				idx ++
			counter[record[idx]] ++
			if counter[record[idx]] == 1{
				target ++
			}
			//idx++
		}
	}
	fmt.Println(m_l + 1, m_r + 1)
}

func ini(){
	var n int
	//var k int
	fmt.Scan(&n)
	//fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&ori[i])
		fmt.Scan(&energy[i])
	}
	R := -1
	L := 0
	for i :=0; i < n; i ++{
		//if record[L] == i - k{
		//	L ++
		//}
		for ;R >= L &&ori[i] >ori[record[R]];R--{
			counter[i]	+= energy[record[R]]
		}
		tmp := energy[i]
		for ;R >= L &&ori[i] ==ori[record[R]];R--{
			tmp += energy[i]
		}
		R ++
		record[R] = i
		if R != 0  {
			counter[record[R - 1]] += tmp
		}
	}
	m := -1
	for i :=0; i <n;i ++{
		if counter[i] > m{
			m = counter[i]
		}
	}
	fmt.Println(m)
}
type S struct {
	Idx int
	Time int

}
type intSlice []S

func (p intSlice) Len() int           { return len(p) }
func (p intSlice) Less(i, j int) bool { return p[i].Time > p[j].Time }
func (p intSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

var roww [1000]int
var coll [1000]int
func inii(){
	var m,n,k,l,d int
	//var k int
	row := make(intSlice, 10000)
	col := make(intSlice, 10000)
	fmt.Scan(&m, &n, &k, &l,&d)
	//fmt.Scan(&k)
	for i := 0;i < d; i ++{
		var x1,y1,x2,y2 int
		fmt.Scan(&x1,&y1,&x2,&y2)
		if x1 == x2 {
			if y1 > y2 {
				y1,y2 = y2,y1
			}
			col[y1].Idx = y1
			col[y1].Time ++
		}else{
				if x1 > x2{
					x1,x2 = x2,x1
				}
				row[x1].Idx = x1
			row[x1].Time ++
		}
		//fmt.Scan(&energy[i])
	}
	//row = row[:m+1]
	//col = col[:n + 1]
	sort.Sort(row)
	sort.Sort(col)
	row = row[:k+1]
	col = col[:l + 1]
	sort.Sort(row)
	sort.Sort(col)
	for i := 0;i < k-1;i ++ {
		fmt.Print(row[i].Idx," ")
	}
	fmt.Print(row[k -1 ].Idx,"\n")
	for i := 0;i < l-1;i ++ {
		fmt.Print(col[i].Idx," ")
	}
	fmt.Print(col[l -1 ].Idx,"\n")

}

func next_per(){
	var n int
	var m int
	fmt.Scan(&n,&m)
	a :=make([]int, n)
	for i:=0;i <n;i++{
		fmt.Scan(&a[i])
	}
	for ;m > 0;m--{
		i := 0
		for i = n-2;i >=0;i --{
			if a[i] < a[i + 1]{
				break
			}

		}
		//t := a[i+1]
		j := 0
		for j = i + 1;j < n;j ++{
			if a[j] <= a[i]{
					break
			}
		}
		a[i],a[j-1] = a[j-1],a[i]
		sort.Ints(a[i + 1:])

	}
	fmt.Println(a)

}
var s string
var n,ans,length,carry int
//var ans int
//var length int
//var carry int
//func max(x,y int)int{
//	if x > y{
//		return x
//	}
//	return y
//}
func maxf(x, y int)int{
	if x > y {
		return x
	}
	return y
}
func get(k int)int{
	var x int
	var t int = 1
	i := k
	for ;i  >= 0; i -- {
		if x + maxf(int(1), (int)(s[i]-'0')) * int(t) >=n{
			break
		}
		x += int(s[i]-'0') * t
		t *= 10
	}
	for ;s[i+ 1] == '0'&& i < k-1;i ++{

	}
	ans += x * carry
	return i
}
func qq(){

	carry = 1
	fmt.Scan(&n, &s)
	i := len(s) - 1
	for ;i >=0;{
		i = get(i)
		carry *=n
	}
	fmt.Println( ans)

}

func main(){
	//a := [][]int{{28,4,-19,18,-7,-10,27,19,1,16,0,10,-17,11,11,27,-1,10,12,-1},
	//	{-2,-19,17,4,25,-20,4,3,4,28,-10,7,16,-14,-3,-19,6,17,-4,-7},
	//	{2,8,18,-17,-2,10,-6,-5,11,10,22,-6,19,-16,6,-4,18,5,22,-17},
	//	{-14,-7,-20,13,-19,-20,-15,21,-11,-10,-8,-9,10,13,6,-10,15,9,-15,-2},
	//	{-18,26,12,8,2,16,-17,12,0,-5,9,-3,-12,-11,3,-6,-18,16,-7,-14},
	//	{5,29,25,22,11,-3,-2,-15,4,13,-17,-2,0,-2,20,10,-18,6,25,-20},
	//	{5,-7,8,5,15,22,8,-5,22,-18,-5,-14,23,2,-8,12,-16,-18,12,-12},
	//	{27,18,4,11,-3,12,-4,-8,-3,25,-9,24,-14,5,11,-9,-17,0,25,-15},
	//	{26,-7,18,4,4,18,-17,9,-19,-9,-19,-8,-4,-13,10,-11,6,-16,-12,12},
	//	{28,22,7,11,-6,13,8,22,7,-14,17,14,10,29,16,9,-3,18,-9,10},
	//	{27,19,-10,-9,1,3,14,1,7,3,-3,16,-2,9,14,-7,-19,-5,23,19},
	//	{-17,7,-20,8,-5,-6,-2,25,29,16,23,4,4,27,16,17,9,20,-6,22},
	//	{2,9,-13,1,-18,25,4,7,25,26,-4,8,-19,18,6,-7,-5,7,21,-8},
	//	{-2,11,1,29,6,-16,-8,3,7,11,10,-2,-1,-20,20,4,19,5,29,-7},
	//	{29,-12,-3,17,6,19,23,12,-19,13,19,5,27,22,-17,27,10,-12,12,23},
	//	{24,16,4,25,15,13,24,-19,1,-7,-19,13,-13,14,13,26,9,18,-9,-18},
	//	{-17,4,-18,-18,-19,3,-13,12,23,-17,-10,-20,14,2,18,21,-12,27,-3,4},
	//	{27,13,12,14,16,-9,-2,-15,-20,8,-2,24,18,15,26,21,27,17,-15,-3},
	//	{25,-8,17,-10,-16,13,26,-11,-15,6,-5,-13,23,2,24,-4,5,8,-15,-1},
	//	{15,-12,18,5,-3,7,5,11,-4,-13,28,20,0,-4,-13,-5,-13,-8,-16,3}}

	//log.Println(find_last_le_idx(a, 3))
	//log.Println(q(a, -123))

	//aa := []int{2,3,1,3,4,6,1,2}
	//mm(aa, 1)
	//ini()
//inii()
	//next_per()
	qq()
}

package main

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

func solve() {
	n := readInt64()
	k := readString()
	values := make([]int, 0)
	for len(k) > 0 {
		var maxValue int
		var maxIndex int
		for i := len(k) - 1; i >= 0; i-- {
			value, err := strconv.ParseInt(k[i:], 10, 32)
			if err == nil {
				if value <= n {
					maxValue = int(value)
					maxIndex = i
				}
			} else {
				panic(err)
			}
		}
		if maxIndex+1 < len(k) {
			for maxIndex < len(k) && k[maxIndex] == '0' {
				maxIndex++
			}
		}
		k = k[:maxIndex]
		values = append(values, maxValue)
	}
	var res int64
	for i := len(values) - 1; i >= 0; i-- {
		res *= n
		res += int64(values[i])
	}
	fmt.Println(res)
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

package main

import (
	"fmt"
	"log"
	"sort"
)

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func find_last_le_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] <= target{
			s = mid + 1
		}else {
			e = mid
		}
	}
	return s - 1
}

func find_first_ge_idx(a []int, target int )int {
	//if not exist rturn -1

	s := 0
	e := len(a)
	for ;s < e;{
		mid := s +(e- s)/2
		if a[mid ] < target{
			s = mid + 1
		}else {
			e = mid
		}
	}

	return s
}

func maxSumSubmatrix(a [][]int, target int) int {
	row := len(a)
	if row == 0{
		return 0
	}
	col := len(a[0])

	pre_sum := make([][]int, row)
	for i := range pre_sum{
		pre_sum[i] = make([]int ,col)
	}

	for i := 0;i < row; i ++{
		for j :=0;j < col; j ++{
			if j == 0 {
				pre_sum[i][j] = a[i][j]
			}else {
				pre_sum[i][j] = pre_sum[i][j-1] + a[i][j]
			}
		}
	}

	near := -100000000
	for i := 0; i < col ; i ++{
		for j :=i ;j <col; j ++{
			tmp := []int {0}
			cur := 0
			for k := 0;k < row; k++{

				if i == j {
					cur += a[k][i]
				}else if i == 0{
					cur += pre_sum[k][j]
				}else {
					cur += pre_sum[k][j] - pre_sum[k][i-1]
				}
				idx := find_first_ge_idx(tmp, cur  - target)
				if idx != len(tmp){
					near = max(near, cur -tmp[idx] )
				}
				iid := find_first_ge_idx(tmp, cur )
				q := tmp[iid:]
				tmp = append(tmp[:iid], cur)
				tmp = append(tmp ,q...)

				//if k == 0{
				//	if cur ==target || (cur < target&& cur > near) {
				//		near = cur
				//	}
				//	tmp = append(tmp, cur)
				//}
			}

		}
	}
	return near
}

func q(matrix [][]int, k int) int {
	row := len(matrix)
	col := len(matrix[0])
	near := -1000000
	for left := 0; left < col ; left ++{
	// 以left为左边界，每行的总和
		_sum :=make([]int, row)
	//for right in range(left, col):
		for right :=left ;right <col; right ++ {

			for j := 0; j < row; j++ {
				_sum[j] += matrix[j][right]
			}
			// 在left，right为边界下的矩阵，求不超过K的最大数值和
			tmp := []int{0}
			cur := 0
			for _, tmpp := range _sum {
				cur += tmpp

				//# 二分法
				idx := find_first_ge_idx(tmp, cur-k)
				if idx != len(tmp) {
					near = max(near, cur-tmp[idx])
				}
				iid := find_first_ge_idx(tmp, cur)
				q := []int{}

				q= append(q, tmp[iid:]...)
				ee := []int{}
				ee = append(ee,tmp[:iid]...)
				ee = append(ee, cur)
				tmp = append(ee, q...)
			}
		}
		}

	return near
}

func qeqw(a int, aa int) int{

	caa := "asas"
	log.Println(caa)
	return 23
}

func m(a []int, b[]int){
	 //q := map[[2]int]bool{}

}
var ori [1000001]int
var record [1000001]int

var energy [1000001]int
var counter [1000001]int

//}
func p(){
	var n int
	var k int
	var target int
	//var n,k int
	fmt.Scan(&n)
	fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&record[i])
	}
	idx := -1
	left := 0
	min_l := 1000000000
	m_l := 0
	m_r := 0
	for ;left < n &&idx < n;{
		if target == k {
			//if counter[record[left]] > 1 {
			if idx - left +1 < min_l{
				min_l = idx - left + 1
				m_l = left
				m_r = idx
			}
			counter[record[left]] --

			//}else {
			//
			//}
			if counter[record[left]] == 0 {
				target --
			}
			left ++
		}else{
				idx ++
			counter[record[idx]] ++
			if counter[record[idx]] == 1{
				target ++
			}
			//idx++
		}
	}
	fmt.Println(m_l + 1, m_r + 1)
}

func ini(){
	var n int
	//var k int
	fmt.Scan(&n)
	//fmt.Scan(&k)
	for i := 0;i < n; i ++{
		fmt.Scan(&ori[i])
		fmt.Scan(&energy[i])
	}
	R := -1
	L := 0
	for i :=0; i < n; i ++{
		//if record[L] == i - k{
		//	L ++
		//}
		for ;R >= L &&ori[i] >ori[record[R]];R--{
			counter[i]	+= energy[record[R]]
		}
		tmp := energy[i]
		for ;R >= L &&ori[i] ==ori[record[R]];R--{
			tmp += energy[i]
		}
		R ++
		record[R] = i
		if R != 0  {
			counter[record[R - 1]] += tmp
		}
	}
	m := -1
	for i :=0; i <n;i ++{
		if counter[i] > m{
			m = counter[i]
		}
	}
	fmt.Println(m)
}
type S struct {
	Idx int
	Time int

}
type intSlice []S

func (p intSlice) Len() int           { return len(p) }
func (p intSlice) Less(i, j int) bool { return p[i].Time > p[j].Time }
func (p intSlice) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

var roww [1000]int
var coll [1000]int
func inii(){
	var m,n,k,l,d int
	//var k int
	row := make(intSlice, 10000)
	col := make(intSlice, 10000)
	fmt.Scan(&m, &n, &k, &l,&d)
	//fmt.Scan(&k)
	for i := 0;i < d; i ++{
		var x1,y1,x2,y2 int
		fmt.Scan(&x1,&y1,&x2,&y2)
		if x1 == x2 {
			if y1 > y2 {
				y1,y2 = y2,y1
			}
			col[y1].Idx = y1
			col[y1].Time ++
		}else{
				if x1 > x2{
					x1,x2 = x2,x1
				}
				row[x1].Idx = x1
			row[x1].Time ++
		}
		//fmt.Scan(&energy[i])
	}
	//row = row[:m+1]
	//col = col[:n + 1]
	sort.Sort(row)
	sort.Sort(col)
	row = row[:k+1]
	col = col[:l + 1]
	sort.Sort(row)
	sort.Sort(col)
	for i := 0;i < k-1;i ++ {
		fmt.Print(row[i].Idx," ")
	}
	fmt.Print(row[k -1 ].Idx,"\n")
	for i := 0;i < l-1;i ++ {
		fmt.Print(col[i].Idx," ")
	}
	fmt.Print(col[l -1 ].Idx,"\n")

}

func next_per(){
	var n int
	var m int
	fmt.Scan(&n,&m)
	a :=make([]int, n)
	for i:=0;i <n;i++{
		fmt.Scan(&a[i])
	}
	for ;m > 0;m--{
		i := 0
		for i = n-2;i >=0;i --{
			if a[i] < a[i + 1]{
				break
			}

		}
		//t := a[i+1]
		j := 0
		for j = i + 1;j < n;j ++{
			if a[j] <= a[i]{
					break
			}
		}
		a[i],a[j-1] = a[j-1],a[i]
		sort.Ints(a[i + 1:])

	}
	fmt.Println(a)

}
var s string
var n,ans,length,carry float64
//var ans int
//var length int
//var carry int
//func max(x,y int)int{
//	if x > y{
//		return x
//	}
//	return y
//}
func maxf(x, y float64)float64{
	if x > y {
		return x
	}
	return y
}
func get(k int)int{
	var x float64
	var t float64 = 1
	i := k
	for ;i  >= 0; i -- {
		if x + maxf(float64(1), (float64)(s[i]-'0')) * float64(t) >=n{
			break
		}
		x += float64(s[i]-'0') * t
		t *= 10
	}
	for ;s[i+ 1] == '0'&& i < k-1;i ++{

	}
	ans += x * carry
	return i
}
func qq(){

	carry = 1
	fmt.Scan(&n, &s)
	i := len(s) - 1
	for ;i >=0;{
		i = get(i)
		carry *=n
	}
	fmt.Println(ans)

}

func main(){
	//a := [][]int{{28,4,-19,18,-7,-10,27,19,1,16,0,10,-17,11,11,27,-1,10,12,-1},
	//	{-2,-19,17,4,25,-20,4,3,4,28,-10,7,16,-14,-3,-19,6,17,-4,-7},
	//	{2,8,18,-17,-2,10,-6,-5,11,10,22,-6,19,-16,6,-4,18,5,22,-17},
	//	{-14,-7,-20,13,-19,-20,-15,21,-11,-10,-8,-9,10,13,6,-10,15,9,-15,-2},
	//	{-18,26,12,8,2,16,-17,12,0,-5,9,-3,-12,-11,3,-6,-18,16,-7,-14},
	//	{5,29,25,22,11,-3,-2,-15,4,13,-17,-2,0,-2,20,10,-18,6,25,-20},
	//	{5,-7,8,5,15,22,8,-5,22,-18,-5,-14,23,2,-8,12,-16,-18,12,-12},
	//	{27,18,4,11,-3,12,-4,-8,-3,25,-9,24,-14,5,11,-9,-17,0,25,-15},
	//	{26,-7,18,4,4,18,-17,9,-19,-9,-19,-8,-4,-13,10,-11,6,-16,-12,12},
	//	{28,22,7,11,-6,13,8,22,7,-14,17,14,10,29,16,9,-3,18,-9,10},
	//	{27,19,-10,-9,1,3,14,1,7,3,-3,16,-2,9,14,-7,-19,-5,23,19},
	//	{-17,7,-20,8,-5,-6,-2,25,29,16,23,4,4,27,16,17,9,20,-6,22},
	//	{2,9,-13,1,-18,25,4,7,25,26,-4,8,-19,18,6,-7,-5,7,21,-8},
	//	{-2,11,1,29,6,-16,-8,3,7,11,10,-2,-1,-20,20,4,19,5,29,-7},
	//	{29,-12,-3,17,6,19,23,12,-19,13,19,5,27,22,-17,27,10,-12,12,23},
	//	{24,16,4,25,15,13,24,-19,1,-7,-19,13,-13,14,13,26,9,18,-9,-18},
	//	{-17,4,-18,-18,-19,3,-13,12,23,-17,-10,-20,14,2,18,21,-12,27,-3,4},
	//	{27,13,12,14,16,-9,-2,-15,-20,8,-2,24,18,15,26,21,27,17,-15,-3},
	//	{25,-8,17,-10,-16,13,26,-11,-15,6,-5,-13,23,2,24,-4,5,8,-15,-1},
	//	{15,-12,18,5,-3,7,5,11,-4,-13,28,20,0,-4,-13,-5,-13,-8,-16,3}}

	//log.Println(find_last_le_idx(a, 3))
	//log.Println(q(a, -123))

	//aa := []int{2,3,1,3,4,6,1,2}
	//mm(aa, 1)
	//ini()
//inii()
	//next_per()
	qq()
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var k int
	fmt.Scanf("%d", &k)
	rows := []int{0,0,0,0}
	if k <= 4 {
		for i := 0; i < k; i++ {
			rows[i] = 1
		}
	} else {
		rows[2] = 1
		q := (k - 4) / 3
		r := (k - 4) % 3
		rows[0], rows[1], rows[3] = q + 1, q + 1, q + 1
		if r >= 1 {
			rows[0]++
		}
		if r >= 2 {
			rows[1]++
		}
	}
	fmt.Println("+------------------------+")
	fmt.Printf("|%s%s|D|)\n", strings.Repeat("O.", rows[0]), strings.Repeat("#.", 11 - rows[0]))
	fmt.Printf("|%s%s|.|\n", strings.Repeat("O.", rows[1]), strings.Repeat("#.", 11 - rows[1]))
	if rows[2] > 0 {
		fmt.Printf("|%s%s..|\n", strings.Repeat("O.", rows[2]), strings.Repeat("..", 11 - rows[2]))
	} else {
		fmt.Printf("|%s%s..|\n", strings.Repeat("#.", 1), strings.Repeat("..", 10))
	}
	fmt.Printf("|%s%s|.|)\n", strings.Repeat("O.", rows[3]), strings.Repeat("#.", 11 - rows[3]))
	fmt.Println("+------------------------+")
}

package main

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

var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func ReadInt32() int {
    scanner.Scan()
    ans, _ := strconv.Atoi(scanner.Text())
    return ans
}

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

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

    n := ReadInt32()
    s := make([]string, 4)

    s[1] = "|#.#.#.#.#.#.#.#.#.#.#.|D|)\n"
    s[2] = "|#.#.#.#.#.#.#.#.#.#.#.|.|\n"
    s[0] = "|#.#.#.#.#.#.#.#.#.#.#.|.|)\n"

    if n >= 3 {
        s[3] = "|O.......................|\n"
        n--
    } else {
        s[3] = "|#.......................|\n"
    }

    for i := 1; i <= n; i++ {
        s[i%3] = strings.Replace(s[i%3], "#", "O", 1)
    }

    writer.WriteString("+------------------------+\n")
    writer.WriteString(s[1])
    writer.WriteString(s[2])
    writer.WriteString(s[3])
    writer.WriteString(s[0])
    writer.WriteString("+------------------------+\n")
}