@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalUnsignedTypes::class, ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
//        print("Case #$case: ")

        val n = readInt()
        val C = readIntArray(26)

        val D = IntModIntMap()

        for(l in 0..2) for(m in 0..2) {
            val j = (l == 0).toInt() + (m == 0).toInt()
            val k = (l == 1).toInt() + (m == 1).toInt()

            var d = ModInt(1)
            if(l == 2) d *= 24
            if(m == 2) d *= 24

            D[id(2, j, k, l, m)] = d
        }

        for(i in 2 until n) for(j in 0..i) for(k in 0..i-j) for(l in 0..2) for(m in 0..2) {
            val d = D[id(i, j, k, l, m)]
            if(d.int == 0) continue
            for(p in 0..2) {
                val dn = if(p == 2) {
                    if(l == 2) d*23 else d*24
                } else {
                    if(p == l) continue else d
                }

                val jn = j + (p == 0).toInt()
                val kn = k + (p == 1).toInt()
                D[id(i+1, jn, kn, m, p)] += dn
            }
        }

        val S = Array(n+2) { ModIntArray(n+2) }

        for(j in 0..n) for(k in 0..n) {
            S[j+1][k+1] = S[j+1][k] + S[j][k+1] - S[j][k]
            for(l in 0..2) for(m in 0..2) S[j+1][k+1] += D[id(n, j, k, l, m)]
        }

        val s = S[n+1][n+1]
        var ans = s

        for(i in 0 until 25) for(j in i+1 until 26) {
            ans -= s - (S[C[i]+1][C[j]+1])
        }

        println(ans.int)
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

fun Boolean.toInt() = if(this) 1 else 0

fun id(i: Int, j: Int, k: Int, l: Int, m: Int) = i
    .shl(9).or(j)
    .shl(9).or(k)
    .shl(2).or(l)
    .shl(2).or(m)

typealias IntModIntMap = _Ez_Int__ModInt_HashMap
inline operator fun IntModIntMap.set(key: Int, value: ModInt) { put(key, value) }
inline operator fun IntModIntMap.contains(key: Int) = containsKey(key)

class _Ez_Int__ModInt_HashMap(capacity: Int = DEFAULT_CAPACITY, val nullValue: ModInt = ModInt(0)) :
    _Ez_Int__ModInt_Map {
    companion object {
        private const val DEFAULT_CAPACITY = 8
        // There are three invariants for size, removedCount and arraysLength:
// 1. size + removedCount <= 1/2 arraysLength
// 2. size > 1/8 arraysLength
// 3. size >= removedCount
// arraysLength can be only multiplied by 2 and divided by 2.
// Also, if it becomes >= 32, it can't become less anymore.
        private const val REBUILD_LENGTH_THRESHOLD = 32
        private const val HASHCODE_INITIAL_VALUE = -0x7ee3623b
        private const val HASHCODE_MULTIPLIER = 0x01000193
        private const val FREE: Byte = 0
        private const val REMOVED: Byte = 1
        private const val FILLED: Byte = 2
        private val hashSeed = random.nextInt()
        private val gamma = random.nextInt() or 1
    }

    private lateinit   var keys: IntArray
    private lateinit   var _values: IntArray
    private var values get() = ModIntArray(_values); set(value) { _values = value.intArray }
    private lateinit var status: ByteArray
    override var size = 0
        private set
    private var removedCount = 0
    private var mask = 0

    constructor(map: _Ez_Int__ModInt_Map) : this(map.size) {
        val it = map.iterator()
        while (it.hasNext()) {
            put(it.key, it.value)
            it.next()
        }
    }

    constructor(javaMap: Map<Int, ModInt>) : this(javaMap.size) {
        for ((key, value) in javaMap) {
            put(key, value)
        }
    }

    private fun getStartPos(h: Int): Int {
        var x = (h xor hashSeed) * gamma
        x = (x xor (x ushr 16)) * 0x7feb352d
        x = (x xor (x ushr 15)) * 0x846ca68b.toInt()
        return (x xor (x ushr 16)) and mask
    }

    override fun isEmpty(): Boolean = size == 0

    override fun containsKey(
        key: Int
    ): Boolean {
        var pos = getStartPos(key)
        while (status[pos] != FREE) {
            if (status[pos] == FILLED && keys[pos] == key) {
                return true
            }
            pos = pos + 1 and mask
        }
        return false
    }

    override fun  get(
        key: Int
    ): ModInt {
        var pos = getStartPos(key)
        while (status[pos] != FREE) {
            if (status[pos] == FILLED && keys[pos] == key) {
                return values[pos]
            }
            pos = pos + 1 and mask
        }
        return nullValue
    }

    override fun  put(
        key: Int,
        value: ModInt
    ): ModInt {
        var pos = getStartPos(key)
        while (status[pos] == FILLED) {
            if (keys[pos] == key) {
                val   oldValue = values[pos]
                values[pos] = value
                return oldValue
            }
            pos = pos + 1 and mask
        }
        if (status[pos] == FREE) {
            status[pos] = FILLED
            keys[pos] = key
            values[pos] = value
            size++
            if ((size + removedCount) * 2 > keys.size) {
                rebuild(keys.size * 2) // enlarge the table
            }
            return nullValue
        }
        val removedPos = pos
        pos = pos + 1 and mask
        while (status[pos] != FREE) {
            if (status[pos] == FILLED && keys[pos] == key) {
                val   oldValue = values[pos]
                values[pos] = value
                return oldValue
            }
            pos = pos + 1 and mask
        }
        status[removedPos] = FILLED
        keys[removedPos] = key
        values[removedPos] = value
        size++
        removedCount--
        return nullValue
    }

    override fun  remove(
        key: Int
    ): ModInt {
        var pos = getStartPos(key)
        while (status[pos] != FREE) {
            if (status[pos] == FILLED && keys[pos] == key) {
                val   removedValue = values[pos]
                status[pos] = REMOVED
                size--
                removedCount++
                if (keys.size > REBUILD_LENGTH_THRESHOLD) {
                    if (8 * size <= keys.size) {
                        rebuild(keys.size / 2) // compress the table
                    } else if (size < removedCount) {
                        rebuild(keys.size) // just rebuild the table
                    }
                }
                return removedValue
            }
            pos = pos + 1 and mask
        }
        return nullValue
    }

    override fun clear() {
        if (keys.size > REBUILD_LENGTH_THRESHOLD) {
            initEmptyTable(REBUILD_LENGTH_THRESHOLD)
        } else {
            status.fill(FREE)
            size = 0
            removedCount = 0
        }
    }

    override fun keys(): IntArray {
        val result = IntArray(size)
        var i = 0
        var j = 0
        while (i < keys.size) {
            if (status[i] == FILLED) {
                result[j++] = keys[i]
            }
            i++
        }
        return result
    }

    override fun values(): ModIntArray {
        val result = ModIntArray(size)
        var i = 0
        var j = 0
        while (i < values.size) {
            if (status[i] == FILLED) {
                result[j++] = values[i]
            }
            i++
        }
        return result
    }

    override fun iterator(): _Ez_Int__ModInt_MapIterator {
        return _Ez_Int__ModInt_HashMapIterator()
    }

    private fun rebuild(newLength: Int) {
        val oldKeys = keys

        val oldValues = values
        val oldStatus = status
        initEmptyTable(newLength)
        for (i in oldKeys.indices) {
            if (oldStatus[i] == FILLED) {
                put(oldKeys[i], oldValues[i])
            }
        }
    }

    private fun initEmptyTable(length: Int) {
        keys = IntArray(length)
        values = ModIntArray(length)
        status = ByteArray(length)
        size = 0
        removedCount = 0
        mask = length - 1
    }

    fun contentEquals(that: _Ez_Int__ModInt_HashMap): Boolean {
        if (size != that.size) {
            return false
        }
        for (i in keys.indices) {
            if (status[i] == FILLED) {
                val   thatValue = that[keys[i]]
                if (thatValue != values[i]) {
                    return false
                }
            }
        }
        return true
    }

    override fun toString(): String {
        val sb = StringBuilder()
        sb.append('{')
        for (i in keys.indices) {
            if (status[i] == FILLED) {
                if (sb.length > 1) {
                    sb.append(", ")
                }
                sb.append(keys[i])
                sb.append('=')
                sb.append(values[i])
            }
        }
        sb.append('}')
        return sb.toString()
    }

    private inner class _Ez_Int__ModInt_HashMapIterator : _Ez_Int__ModInt_MapIterator {
        private var curIndex = 0
        override fun hasNext(): Boolean {
            return curIndex < status.size
        }

        override val key: Int

            get() {
                if (curIndex == keys.size) {
                    throw NoSuchElementException("Iterator doesn't have more entries")
                }
                return keys[curIndex]
            }

        override val value: ModInt

            get() {
                if (curIndex == values.size) {
                    throw NoSuchElementException("Iterator doesn't have more entries")
                }
                return values[curIndex]
            }

        override fun next() {
            if (curIndex == status.size) {
                return
            }
            curIndex++
            while (curIndex < status.size && status[curIndex] != FILLED) {
                curIndex++
            }
        }

        init {
            while (curIndex < status.size && status[curIndex] != FILLED) {
                curIndex++
            }
        }
    }

    init {
        require(capacity >= 0) { "Capacity must be non-negative" }
        val length = Integer.highestOneBit(4 * max(1, capacity) - 1)
        // Length is a power of 2 now
        initEmptyTable(length)
    }
}

