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>).
def max_multiply(n):
    if n <= 3:
        return n - 1
    quotient, remainder = n // 3, n % 3
    if remainder == 0:
        return 3 ** quotient
    elif remainder == 1:
        return 3 ** (quotient - 1) * 4
    else:
        return 3 ** quotient * 2

def bs(l, r, k):
    while l <= r:
        m = (l + r) // 2
        if(max_multiply(m) >= k): r = m - 1
        else: l = m + 1
    return l

def self_solve():
    k = int(input())
    if k == 1:
        print(2)
        print("NY")
        print("YN")
    elif k == 2:
        print(4)
        print("NNYY")
        print("NNYY")
        print("YYNN")
        print("YYNN")
    elif k == 3:
        print(5)
        print("NNYYY")
        print("NNYYY")
        print("YYNNN")
        print("YYNNN")
        print("YYNNN")
    else:
        l, r = 0, 998
        m = bs(l, r, k)
        while m % 3 != 0: m += 1
        m += 2
        ret = [['N'] * m for _ in range(m)]
        cnt = 0
        def dfs(s, d):
            nonlocal cnt
            print(d)
            if s + 3 >= m:
                cnt += 1
                return None
            for i in range(d, d + 3):
                if s + i < m and cnt < k:
                    dfs(s + i, 6 - i)
                    print(s, s + i)
                    ret[s][s + i] = 'Y'
                    ret[s + i][s] = 'Y'
        
        for i in range(2, 5):
            dfs(i, 5 - i)
            
        ret[0][2] = 'Y'
        ret[0][3] = 'Y'
        ret[0][4] = 'Y'
        ret[2][0] = 'Y'
        ret[3][0] = 'Y'
        ret[4][0] = 'Y'
        ret[-1][1] = 'Y'
        ret[1][-1] = 'Y'
        ret[-2][1] = 'Y'
        ret[1][-2] = 'Y'
        ret[-3][1] = 'Y'
        ret[1][-3] = 'Y'
        print(m)
        for i in range(m):
            for j in range(m):
                print(ret[i][j], end = "")
            print()

# self_solve()


def solve():
    k = int(input())
    if 1 == k:
        print(2)
        print("NY")
        print("YN")
    ret = [['N'] * 105 for _ in range(105)]
    def add(i, j):
        ret[i][j] = ret[j][i] = 'Y'
    def init():
        add(1, 3)
        add(1, 4)
        add(1, 63)
        add(92, 2)
        for i in range(63, 93):
            add(i, i + 1)
        for i in range(3, 61, 2):
            add(i, i + 2)
            add(i, i + 3)
        for i in range(4, 62, 2):
            add(i, i + 1)
            add(i, i + 2)
    init()
    k -= 1
    t = 4
    while k:
        if k & 1:
            add(t, t + 59)
        k >>= 1
        t += 2
    print(93)
    for i in range(1, 94):
        for j in range(1, 94):
            print(ret[i][j], end = "")
        print()
solve()
    
    