Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with *n* vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."

Same with some writers, she wants to make an example with some certain output: for example, her birthday or the number of her boyfriend. Can you help her to make a test case with answer equal exactly to *k*?
The first line contains a single integer *k* (1 ≤ *k* ≤ 10<sup class="upper-index">9</sup>).
import functools
import random
import sys
import os
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import nsmallest, nlargest, heapify, heappop, heappush
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


def I():
    return input()


def II():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(input().split())


def LII():
    return list(map(int, input().split()))


def GMI():
    return map(lambda x: int(x) - 1, input().split())


def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))


def FMI():
    return list(map(lambda x: -int(x), input().split()))

if sys.hexversion == 50924784:
    sys.stdin = open('data')

def solve():
    k = II()
    if k == 1:
        print(2)
        print('NY')
        print('YN')
        return
    l = len(str(bin(k))) - 3
    e = {}
    def add(a, b):
        if a not in e:
            e[a] = []
        if b not in e:
            e[b] = []
        e[a].append(b)
        e[b].append(a)
    p = [0]
    for i in range(l):
        cp = [2 * i + 2, 2 * i + 3]
        for pp in p:
            for c in cp:
                add(c, pp)
        p = cp
    for pp in p:
        add(pp, 1)
    l1 = [2 * l + 2 + i for i in range(l - 1, -1, -1)]
    r = -1
    for i in range(l - 1):
        if (k >> i) & 1:
            add(2 * i + 2, l1[i + 1])
            if r == -1:
                r = l1[i + 1] + 1
                for j in range(i + 1, l - 1):
                    add(l1[j], l1[j + 1])
                add(l1[l - 1], 1)
    if (k >> (l - 1)) & 1:
        add(2 * l, l1[l - 1])
        add(2 * l + 1, l1[l - 1])
        if r == -1:
            add(l1[l - 1], 1)
    r = len(e)
    print(r)
    for i in range(r):
        tl = ['N'] * r
        if i in e:
            for j in e[i]:
                tl[j] = 'Y'
        print(''.join(tl))


# f = open('data')
# input = lambda: f.readline().rstrip("\r\n")
# for t in range(II()):
#     solve()
solve()