interface _Ez_Int__ModInt_Map {

    val size: Int

    fun isEmpty(): Boolean

    fun containsKey(
        key: Int
    ): Boolean

    operator fun  get(
        key: Int
    ): ModInt

    fun  put(
        key: Int,
        value: ModInt
    ): ModInt

    fun  remove(
        key: Int
    ): ModInt

    fun clear()

    fun keys(): IntArray

    fun values(): ModIntArray

    operator fun iterator(): _Ez_Int__ModInt_MapIterator

    override fun toString(): String
}

interface _Ez_Int__ModInt_MapIterator {
    operator fun hasNext(): Boolean

    val key: Int

    val value: ModInt

    operator fun next()
}

inline fun IntModIntMap.forEach(act: (key: Int, value: ModInt) -> Unit) {
    val ite = iterator()
    while(ite.hasNext()) {
        act(ite.key, ite.value)
        ite.next()
    }
}

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.modulo(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Int) = modulo(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other modulo mod

fun Int.powMod(exponent: Long, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    if(mod == 1) return 0
    var res = 1L
    var e = exponent
    var b = modulo(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1L) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}
fun Int.powMod(exponent: Int, mod: Int) = powMod(exponent.toLong(), mod)
fun Int.modPowArray(n: Int, mod: Int): IntArray {
    val res = IntArray(n+1)
    res[0] = 1
    for(i in 1..n) res[i] = mulMod(res[i-1], mod)
    return res
}

inline fun Int.toModInt() = ModInt(this modulo MOD)
inline fun Long.toModInt() = ModInt(this modulo MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent modulo TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent modulo TOTIENT)

    inline fun inverse() = inv_unmemoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int) = ModIntArray(int.modPowArray(n, MOD))

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun ModIntArray.joinToString(separator: CharSequence) = intArray.joinToString(separator)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
inline fun <R> ModIntArray.foldRight(init: R, op: (ModInt, acc: R) -> R) = intArray.foldRight(init) { i, acc -> op(ModInt(i), acc) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Array<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")
@file:OptIn(ExperimentalUnsignedTypes::class, ExperimentalStdlibApi::class)

import java.io.PrintWriter
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
//    val startTime = System.nanoTime()

    val numCases = 1//readInt()
    case@ for(case in 1..numCases) {
//        print("Case #$case: ")

        val n = readInt()
        val C = readIntArray(26)

        fun id(i: Int, j: Int, k: Int, l: Int, m: Int) = i
                .times(n+1).plus(j)
                .times(n+1).plus(k)
                .times(3).plus(l)
                .times(3).plus(m)

        val D = ModIntArray(id(n, n, n, 2, 2)+1)

        for(l in 0..2) for(m in 0..2) {
            val j = (l == 0).toInt() + (m == 0).toInt()
            val k = (l == 1).toInt() + (m == 1).toInt()

            var d = ModInt(1)
            if(l == 2) d *= 24
            if(m == 2) d *= 24

            D[id(2, j, k, l, m)] = d
        }

        for(i in 2 until n) for(j in 0..i) for(k in 0..i-j) for(l in 0..2) for(m in 0..2) {
            val d = D[id(i, j, k, l, m)]
            if(d.int == 0) continue
            for(p in 0..2) {
                val dn = if(p == 2) {
                    if(l == 2) d*23 else d*24
                } else {
                    if(p == l) continue else d
                }

                val jn = j + (p == 0).toInt()
                val kn = k + (p == 1).toInt()
                D[id(i+1, jn, kn, m, p)] += dn
            }
        }

        val S = Array(n+2) { ModIntArray(n+2) }

        for(j in 0..n) for(k in 0..n) {
            S[j+1][k+1] = S[j+1][k] + S[j][k+1] - S[j][k]
            for(l in 0..2) for(m in 0..2) S[j+1][k+1] += D[id(n, j, k, l, m)]
        }

        val s = S[n+1][n+1]
        var ans = s

        for(i in 0 until 25) for(j in i+1 until 26) {
            ans -= s - (S[C[i]+1][C[j]+1])
        }

        println(ans.int)
    }

//    iprintln("Time: ${(System.nanoTime() - startTime) / 1000000} ms")
}

fun Boolean.toInt() = if(this) 1 else 0

const val MOD = 998244353
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.modulo(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.modulo(mod: Int) = modulo(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other modulo mod

fun Int.powMod(exponent: Long, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    if(mod == 1) return 0
    var res = 1L
    var e = exponent
    var b = modulo(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1L) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}
fun Int.powMod(exponent: Int, mod: Int) = powMod(exponent.toLong(), mod)
fun Int.modPowArray(n: Int, mod: Int): IntArray {
    val res = IntArray(n+1)
    res[0] = 1
    for(i in 1..n) res[i] = mulMod(res[i-1], mod)
    return res
}

inline fun Int.toModInt() = ModInt(this modulo MOD)
inline fun Long.toModInt() = ModInt(this modulo MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent modulo TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent modulo TOTIENT)

    inline fun inverse() = inv_unmemoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

fun ModInt.powArray(n: Int) = ModIntArray(int.modPowArray(n, MOD))

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun ModIntArray.joinToString(separator: CharSequence) = intArray.joinToString(separator)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
inline fun <R> ModIntArray.foldRight(init: R, op: (ModInt, acc: R) -> R) = intArray.foldRight(init) { i, acc -> op(ModInt(i), acc) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Array<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Array<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO */
//@JvmField val ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null
//const val PATH = "src/main/resources/"
//@JvmField val INPUT = File(PATH + "input.txt").inputStream()
//@JvmField val OUTPUT = File(PATH + "output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

const val _BUFFER_SIZE = 1 shl 16
@JvmField val _buffer = ByteArray(_BUFFER_SIZE)
@JvmField var _bufferPt = 0
@JvmField var _bytesRead = 0

tailrec fun readChar(): Char {
    if(_bufferPt == _bytesRead) {
        _bufferPt = 0
        _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)
    }
    return if(_bytesRead < 0) Char.MIN_VALUE
    else {
        val c = _buffer[_bufferPt++].toChar()
        if (c == '\r') readChar() else c
    }
}

/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */
fun readCharArray(n: Int, skipNext: Boolean = true): CharArray {
    val res = CharArray(n) { readChar() }
    if(skipNext) readChar()
    return res
}

fun readLine(): String? {
    var c = readChar()
    return if(c == Char.MIN_VALUE) null
    else buildString {
        while(c != '\n' && c != Char.MIN_VALUE) {
            append(c)
            c = readChar()
        }
    }
}
fun readLn() = readLine()!!

fun read() = buildString {
    var c = readChar()
    while(c <= ' ') {
        if(c == Char.MIN_VALUE) return@buildString
        c = readChar()
    }
    do {
        append(c)
        c = readChar()
    } while(c > ' ')
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/**  sort overrides to avoid quicksort attacks */

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

inline fun <A, T> _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {
    var a = a0
    var tmp = tmp0
    var len = 1
    while(len < n) {
        var l = 0
        while(true) {
            val m = l + len
            if(m >= n) break
            val r = min(n, m + len)
            var i = l
            var j = m
            for(k in l until r) {
                if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {
                    tmp.set(k, a.get(i++))
                } else tmp.set(k, a.get(j++))
            }
            l = r
        }
        for(i in l until n) tmp.set(i, a.get(i))
        val t = a; a = tmp; tmp = t
        len += len
    }
    if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))
}

inline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }
inline fun <T: Comparable<T>> IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun IntArray.sort() { sortBy { it } }
fun IntArray.sortDescending() { sortByDescending { it } }

