#include <bits/stdc++.h>
using namespace ::std;
bool ans[1005][1005];
bool in[55];
int n, m;
void make_road(int v1, int v2) { ans[v1][v2] = ans[v2][v1] = true; }
int main() {
  int k, length = 0;
  scanf("%d", &k);
  while (k != 0) {
    in[m++] = k % 2;
    k /= 2;
  }
  int start = n++, end = n++;
  make_road(start, end);
  length = 1;
  for (int i = m - 2; i >= 0; i--) {
    int new_start = n++;
    make_road(new_start, n);
    n++;
    make_road(new_start, n);
    n++;
    make_road(start, n - 1);
    make_road(start, n - 2);
    start = new_start;
    length += 2;
    if (in[i]) {
      make_road(start, n);
      n++;
      for (int j = 0; j < length - 2; j++) {
        make_road(n - 1, n);
        n++;
      }
      make_road(n - 1, end);
    }
  }
  printf("%d\n", n);
  for (int i = 0; i < n; i++, printf("\n"))
    for (int j = 0; j < n; j++) {
      int i1 = i;
      if (i1 == 0)
        i1 = start;
      else if (i1 == start)
        i1 = 0;
      else if (i1 == 1)
        i1 = end;
      else if (i1 == end)
        i1 = 1;
      int j1 = j;
      if (j1 == 0)
        j1 = start;
      else if (j1 == start)
        j1 = 0;
      else if (j1 == 1)
        j1 = end;
      else if (j1 == end)
        j1 = 1;
      if (ans[i1][j1])
        printf("Y");
      else
        printf("N");
    }
  return 0;
}
