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>).
k = bin(int(input()))[2:]
if k == '1':
    print('2\nNY\nYN')
    exit()

g = [[] for _ in range(1000)]
idx, dep = 0, -1
for c in k[1:]:
    tmp = [idx + 1, idx + 2]
    g[idx] += tmp
    idx += 2
    dep += 2
    if c == '1':
        pre = 1
        for _ in range(dep):
            idx += 1
            g[pre].append(idx)
            pre = idx
        tmp.append(pre)
    idx += 1
    for v in tmp:
        g[v].append(idx)
idx += 1
f = [['N'] * idx for _ in range(idx) ]
for u, it in enumerate(g):
    if it:
        for v in it:
            f[u][v] = f[v][u] = 'Y'

print(idx)
for it in f:
    print(*it, sep='')