inline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }
inline fun <T: Comparable<T>> LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun LongArray.sort() { sortBy { it } }
fun LongArray.sortDescending() { sortByDescending { it } }

inline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }
inline fun <T: Comparable<T>> DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }
inline fun <T: Comparable<T>> DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }
fun DoubleArray.sort() { sortBy { it } }
fun DoubleArray.sortDescending() { sortByDescending { it } }

inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T : Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T : Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T : Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T : Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

// import preserving junk function
@Suppress("NonAsciiCharacters") fun 雪花飄飄北風嘯嘯天地一片蒼茫() { iprintln(max(1, 2)) }

fun IntArray.sumLong() = sumOf { it.toLong() }

fun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> Array<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }
fun <T: Comparable<T>> List<T>.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }
fun <T: Comparable<T>> List<T>.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }

// max/min Kotlin 1.6 -> 1.4 shim
fun IntArray.max() = maxOf { it }
fun IntArray.min() = minOf { it }
fun LongArray.max() = maxOf { it }
fun LongArray.min() = minOf { it }
fun CharArray.max() = maxOf { it }
fun CharArray.min() = minOf { it }
fun <T : Comparable<T>> Iterable<T>.max() = maxOf { it }
fun <T : Comparable<T>> Iterable<T>.min() = minOf { it }
fun <T : Comparable<T>> Sequence<T>.max() = maxOf { it }
fun <T : Comparable<T>> Sequence<T>.min() = minOf { it }


fun main() {
    fun readLong() = readLine()!!.toLong()
    val n = readLong()
    print( 1 + n * (n + 1) * 3) // (n * (n + 1) / 2) * 6 == n * (n + 1) * 3
}


