#include <bits/stdc++.h>
using namespace std;
char gr[1000][1000 + 1];
int main() {
  memset(gr, 'N', sizeof gr);
  int k;
  scanf("%d", &k);
  int acc = 0, fv = 3, pt = 1;
  while (acc != k) {
    int ptv = fv + (acc > 0);
    int nfv = ptv + 1;
    if (acc) gr[fv][nfv] = gr[nfv][fv] = 'Y';
    int nptv = nfv + (acc > 0);
    gr[ptv][nptv] = gr[nptv][ptv] = 'Y';
    gr[ptv][nptv + 1] = gr[nptv + 1][ptv] = 'Y';
    int nnfv = nfv + (acc > 0) + 2;
    if (acc) gr[nfv][nnfv] = gr[nnfv][nfv] = 'Y';
    if (k & pt) {
      gr[nptv][nnfv] = gr[nnfv][nptv] = 'Y';
      acc += pt;
    }
    int nnptv = nnfv + (acc > 0);
    gr[nptv][nnptv] = gr[nnptv][nptv] = 'Y';
    gr[nptv + 1][nnptv] = gr[nnptv][nptv + 1] = 'Y';
    fv = nnfv;
    pt <<= 1;
  }
  gr[1][3] = gr[3][1] = 'Y';
  gr[fv][2] = gr[2][fv] = 'Y';
  int n = fv + 1 - 2 + 2;
  printf("%d\n", n);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      printf("%c", gr[i][j]);
    }
    puts("");
  }
  return 0;
}