fun main(args: Array<String>) {
    val (n) = readLine()!!.split(' ').map(String::toLong)
    println((3*n*n)+(3*n)+1)
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val num = r.readLine()!!.toInt()
    //var (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    val m = r.readLine()!!.split(" ").map { it.toInt() }
    val n = r.readLine()!!.split(" ").map { it.toInt() }
    val c1 = m.subList(1, m[0]+1).toMutableList()
    val c2 = n.subList(1, n[0]+1).toMutableList()
    val hash = mutableSetOf<Int>()
    var ans = 0
    while (c1.size!=0&&c2.size!=0){
        ans ++
        when{
            c1[0]>c2[0] -> {
                c1 += c2[0]
                c1 += c1[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
            c1[0]<c2[0] -> {
                c2 += c1[0]
                c2 += c2[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
        }
        if ((c1+c2).hashCode() !in hash) {
            hash += (c1+c2).hashCode()
        } else {
            ans = -1
            break
        }
    }
    val win = if (c1.size==0) 2 else 1
    println(if (ans==-1) -1 else "$ans $win")
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val num = r.readLine()!!.toInt()
    //var (n, m) = r.readLine()!!.split(" ").map { it.toInt() }
    val m = r.readLine()!!.split(" ").map { it.toInt() }
    val n = r.readLine()!!.split(" ").map { it.toInt() }
    val c1 = m.subList(1, m[0]+1).toMutableList()
    val c2 = n.subList(1, n[0]+1).toMutableList()
    val hash = mutableSetOf((c1+c2).hashCode())
    var ans = 0
    while (c1.size!=0&&c2.size!=0){
        ans ++
        when{
            c1[0]>c2[0] -> {
                c1 += c2[0]
                c1 += c1[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
            c1[0]<c2[0] -> {
                c2 += c1[0]
                c2 += c2[0]
                c1.removeAt(0)
                c2.removeAt(0)
            }
        }
        if ((c1+c2).hashCode() !in hash) {
            hash += (c1+c2).hashCode()
        } else {
            ans = -1
            break
        }
    }
    val win = if (c1.size==0) 2 else 1
    println(if (ans==-1) -1 else "$ans $win")
}


fun main() {
    fun readInt() = readLine()!!.toInt()
    fun readLong() = readLine()!!.toLong()
    fun readInts() = readLine()!!.split(" ").map(String::toInt)
    fun readLongs() = readLine()!!.split(" ").map(String::toLong)

    val numCards = readInt()
    val soldier1 = readInts().toMutableList()
    val soldier2 = readInts().toMutableList()
    var pos = 0
    while (++pos < 1000 && pos < soldier1.size && pos < soldier2.size) {
        if (soldier1[pos] > soldier2[pos]) {
            soldier1.add(soldier2[pos])
            soldier1.add(soldier1[pos])
        } else {
            soldier2.add(soldier1[pos])
            soldier2.add(soldier2[pos])
        }
    }
    print(
        when (pos) {
            1000 -> -1
            soldier1.size -> "${pos - 1} 2"
            else -> "${pos - 1} 1"
        }
    )
}


var _debug = false;
fun <T> debug(vararg vals: T): Unit {
    if (!_debug) { return }
    for (v in vals) { System.err.print(v); System.err.print(" ") }
    System.err.println()
}

val MOD = 998_244_353
val MAXN = 5000

//fun getBinomTriangle() : List<List<Long>> {
fun getBinomTriangle() : Array<LongArray> {
    var p = Array(MAXN+1, { LongArray(MAXN+1) })
    //debug("p", p.size)
    p[0][0] = 1
    for (i in 1..MAXN) {
        p[i][0] = 1
        for (j in 1..i) {
            p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MAXN
        }
    }
    return p
}

fun getFactorialTable() : LongArray {
    var ft = LongArray(MAXN+1)
    ft[0] = 1
    for (i in 1..MAXN) {
        ft[i] = ft[i-1] * i
    }
    return ft
}

val btr = getBinomTriangle()
val ft = getFactorialTable()

fun calculateCombinationsOfTwo(x : Int, y : Int) : Long {
    var res = 0L

    for (k in 0..(minOf(x,y))) {
        var summand = ft[k]
        summand = (summand * btr[x][k]) % MOD
        summand = (summand * btr[y][k]) % MOD
        res = (res + summand) % MOD
    }
    //debug("calc", res)
    return res
}

fun main(args: Array<String>) {
    if (args.size > 0 && args[0] == "-d") {
        _debug = true;
    }

    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    val ab = calculateCombinationsOfTwo(a, b)
    val ac = calculateCombinationsOfTwo(a, c)
    val bc = calculateCombinationsOfTwo(b, c)

    println(ab * ac * bc)
}


val MOD = 998244353
val MAXN = 5000

var dp = Array(MAXN+5, { IntArray(MAXN+5) })
fun D(a: Int, b: Int) : Int
{
    if (a == 0 || b == 0) return 1;

    if (dp[a][b] == 0)
    {
        dp[a][b] = ((b.toLong() * D(a - 1, b - 1) + D(a - 1, b)) % MOD).toInt();
    }

    return dp[a][b];
}

fun main(args: Array<String>) {
    if (args.size > 0 && args[0] == "-d") {
        _debug = true;
    }

    val xs = readLine()!!.split(' ').map(String::toInt).sorted()
    val (a, b, c) = xs

    println(((D(a, b).toLong() * D(b, c).toLong()) % MOD * D(a, c).toLong()) % MOD);
}


var _debug = false;
fun <T> debug(vararg vals: T): Unit {
    if (!_debug) { return }
    for (v in vals) { System.err.print(v); System.err.print(" ") }
    System.err.println()
}

val MOD = 998244353
val MAXN = 5000

//fun getBinomTriangle() : List<List<Long>> {
fun getBinomTriangle() : Array<LongArray> {
    var p = Array(MAXN+1, { LongArray(MAXN+1) })
    //debug("p", p.size)
    p[0][0] = 1
    for (i in 1..MAXN) {
        p[i][0] = 1
        for (j in 1..i) {
            p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MAXN
        }
    }
    return p
}

fun getFactorialTable() : LongArray {
    var ft = LongArray(MAXN+1)
    ft[0] = 1
    for (i in 1..MAXN) {
        ft[i] = ft[i-1] * i
    }
    return ft
}

val btr = getBinomTriangle()
val ft = getFactorialTable()

fun calculateCombinationsOfTwo(x : Int, y : Int) : Long {
    var res = 0L

    val the_min = listOf(x,y).min()!!
    for (k in 0..the_min) {
        var summand = ft[k]
        summand = (summand * btr[x][k]) % MOD
        summand = (summand * btr[y][k]) % MOD
        res = (res + summand) % MOD
    }
    //debug("calc", res)
    return res
}

fun main(args: Array<String>) {
    if (args.size > 0 && args[0] == "-d") {
        _debug = true;
    }

    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    val ab = calculateCombinationsOfTwo(a, b)
    val ac = calculateCombinationsOfTwo(a, c)
    val bc = calculateCombinationsOfTwo(b, c)

    println(ab * ac * bc)
}


var _debug = false;
fun <T> debug(vararg vals: T): Unit {
    if (!_debug) { return }
    for (v in vals) { System.err.print(v); System.err.print(" ") }
    System.err.println()
}

val MOD = 998244353
val MAXN = 5000

//fun getBinomTriangle() : List<List<Long>> {
fun getBinomTriangle() : Array<LongArray> {
    var p = Array(MAXN+1, { LongArray(MAXN+1) })
    //debug("p", p.size)
    p[0][0] = 1
    for (i in 1..MAXN) {
        p[i][0] = 1
        for (j in 1..i) {
            p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MOD
        }
    }
    return p
}

fun getFactorialTable() : LongArray {
    var ft = LongArray(MAXN+1)
    ft[0] = 1
    for (i in 1..MAXN) {
        ft[i] = ft[i-1] * i
    }
    return ft
}

val btr = getBinomTriangle()
val ft = getFactorialTable()

fun calculateCombinationsOfTwo(x : Int, y : Int) : Long {
    var res = 0L

    val the_min = listOf(x,y).min()!!
    for (k in 0..the_min) {
        var summand = ft[k]
        summand = (summand * btr[x][k]) % MOD
        summand = (summand * btr[y][k]) % MOD
        res = (res + summand) % MOD
    }
    //debug("calc", res)
    return res
}

fun main(args: Array<String>) {
    if (args.size > 0 && args[0] == "-d") {
        _debug = true;
    }

    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    val ab = calculateCombinationsOfTwo(a, b)
    val ac = calculateCombinationsOfTwo(a, c)
    val bc = calculateCombinationsOfTwo(b, c)

    var res = ab
    res = (res * bc) % MOD
    res = (res * ac) % MOD

    println(res)
}


var _debug = false;
fun <T> debug(vararg vals: T): Unit {
    if (!_debug) { return }
    for (v in vals) { System.err.print(v); System.err.print(" ") }
    System.err.println()
}

val MOD = 998244353
val MAXN = 5000

//fun getBinomTriangle() : List<List<Long>> {
fun getBinomTriangle() : Array<LongArray> {
    var p = Array(MAXN+1, { LongArray(MAXN+1) })
    //debug("p", p.size)
    p[0][0] = 1
    for (i in 1..MAXN) {
        p[i][0] = 1
        for (j in 1..i) {
            p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MOD
        }
    }
    return p
}

fun getFactorialTable() : LongArray {
    var ft = LongArray(MAXN+1)
    ft[0] = 1
    for (i in 1..MAXN) {
        ft[i] = (ft[i-1] * i) % MOD
    }
    return ft
}

val btr = getBinomTriangle()
val ft = getFactorialTable()

fun calculateCombinationsOfTwo(x : Int, y : Int) : Long {
    var res = 0L

    val the_min = listOf(x,y).min()!!
    for (k in 0..the_min) {
        var summand = ft[k]
        summand = (summand * btr[x][k]) % MOD
        summand = (summand * btr[y][k]) % MOD
        debug("kxy", k, x, y, "ft", ft[k], "btr", btr[x][k], btr[y][k])
        res = (res + summand) % MOD
    }
    //debug("calc", res)
    return res
}

fun main(args: Array<String>) {
    if (args.size > 0 && args[0] == "-d") {
        _debug = true;
    }

    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    debug("abc", a, b, c)
    val ab = calculateCombinationsOfTwo(a, b)
    val ac = calculateCombinationsOfTwo(a, c)
    val bc = calculateCombinationsOfTwo(b, c)

    debug("end", ab, ac, bc)

    var res = ab
    res = (res * bc) % MOD
    res = (res * ac) % MOD

    println(res)
}


val MOD = 998244353
val MAXN = 5000

var dp = Array(MAXN+5, { IntArray(MAXN+5) })
fun D(a: Int, b: Int) : Int
{
    if (a == 0 || b == 0) return 1;

    if (dp[a][b] == 0)
    {
        dp[a][b] = ((b.toLong() * D(a - 1, b - 1) + D(a - 1, b)) % MOD).toInt();
    }

    return dp[a][b];
}

fun main(args: Array<String>) {
    val xs = readLine()!!.split(' ').map(String::toInt).sorted()
    val (a, b, c) = xs

    println(((D(a, b).toLong() * D(b, c).toLong()) % MOD * D(a, c).toLong()) % MOD);
}


fun main() {
    val n = readInt()

    val points = List(4*n + 1) { readInts().let { (x, y) -> Point(x, y) } }

    val xcnt = points.groupingBy { it.x }.eachCount()
    val ycnt = points.groupingBy { it.y }.eachCount()

    fun Map<Int, Int>.squareBoundaries() = run {
        val f = keys.filter {
            this[it]!! >= n
        }
        listOf(f.min()!!, f.max()!!)
    }

    val xb = xcnt.squareBoundaries()
    val yb = ycnt.squareBoundaries()

    val ans = points.first {
        when {
            it.x in xb -> it.y !in yb[0]..yb[1]
            it.y in yb -> it.x !in xb[0]..xb[1]
            else -> true
        }
    }

    println("${ans.x} ${ans.y}")
}

data class Point(val x: Int, val y: Int)

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

class Output {
    private val sb = StringBuilder()
    fun print(o: Any?) { sb.append(o) }
    fun println() { sb.append('\n') }
    fun println(o: Any?) { sb.append(o).append('\n') }
    @JvmName("_print") fun Any?.print() = print(this)
    @JvmName("_println") fun Any?.println() = println(this)
    fun nowPrint() { kotlin.io.print(sb) }
}
inline fun output(block: Output.()->Unit)
    { Output().apply(block).nowPrint() }


fun main() {
    val n = readInt()

    val points = List(4*n + 1) { readInts().let { (x, y) -> Point(x, y) } }

    val xcnt = points.groupingBy { it.x }.eachCount()
    val ycnt = points.groupingBy { it.y }.eachCount()

    fun Map<Int, Int>.squareBoundaries() = run {
        val f = keys.filter {
            this[it]!! >= n
        }
        listOf(f.min()!!, f.max()!!)
    }

    val xb = xcnt.squareBoundaries()
    val yb = ycnt.squareBoundaries()

    val ans = points.first {
        when {
            it.x in xb -> it.y in yb[0]..yb[1]
            it.y in yb -> it.x in xb[0]..xb[1]
            else -> false
        }.not()
    }

    println("${ans.x} ${ans.y}")
}

data class Point(val x: Int, val y: Int)

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readDouble() = readLn().toDouble()
fun readLong() = readLn().toLong()
fun readStrings() = readLn().split(' ')
fun readInts() = readStrings().map { it.toInt() }
fun readDoubles() = readStrings().map { it.toDouble() }
fun readLongs() = readStrings().map { it.toLong() }

class Output {
    private val sb = StringBuilder()
    fun print(o: Any?) { sb.append(o) }
    fun println() { sb.append('\n') }
    fun println(o: Any?) { sb.append(o).append('\n') }
    @JvmName("_print") fun Any?.print() = print(this)
    @JvmName("_println") fun Any?.println() = println(this)
    fun nowPrint() { kotlin.io.print(sb) }
}
inline fun output(block: Output.()->Unit)
    { Output().apply(block).nowPrint() }


import kotlin.math.abs
import kotlin.math.min

fun main(args: Array<String>) {
    val (n, s, k) = readLine()!!.split(' ').map(String::toInt)
    val r = readLine()!!.split(' ').map(String::toInt).toIntArray()
    val c = readLine()!!.map {
        when (it) {
            'R' -> 0
            'G' -> 1
            'B' -> 2
            else -> throw Exception()
        }
    }
    val dp = Array(n) { IntArray(2501) { Int.MAX_VALUE } }
    for (i in 0 until n) dp[i][r[i]] = abs((s - 1) - i)
    for (sAll in 1..2500) {
        for (i in 0 until n) {
            if (dp[i][sAll] != Int.MAX_VALUE) {
                for (j in 0 until n) if (c[j] != c[i] && r[j] > r[i]) {
                    dp[j][sAll + r[j]] = min(dp[j][sAll + r[j]], dp[i][sAll] + abs(i - j))
                }
            }
        }
    }
    println(dp.map { it.drop(k).min()!! }.min().let { if (it != Int.MAX_VALUE) it else -1 })
}


fun main(args: Array<String>) {
    var str = arrayOf("","","","","","")
    for(i in 0..5) {
        str[i] = readLine()!!
    }
    var bx = 0
    var by = 0
    var bm = 0
    for(i in 0..5) {
        var ry = 0
        for(j in 0..7) {
            if(str[i][j] == '-')
                continue
            if(str[i][j] != '*') {
                var mark = 3 - (i / 2)
                if(ry == 2 || ry == 3)
                    mark++
                if(mark > bm) {
                    bm = mark
                    bx = i
                    by = j
                }
            }
            ry++
        }
    }
    for(i in 0..5) {
        for(j in 0..7) {
            if(i==bx && j == by) {
                print('P')
            } else {
                print(str[i][j])
            }
        }
        print("\n")
    }
}


fun main(arg: Array<String>){
    var s = Array(6, {i -> "".toCharArray()})
    val n = 6
    val m = 8
    val l1:IntArray = intArrayOf(3, 3, 0, 4, 4, 0, 3, 3)
    val l2:IntArray = intArrayOf(2, 2, 0, 3, 3, 0, 2, 2)
    val l3:IntArray = intArrayOf(1, 1, 0, 2, 2, 0, 1, 1)
    val a:Array<IntArray> = arrayOf(l1, l1, l2, l2, l3, l3)
    var x = -1
    var y = -1
    var best = 0
    for (i in 0..(n-1)) {
        s[i] = (readLine()!!).toCharArray()
        for (j in 0..(m-1)) {
            if (s[i].get(j) == '.' && a[i][j] > best) {
                x = i
                y = j
                best = a[i][j]
            }
        }

    }
    s[x][y] = 'P'
    for (i in 0..(n-1))
        println(s[i])
}


import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
import kotlin.Comparator

fun main(args : Array<String>){
    val scan = BufferedReader(InputStreamReader(System.`in`));
    var s1 = scan.readLine();
    var s2 = scan.readLine();
    var s3 = scan.readLine();
    var s4 = scan.readLine();
    var s5 = scan.readLine();
    var s6 = scan.readLine();
    var ss1 = s1.toCharArray();
    var ss2 = s2.toCharArray();
    var ss3 = s3.toCharArray();
    var ss4 = s4.toCharArray();
    var ss5 = s5.toCharArray();
    var ss6 = s6.toCharArray();
    var sh1 = intArrayOf(3, 3, -1, 4, 4, -1, 3, 3);
    var sh2 = intArrayOf(3, 3, -1, 4, 4, -1, 3, 3);
    var sh3 = intArrayOf(2, 2, -1, 3, 3, -1, 2, 2);
    var sh4 = intArrayOf(2, 2, -1, 3, 3, -1, 2, 2);
    var sh5 = intArrayOf(1, 1, -1, 2, 2, -1, 1, 1);
    var sh6 = intArrayOf(1, 1, -1, 2, 2, -1, 1, 1);
    var arrsh = arrayOf(sh1, sh2, sh3, sh4, sh5, sh6);
    var arrss = arrayOf(ss1, ss2, ss3, ss4, ss5, ss6);
    var x = 0;
    var y = 0;
    var vl = 0;
    var i = 0;
    while (i < 6){
        var j = 0;
        while (j < 8){
            if (arrss[i][j] == '.' && arrsh[i][j] > vl){
                x = j;
                y = i;
                vl = arrsh[i][j];
            }
            j++;
        }
        i++;
    }
    i = 0;
    while (i < 6){
        var j = 0;
        while (j < 8){
            if (x == j && y == i){
                System.out.print('P');
            }else{
                System.out.print(arrss[i][j]);
            }
            j++;
        }
        System.out.println();
        i++;
    }
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val numBalls = readLine()!!.toInt()
    val sizes = readInts().toSet().toList().sorted()
    for (pos in 0 until numBalls - 2)
        if (sizes[pos] + 1 == sizes[pos + 1] && sizes[pos] + 2 == sizes[pos + 2]) return print("YES")
    print("NO")
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    readLine()
    val sizes = readInts().toSet().toList().sorted()
    for (pos in 0 until sizes.size - 2)
        if (sizes[pos] + 1 == sizes[pos + 1] && sizes[pos] + 2 == sizes[pos + 2]) return print("YES")
    print("NO")
}


import java.io.*
import java.util.*

const val INPUT_FILE_NAME = "input"
const val OUTPUT_FILE_NAME = "output"

fun main(args: Array<String>) {
    solve(System.`in`, System.out)
//    solve(FileInputStream("$INPUT_FILE_NAME.txt"), FileOutputStream("$OUTPUT_FILE_NAME.txt"))
}

val MAX_N = (1e6 + 10).toInt()
val INF = (1e9 + 7).toInt()
val MOD = (1e9 + 7).toInt()

fun solve(input: InputStream, output: OutputStream) {
    val reader = InputReader(BufferedInputStream(input))
    val writer = PrintWriter(BufferedOutputStream(output))

    solve(reader, writer)
    writer.close()
}

fun solve(reader: InputReader, writer: PrintWriter) {
    val n = reader.nextInt()
    val b = BooleanArray(1001)
    reader.nextArrayInt(n).forEach { b[it] = true }
    for (i in 1..998) {
        if (b[i] && b[i + 1] && b[i + 2]) {
            writer.println("YES")
            return
        }
    }
    writer.println("NO")
}

fun gcd(a: Int, b: Int): Int {
    return if (b == 0) a else gcd(b, a % b)
}

class InputReader(stream: InputStream) {
    private val reader = BufferedReader(InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer? = null

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }

    fun nextArrayInt(count: Int): IntArray {
        return nextArrayInt(0, count)
    }

    fun nextArrayInt(start: Int, count: Int): IntArray {
        val a = IntArray(start + count)
        for (i in start until start + count) {
            a[i] = nextInt()
        }
        return a
    }

    fun nextArrayLong(count: Int): LongArray {
        val a = LongArray(count)
        for (i in 0 until count) {
            a[i] = nextLong()
        }
        return a
    }
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    val numBalls = readLine()!!.toInt()
    val sizes = readInts().sorted()
    for (pos in 0 until numBalls - 2)
        if (sizes[pos] + 1 == sizes[pos + 1] && sizes[pos] + 2 == sizes[pos + 2]) return print("YES")
    print("NO")
}


import java.util.Scanner
fun main(args : Array<String>){
    val reader = Scanner(System.`in`)
    var n: Int = reader.nextInt()
    var k: Int = reader.nextInt()
    var list1: MutableList<Int> = mutableListOf()
    var b = 0
    for(i in 2..n){
        if(Prime(i) == 1) {
            for (j in 2..i) {
                if (Prime(j) == 1) {
                    list1.add(j)
                }
            }
            for (x in 1..list1.size - 1) {
                if (list1[x - 1] + list1[x] + 1 == i) {
                    b++
                }
            }
            list1.clear()
        }
    }

    if(b>=k){ println("YES")}
    else { println("NO")}

}

 fun Prime(n: Int):Int{
    var a = 0
    for(i in 2..n/2) {
        if (n % i==0) {
            a++
        }
    }
    if(a==0) return 1
    else return 0
 }


import java.io.*
import java.util.*

class InputReader(val stream: InputStream) {
    val buf = ByteArray(1024)
    var curChar: Int = 0
    var numChars: Int = 0

    fun read(): Char {
        if (numChars == -1)
            throw InputMismatchException()
        if (curChar >= numChars) {
            curChar = 0
            try {
                numChars = stream.read(buf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }
            if (numChars <= 0)
                return '\uFFFF'
        }
        return buf[curChar++].toChar()
    }

    fun nextInt(): Int {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextLong(): Long {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0L
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextString(): String {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        val res = StringBuilder()
        do {
            res.append(c)
            c = read()
        } while (!isSpaceChar(c))
        return res.toString()
    }

    fun isSpaceChar(c: Char): Boolean {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\uFFFF'
    }
}

class OutputWriter(val stream: OutputStream) {
    val buf = ByteArray(65536)
    var curPos: Int = 0

    fun write(c: Char) {
        if (buf.size - curPos < 1) flush()
        buf[curPos++] = c.toByte()
    }

    fun write(s: String) {
        if (buf.size - curPos < s.length) flush()
        var idx = 0
        if (s.length > buf.size) {
            var remaining = s.length
            while (remaining > buf.size) {
                while (curPos < buf.size) buf[curPos++] = s[idx++].toByte()
                flush()
                remaining -= buf.size
            }
        }
        while (idx < s.length) buf[curPos++] = s[idx++].toByte()
    }

    fun flush() {
        stream.write(buf, 0, curPos)
        curPos = 0
    }
}

fun isprime(n: Int): Boolean {
    if (n == 2 || n == 3)
        return true
    if (n % 2 == 0 || n % 3 == 0 || n == 1)
        return false
    var i = 5
    var w = 2
    while (i * i <= n) {
        if (n % i == 0)
            return false
        i += w
        w = 6 - w
    }
    return true
}

fun main(args: Array<String>) {
    if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))
    val ir = InputReader(System.`in`)
    val ow = OutputWriter(System.out)

    var answer = 0
    val n = ir.nextInt()
    val k = ir.nextInt()
    for (i in 2 .. n / 2) {
        if (!isprime(i)) continue
        for (j in i + 1 .. n - 1) {
            if (!isprime(j)) continue
            if (isprime(i + j + 1) && (i + j + 1) <= n) {
                ++answer
                //println("$i $j")
            }
            break
        }
    }

    if (answer >= k) ow.write("YES\n")
    else ow.write("NO\n")
    ow.flush()
}


import java.io.*
import java.util.*

class InputReader(val stream: InputStream) {
    val buf = ByteArray(1024)
    var curChar: Int = 0
    var numChars: Int = 0

    fun read(): Char {
        if (numChars == -1)
            throw InputMismatchException()
        if (curChar >= numChars) {
            curChar = 0
            try {
                numChars = stream.read(buf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }
            if (numChars <= 0)
                return '\uFFFF'
        }
        return buf[curChar++].toChar()
    }

    fun nextInt(): Int {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextLong(): Long {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0L
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextString(): String {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        val res = StringBuilder()
        do {
            res.append(c)
            c = read()
        } while (!isSpaceChar(c))
        return res.toString()
    }

    fun isSpaceChar(c: Char): Boolean {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\uFFFF'
    }
}

class OutputWriter(val stream: OutputStream) {
    val buf = ByteArray(65536)
    var curPos: Int = 0

    fun write(c: Char) {
        if (buf.size - curPos < 1) flush()
        buf[curPos++] = c.toByte()
    }

    fun write(s: String) {
        if (buf.size - curPos < s.length) flush()
        var idx = 0
        if (s.length > buf.size) {
            var remaining = s.length
            while (remaining > buf.size) {
                while (curPos < buf.size) buf[curPos++] = s[idx++].toByte()
                flush()
                remaining -= buf.size
            }
        }
        while (idx < s.length) buf[curPos++] = s[idx++].toByte()
    }

    fun flush() {
        stream.write(buf, 0, curPos)
        curPos = 0
    }
}

fun isprime(n: Int): Boolean {
    if (n == 2 || n == 3)
        return true
    if (n % 2 == 0 || n % 3 == 0 || n == 1)
        return false
    var i = 5
    var w = 2
    while (i * i <= n) {
        if (n % i == 0)
            return false
        i += w
        w = 6 - w
    }
    return true
}

fun main(args: Array<String>) {
    if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))
    val ir = InputReader(System.`in`)
    val ow = OutputWriter(System.out)

    var answer = 0
    val n = ir.nextInt()
    val k = ir.nextInt()
    for (i in 2 .. n / 2) {
        if (!isprime(i)) continue
        for (j in i + 1 .. n - i) {
            if (!isprime(j)) continue
            if (isprime(i + j + 1) && (i + j + 1) <= n) {
                ++answer
                //println("$i $j")
            }
            break
        }
    }

    if (answer >= k) ow.write("YES\n")
    else ow.write("NO\n")
    ow.flush()
}


fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)
    fun sieve(limit: Int): List<Int> {
        val notPrimes = mutableSetOf<Int>()
        val primes = ArrayList<Int>()
        for (num in 2..limit) {
            if (num !in notPrimes) {
                primes.add(num)
                var notPrime = num + num
                while (notPrime <= limit) {
                    notPrimes.add(notPrime)
                    notPrime += num
                }
            }
        }
        return primes
    }
    val (n, k) = readInts()
    val primes = sieve(n)
    var sol = 0
    for (goal in primes)
        for (pos in 1 until primes.size)
            if (primes[pos] + primes[pos - 1] + 1 > goal) break
            else if (primes[pos] + primes[pos - 1] + 1 == goal) {
                sol++
                break
            }
    print(if (sol >= k) "YES" else "NO")
}


fun main() {
    var (n, k) = readLine()!!.split(' ').map { it.toInt() }
    var prime = Array<Boolean>(1001, { true })
    var primenumbers = mutableListOf<Int>()

    var p = 2
    var count = 0
    while (p * p <= 1001) {
        if (prime[p] == true) {

            for (i in p * 2..n step p) {
                prime[i] = false
            }
        }
        p++
    }

    for (i in 2..n) {
        if (prime[i]) {
            primenumbers.add(i)
        }
    }

    var i = 0
    while (i < primenumbers.size) {
        for (j in 0 until primenumbers.size-1) {
            var index = primenumbers[i] + primenumbers[j] + 1
            if (primenumbers[j] + primenumbers[j + 1] + 1 == primenumbers[i]) {
                count++
            }
        }
        i++
    }
    println(if (count >= k) "YES" else "NO")

}


fun main() {
    var (n, k) = readLine()!!.split(' ').map { it.toInt() }
    var prime = Array<Boolean>(n + 1, { true })
    var primenumbers = mutableListOf<Int>()

    var p = 2
    var count = 0
    while (p * p <= n) {
        if (prime[p] == true) {

            for (i in p * 2..n step p) {
                prime[i] = false
            }
        }
        p++
    }

    for (i in 2..n) {
        if (prime[i]) {
            primenumbers.add(i)
        }
    }

    var i = 0
    while (i < primenumbers.size - 1) {
        var flag = false
        for (j in i + 1 until primenumbers.size) {
            if (primenumbers.contains(primenumbers[i] + primenumbers[j] + 1)) {
                count++
                primenumbers.removeAt(i)
                primenumbers.removeAt(j)
                flag = true
                break
            }
        }
        if (!flag) i++

    }
    println(if (count >= k) "YES" else "NO")

}


import java.io.*
import java.util.*

class InputReader(val stream: InputStream) {
    val buf = ByteArray(1024)
    var curChar: Int = 0
    var numChars: Int = 0

    fun read(): Char {
        if (numChars == -1)
            throw InputMismatchException()
        if (curChar >= numChars) {
            curChar = 0
            try {
                numChars = stream.read(buf)
            } catch (e: IOException) {
                throw InputMismatchException()
            }
            if (numChars <= 0)
                return '\uFFFF'
        }
        return buf[curChar++].toChar()
    }

    fun nextInt(): Int {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextLong(): Long {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        var sgn = 1
        if (c == '-') {
            sgn = -1
            c = read()
        }
        var res = 0L
        do {
            if (c < '0' || c > '9')
                throw InputMismatchException()
            res *= 10
            res += c.toInt() and 15
            c = read()
        } while (!isSpaceChar(c))
        return res * sgn
    }

    fun nextString(): String {
        var c = read()
        while (isSpaceChar(c))
            c = read()
        val res = StringBuilder()
        do {
            res.append(c)
            c = read()
        } while (!isSpaceChar(c))
        return res.toString()
    }

    fun isSpaceChar(c: Char): Boolean {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == '\uFFFF'
    }
}

class OutputWriter(val stream: OutputStream) {
    val buf = ByteArray(65536)
    var curPos: Int = 0

    fun write(c: Char) {
        if (buf.size - curPos < 1) flush()
        buf[curPos++] = c.toByte()
    }

    fun write(s: String) {
        if (buf.size - curPos < s.length) flush()
        var idx = 0
        if (s.length > buf.size) {
            var remaining = s.length
            while (remaining > buf.size) {
                while (curPos < buf.size) buf[curPos++] = s[idx++].toByte()
                flush()
                remaining -= buf.size
            }
        }
        while (idx < s.length) buf[curPos++] = s[idx++].toByte()
    }

    fun flush() {
        stream.write(buf, 0, curPos)
        curPos = 0
    }
}

fun isprime(n: Int): Boolean {
    if (n == 2 || n == 3)
        return true
    if (n % 2 == 0 || n % 3 == 0 || n == 1)
        return false
    var i = 5
    var w = 2
    while (i * i <= n) {
        if (n % i == 0)
            return false
        i += w
        w = 6 - w
    }
    return true
}

fun main(args: Array<String>) {
    if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))
    val ir = InputReader(System.`in`)
    val ow = OutputWriter(System.out)

    var answer = 0
    val n = ir.nextInt()
    val k = ir.nextInt()
    for (i in 2 .. n / 2) {
        if (!isprime(i)) continue
        for (j in i + 1 .. n / 2) {
            if (!isprime(j)) continue
            if (isprime(i + j + 1) && (i + j + 1) <= n) ++answer
            break
        }
    }

    if (answer >= k) ow.write("YES\n")
    else ow.write("NO\n")
    ow.flush()
}


import java.util.Scanner
fun main(args : Array<String>){
    val reader = Scanner(System.`in`)
    var n: Int = reader.nextInt()
    var k: Int = reader.nextInt()
    var list1: MutableList<Int> = mutableListOf()
    var b = 0
    for(i in 2..n){
        if(checkPrime(i) == 1) {
            for (j in 2..i) {
                if (checkPrime(j) == 1) {
                    list1.add(j)
                }
            }
            for (x in 1..list1.size - 1) {
                if (list1[x - 1] + list1[x] + 1 == i) {
                    b++
                }
            }
            list1.clear()
        }
    }

    if(b>=k){ println("YES")}
    else { println("NO")}

}

 fun Prime(n: Int):Int{
    var a = 0
    for(i in 2..n/2) {
        if (n % i==0) {
            a++
        }
    }
    if(a==0) return 1
    else return 0
 }


val MOD = 1000000007

fun multiplyMatrices(firstMatrix: Array<Array<Int>>, secondMatrix: Array<Array<Int>>, r1: Int, c1: Int, c2: Int): Array<Array<Int>> {
    val product = Array(r1) { IntArray(c2).toTypedArray() }
    for (i in 0 until r1) {
        for (j in 0 until c2) {
            for (k in 0 until c1) {
                product[i][j] = ((product[i][j].toLong() + firstMatrix[i][k].toLong() * secondMatrix[k][j].toLong()) % MOD).toInt()
            }
        }
    }

    return product
}

fun rise(matrix: Array<Array<Int>>, p: Long): Array<Array<Int>> {
    var ind = 0
    var multiArray = Array<Array<Int>>(matrix.size) { Array(matrix.size) {0} }
    for (row in 0 until matrix.size) {
        multiArray[row][row] = 1
    }
    var factor = matrix
    while ((p shr ind) > 0) {
        if ((p shr ind) and 1L == 1L)
            multiArray = multiplyMatrices(multiArray, factor, matrix.size, matrix.size, matrix.size)
        factor = multiplyMatrices(factor, factor, matrix.size, matrix.size, matrix.size)
        ind++
    }
    return multiArray
}

fun main(args: Array<String>) {
    val (n, ml) = readLine()!!.split(' ').map(String::toLong)
    val m = ml.toInt()
    val multiArray = Array<Array<Int>>(m) { Array(m) {0} }
    for (row in 0 until m-1) {
        multiArray[row][row+1] = 1
    }
    multiArray[m-1][0] = 1
    multiArray[m-1][m-1] = 1

    val finar = rise(multiArray, n-1)

    val init = Array<Array<Int>>(m) { Array(1) {1} }

    val result = multiplyMatrices(finar, init, m, m, 1)

    print(result[m-1][0])
}


val MOD = 1000000007

fun multiplyMatrices(firstMatrix: Array<Array<Int>>, secondMatrix: Array<Array<Int>>, r1: Int, c1: Int, c2: Int): Array<Array<Int>> {
    val product = Array(r1) { IntArray(c2).toTypedArray() }
    for (i in 0 until r1) {
        for (j in 0 until c2) {
            for (k in 0 until c1) {
                product[i][j] = ((product[i][j].toLong() + firstMatrix[i][k].toLong() * secondMatrix[k][j].toLong()) % MOD).toInt()
            }
        }
    }

    return product
}

fun rise(matrix: Array<Array<Int>>, p: Int): Array<Array<Int>> {
    var ind = 0
    var multiArray = Array<Array<Int>>(matrix.size) { Array(matrix.size) {0} }
    for (row in 0 until matrix.size) {
        multiArray[row][row] = 1
    }
    var factor = matrix
    while ((p shr ind) > 0) {
        if ((p shr ind) and 1 == 1)
            multiArray = multiplyMatrices(multiArray, factor, matrix.size, matrix.size, matrix.size)
        factor = multiplyMatrices(factor, factor, matrix.size, matrix.size, matrix.size)
        ind++
    }
    return multiArray
}

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val multiArray = Array<Array<Int>>(m) { Array(m) {0} }
    for (row in 0 until m-1) {
        multiArray[row][row+1] = 1
    }
    multiArray[m-1][0] = 1
    multiArray[m-1][m-1] = 1

    val finar = rise(multiArray, n-1)

    val init = Array<Array<Int>>(m) { Array(1) {1} }

    val result = multiplyMatrices(finar, init, m, m, 1)

    print(result[m-1][0])
}


import java.lang.Math.*
import java.util.*

private fun readInt() = readLine()!!.toInt()
private fun readLong() = readLine()!!.toLong()
private fun readInts() = readLine()!!.split(" ").map(String::toInt)
private fun readLongs() = readLine()!!.split(" ").map(String::toLong)

fun matmul(matA: Array<LongArray>, matB: Array<LongArray>, mod: Long): Array<LongArray> {
    val (x, y, z) = Triple(matA.size, matB[0].size, matA[0].size)
    val res = Array(x) { LongArray(y) }

    for (i in 0 until x) for (j in 0 until y) for (k in 0 until z) {
        res[i][j] = (res[i][j] + matA[i][k] * matB[k][j]) % mod
    }

    return res
}

fun main(args: Array<String>) {
    var (n, m) = readLongs()
    val mod: Long = 1000000007
    var matA = Array(m.toInt()) { LongArray(m.toInt()) }
    var matB = Array(m.toInt()) { LongArray(1) }

    for (i in 1 until m.toInt()) matA[i-1][i] = 1
    matA[0][0] = 1
    matA.last()[0] = 1
    matB[0][0] = 1

    while (n > 0) {
        if (n.and(1) == 1L) {
            matB = matmul(matA, matB, mod)
        }
        matA = matmul(matA, matA, mod)
        n = n.shr(1)
    }

    println(matB[0][0])
}


import java.util.Scanner
fun main(args : Array<String>){
    val reader = Scanner(System.`in`)
    var n: Int = reader.nextInt()

    if(n<0) {n =-n}
    var res = 0
    var tot = 0
    while(tot<n || (tot-n)%2==1)
    {
        res++
        tot+=res
    }
    println(res)
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

fun testBipartite(N: Int, g: Array<BooleanArray>, D: IntArray): Boolean {
  for (u in 0 until N) {
    for (v in 0 until N) {
      if (!g[u][v]) continue
      if (D[v] % 2 == D[u] % 2) {
        return false
      }
    }
  }

  return true
}
/**
 * (dist, parent, queue)
 * @param rt ルートノードを指定する。nullの場合は全ノード辿るまで繰り返す
 */
fun traceBfs(g: Array<BooleanArray>, rt: Int? = 0): Array<IntArray> {
  val n = g.size
  val q = IntArray(n)
  val d = IntArray(n)
  val p = IntArray(n){-2}
  var h = 0
  var t = 0

  fun bfs(rt: Int) {
    p[rt] = -1
    q[t++] = rt
    d[rt] = 0
    while (h < t) {
      val u = q[h++]
      for (v in 0 until n) {
        if (!g[u][v]) continue
        if (p[v] == -2) {
          p[v] = u
          q[t++] = v
          d[v] = d[u] + 1
        }
      }
    }
  }

  if (rt != null) {
    bfs(rt)
  } else {
    for (u in 0 until n) {
      if (p[u] != -2) continue
      bfs(u)
    }
  }
  return arrayOf(d, p, q)
}
fun packUGraph(n: Int, from: IntArray, to: IntArray): Array<IntArray> {
  val p = IntArray(n)
  val m = from.size
  for (i in 0 until m) {
    ++p[from[i]]
    ++p[to[i]]
  }
  val g = Array(n){IntArray(p[it])}
  for (i in 0 until m) {
    g[from[i]][--p[from[i]]] = to[i]
    g[to[i]][--p[to[i]]] = from[i]
  }
  return g
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  private val reader = BufferedReader(InputStreamReader(stream), 32768)

  private val N = ni()
  private val M = ni()
  fun solve() {
    val g = Array(N){BooleanArray(N){true} }
    for (i in 0 until N) {
      g[i][i] = false
    }

    for (i in 0 until M) {
      val u = ni() - 1
      val v = ni() - 1
      g[u][v] = false
      g[v][u] = false
    }

    if (isDebug) {
      for (i in 0 until N) {
        debug(g[i])
      }
    }

    val (dist, _, _) = traceBfs(g, null)
    if (!testBipartite(N, g, dist)) {
      out.println("No")
      return
    }

    val ans = CharArray(N)
    for (i in 0 until N) {
      if (g[i].count{it} == 0) {
        ans[i] = 'b'
      } else {
        ans[i] = if (dist[i] % 2 == 0) 'a' else 'c'
      }
    }

    out.println("Yes")
    out.println(ans.joinToString(""))
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { toString(a) }
  }

  private inline fun toString(a: BooleanArray) = run{a.map { if (it) 1 else 0 }.joinToString("")}

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

fun testBipartite(N: Int, g: Array<BooleanArray>, D: IntArray): Boolean {
  for (u in 0 until N) {
    for (v in 0 until N) {
      if (!g[u][v]) continue
      if (D[v] % 2 == D[u] % 2) {
        return false
      }
    }
  }

  return true
}
/**
 * (dist, parent, queue)
 * @param rt ルートノードを指定する。nullの場合は全ノード辿るまで繰り返す
 */
fun traceBfs(g: Array<BooleanArray>): Array<IntArray>? {
  val n = g.size
  val q = IntArray(n)
  val d = IntArray(n)
  val p = IntArray(n){-2}
  var h = 0
  var t = 0

  fun bfs(rt: Int) {
    p[rt] = -1
    q[t++] = rt
    d[rt] = 0
    while (h < t) {
      val u = q[h++]
      for (v in 0 until n) {
        if (!g[u][v]) continue
        if (p[v] == -2) {
          p[v] = u
          q[t++] = v
          d[v] = d[u] + 1
        }
      }
    }
  }

  var traced = false
  for (u in 0 until n) {
    if (g[u].all{!it}) continue
    if (p[u] != -2) continue
    if (traced) return null
    bfs(u)
    traced = true
  }
  return arrayOf(d, p, q)
}
fun packUGraph(n: Int, from: IntArray, to: IntArray): Array<IntArray> {
  val p = IntArray(n)
  val m = from.size
  for (i in 0 until m) {
    ++p[from[i]]
    ++p[to[i]]
  }
  val g = Array(n){IntArray(p[it])}
  for (i in 0 until m) {
    g[from[i]][--p[from[i]]] = to[i]
    g[to[i]][--p[to[i]]] = from[i]
  }
  return g
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  private val reader = BufferedReader(InputStreamReader(stream), 32768)

  private val N = ni()
  private val M = ni()
  fun solve() {
    if (!solve2()) {
      out.println("No")
    }
  }

  fun solve2(): Boolean {
    val g = Array(N){BooleanArray(N){true} }
    for (i in 0 until N) {
      g[i][i] = false
    }

    for (i in 0 until M) {
      val u = ni() - 1
      val v = ni() - 1
      g[u][v] = false
      g[v][u] = false
    }

    if (isDebug) {
      for (i in 0 until N) {
        debug(g[i])
      }
    }

    val (dist, _, _) = traceBfs(g) ?: return false
    if (!testBipartite(N, g, dist)) {
      return false
    }

    val ans = CharArray(N)
    for (i in 0 until N) {
      if (g[i].count{it} == 0) {
        ans[i] = 'b'
      } else {
        ans[i] = if (dist[i] % 2 == 0) 'a' else 'c'
      }
    }

    out.println("Yes")
    out.println(ans.joinToString(""))
    return true
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { toString(a) }
  }

  private inline fun toString(a: BooleanArray) = run{a.map { if (it) 1 else 0 }.joinToString("")}

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.AssertionError
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007

fun testBipartite(N: Int, g: Array<BooleanArray>, D: IntArray): Boolean {
  for (u in 0 until N) {
    for (v in 0 until N) {
      if (!g[u][v]) continue
      if (D[v] % 2 == D[u] % 2) {
        return false
      }
    }
  }

  return true
}
/**
 * (dist, parent, queue)
 * @param rt ルートノードを指定する。nullの場合は全ノード辿るまで繰り返す
 */
fun traceBfs(g: Array<BooleanArray>): Array<IntArray>? {
  val n = g.size
  val q = IntArray(n)
  val d = IntArray(n)
  val p = IntArray(n){-2}
  var h = 0
  var t = 0

  fun bfs(rt: Int) {
    p[rt] = -1
    q[t++] = rt
    d[rt] = 0
    while (h < t) {
      val u = q[h++]
      for (v in 0 until n) {
        if (!g[u][v]) continue
        if (p[v] == -2) {
          p[v] = u
          q[t++] = v
          d[v] = d[u] + 1
        }
      }
    }
  }

  var traced = false
  for (u in 0 until n) {
    if (g[u].all{!it}) continue
    if (p[u] != -2) continue
    if (traced) return null
    bfs(u)
    traced = true
  }
  return arrayOf(d, p, q)
}
fun packUGraph(n: Int, from: IntArray, to: IntArray): Array<IntArray> {
  val p = IntArray(n)
  val m = from.size
  for (i in 0 until m) {
    ++p[from[i]]
    ++p[to[i]]
  }
  val g = Array(n){IntArray(p[it])}
  for (i in 0 until m) {
    g[from[i]][--p[from[i]]] = to[i]
    g[to[i]][--p[to[i]]] = from[i]
  }
  return g
}
class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  private val reader = BufferedReader(InputStreamReader(stream), 32768)

  private val N = ni()
  private val M = ni()
  fun solve() {
    if (!solve2()) {
      out.println("No")
    }
  }

  fun solve2(): Boolean {
    val g = Array(N){BooleanArray(N){true} }
    for (i in 0 until N) {
      g[i][i] = false
    }

    for (i in 0 until M) {
      val u = ni() - 1
      val v = ni() - 1
      g[u][v] = false
      g[v][u] = false
    }

    if (isDebug) {
      for (i in 0 until N) {
        debug(g[i])
      }
    }

    val (dist, _, _) = traceBfs(g) ?: return false
    if (!testBipartite(N, g, dist)) {
      return false
    }

    val ans = CharArray(N)
    for (i in 0 until N) {
      if (g[i].count{it} == 0) {
        ans[i] = 'b'
      } else {
        ans[i] = if (dist[i] % 2 == 0) 'a' else 'c'
      }
    }

    for (i in 0 until N) {
      for (j in 0 until N) {
        if (i == j) continue
        abs(ans[i] - ans[j]) <= 1
        if (abs(ans[i] - ans[j]) <= 1 != !g[i][j]) {
          return false
        }
      }
    }

    out.println("Yes")
    out.println(ans.joinToString(""))
    return true
  }

  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private inline fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private inline fun debug(a: BooleanArray) {
    debug { toString(a) }
  }

  private inline fun toString(a: BooleanArray) = run{a.map { if (it) 1 else 0 }.joinToString("")}

  private inline fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private inline fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }

  private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}